Class: LittleGhost::Providers::OpenAICompatible::Normalizer
- Inherits:
-
Object
- Object
- LittleGhost::Providers::OpenAICompatible::Normalizer
- Defined in:
- lib/little_ghost/providers/openai_compatible.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(model:) ⇒ Normalizer
constructor
A new instance of Normalizer.
- #stream_done ⇒ Object
Constructor Details
#initialize(model:) ⇒ Normalizer
Returns a new instance of Normalizer.
443 444 445 446 447 448 449 450 451 452 |
# File 'lib/little_ghost/providers/openai_compatible.rb', line 443 def initialize(model:) @model = model @message_id = nil @text = +"" @reasoning = +"" @tool_calls = {} @usage = Usage.new @stop_reason = nil @finished = false end |
Instance Method Details
#finish ⇒ Object
454 455 456 457 458 459 |
# File 'lib/little_ghost/providers/openai_compatible.rb', line 454 def finish return [] if @finished raise ProtocolError, "Provider stream ended before its terminal event" unless @terminal [final_event] end |
#stream_done ⇒ Object
461 462 463 |
# File 'lib/little_ghost/providers/openai_compatible.rb', line 461 def stream_done @terminal = true end |