Class: LLM::OpenAI::Responses::StreamParser
- Inherits:
-
Object
- Object
- LLM::OpenAI::Responses::StreamParser
- Defined in:
- lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/responses/stream_parser.rb
Instance Attribute Summary collapse
-
#body ⇒ LLM::Object
readonly
Returns the fully constructed response body.
Instance Method Summary collapse
- #initialize(io) ⇒ LLM::OpenAI::Responses::StreamParser constructor
- #parse!(chunk) ⇒ LLM::OpenAI::Responses::StreamParser
Constructor Details
#initialize(io) ⇒ LLM::OpenAI::Responses::StreamParser
15 16 17 18 |
# File 'lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/responses/stream_parser.rb', line 15 def initialize(io) @body = LLM::Object.new(output: []) # Initialize with an empty output array @io = io end |
Instance Attribute Details
#body ⇒ LLM::Object (readonly)
Returns the fully constructed response body
10 11 12 |
# File 'lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/responses/stream_parser.rb', line 10 def body @body end |
Instance Method Details
#parse!(chunk) ⇒ LLM::OpenAI::Responses::StreamParser
23 24 25 |
# File 'lib/llm/shell/internal/llm.rb/lib/llm/providers/openai/responses/stream_parser.rb', line 23 def parse!(chunk) tap { handle_event(chunk) } end |