Class: LittleGhost::ModelResponse
- Inherits:
-
Data
- Object
- Data
- LittleGhost::ModelResponse
- Defined in:
- lib/little_ghost/model_response.rb,
lib/little_ghost/model_response.rb
Overview
Represents the final result shared by every provider stream. It keeps provider-specific response shapes out of the agent loop.
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#stop_reason ⇒ Object
readonly
Returns the value of attribute stop_reason.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
-
#initialize(message:, stop_reason:, usage: Usage.new, metadata: {}) ⇒ ModelResponse
constructor
Creates an immutable response and coerces
messageinto a Message.
Constructor Details
#initialize(message:, stop_reason:, usage: Usage.new, metadata: {}) ⇒ ModelResponse
Creates an immutable response and coerces message into a Message.
11 12 13 14 15 16 17 18 |
# File 'lib/little_ghost/model_response.rb', line 11 def initialize(message:, stop_reason:, usage: Usage.new, metadata: {}) super( message: Message.coerce(), stop_reason: stop_reason&.to_sym, usage: usage, metadata: .freeze ) end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message
9 10 11 |
# File 'lib/little_ghost/model_response.rb', line 9 def @message end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
9 10 11 |
# File 'lib/little_ghost/model_response.rb', line 9 def @metadata end |
#stop_reason ⇒ Object (readonly)
Returns the value of attribute stop_reason
9 10 11 |
# File 'lib/little_ghost/model_response.rb', line 9 def stop_reason @stop_reason end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage
9 10 11 |
# File 'lib/little_ghost/model_response.rb', line 9 def usage @usage end |