Module: RubyLLM::Providers::OpenAIResponses::StreamAccumulatorExtension
- Defined in:
- lib/ruby_llm/providers/openai_responses/stream_accumulator_extension.rb
Overview
Extends RubyLLM::StreamAccumulator to carry built_in_tool_events from chunks through to the final assembled Message. Without this the accumulator drops everything off the Chunk it does not know about.
Instance Method Summary collapse
Instance Method Details
#add(chunk) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/ruby_llm/providers/openai_responses/stream_accumulator_extension.rb', line 10 def add(chunk) super events = chunk_built_in_events(chunk) return if events.nil? || events.empty? @built_in_tool_events ||= [] @built_in_tool_events.concat(events) end |
#to_message(response) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ruby_llm/providers/openai_responses/stream_accumulator_extension.rb', line 19 def (response) = super if @built_in_tool_events && !@built_in_tool_events.empty? && .respond_to?(:built_in_tool_events=) .built_in_tool_events = @built_in_tool_events end end |