Class: Ask::Agent::StreamTransforms::Base
- Inherits:
-
Object
- Object
- Ask::Agent::StreamTransforms::Base
- Defined in:
- lib/ask/agent/stream_transforms/base.rb
Overview
Base class for stream transforms that process Chunks.
Each transform receives every chunk from the LLM stream and can modify, filter, or buffer it. To emit zero or more transformed chunks, yield to the provided block.
Direct Known Subclasses
Instance Method Summary collapse
-
#call(chunk) {|Ask::Chunk| ... } ⇒ Object
Process a single chunk from the LLM stream.
-
#finish {|Ask::Chunk| ... } ⇒ Object
Called once when the stream finishes, giving buffering transforms a chance to flush any remaining state.
Instance Method Details
#call(chunk) {|Ask::Chunk| ... } ⇒ Object
Process a single chunk from the LLM stream.
30 31 32 |
# File 'lib/ask/agent/stream_transforms/base.rb', line 30 def call(chunk, &block) yield chunk end |
#finish {|Ask::Chunk| ... } ⇒ Object
Called once when the stream finishes, giving buffering transforms a chance to flush any remaining state. The default is a no-op.
38 39 40 |
# File 'lib/ask/agent/stream_transforms/base.rb', line 38 def finish(&block) # no-op end |