Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::StreamThinkFilter Class Reference

Streaming filter that removes <think> blocks from output. More...

#include <entropic/core/stream_think_filter.h>

Public Member Functions

 StreamThinkFilter (TokenCallback cb, void *ud)
 Construct with consumer callback.
 
void set_raw_callback (TokenCallback cb, void *ud)
 Set optional raw callback (receives ALL tokens unfiltered).
 
void on_token (const char *chunk, size_t len)
 Process a chunk of tokens.
 
void flush ()
 Flush any buffered partial tag content.
 

Detailed Description

Streaming filter that removes <think> blocks from output.

Processes tokens character-by-character. Content inside <think>...</think> tags is suppressed from the consumer callback but always forwarded to the raw callback (if set).

Version
2.0.1

Definition at line 36 of file stream_think_filter.h.

Constructor & Destructor Documentation

◆ StreamThinkFilter()

entropic::StreamThinkFilter::StreamThinkFilter ( TokenCallback  cb,
void *  ud 
)

Construct with consumer callback.

Parameters
cbConsumer token callback (receives filtered output).
udConsumer user_data.
Version
2.0.1
Parameters
cbConsumer callback.
udConsumer user_data.

Definition at line 19 of file stream_think_filter.cpp.

Member Function Documentation

◆ flush()

void entropic::StreamThinkFilter::flush ( )

Flush any buffered partial tag content.

Flush buffered partial tag and UTF-8 content.

Call at end of generation to ensure no content is lost in the tag accumulator.

Version
2.0.1

Definition at line 160 of file stream_think_filter.cpp.

◆ on_token()

void entropic::StreamThinkFilter::on_token ( const char *  chunk,
size_t  len 
)

Process a chunk of tokens.

Process an incoming token through the think-tag filter.

Parameters
chunkToken data.
lenToken byte length.
Version
2.0.1
Parameters
chunkToken byte data.
lenByte length of chunk. @utility
Version
2.0.2

Definition at line 146 of file stream_think_filter.cpp.

◆ set_raw_callback()

void entropic::StreamThinkFilter::set_raw_callback ( TokenCallback  cb,
void *  ud 
)

Set optional raw callback (receives ALL tokens unfiltered).

Set raw (unfiltered) callback.

Parameters
cbRaw callback.
udRaw user_data.
Version
2.0.1
Parameters
cbRaw callback.
udRaw user_data.

Definition at line 29 of file stream_think_filter.cpp.


The documentation for this class was generated from the following files: