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.
6 7 8 9 10 11 12 13 |
# File 'lib/little_ghost/model_response.rb', line 6 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
4 5 6 |
# File 'lib/little_ghost/model_response.rb', line 4 def @message end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
4 5 6 |
# File 'lib/little_ghost/model_response.rb', line 4 def @metadata end |
#stop_reason ⇒ Object (readonly)
Returns the value of attribute stop_reason
4 5 6 |
# File 'lib/little_ghost/model_response.rb', line 4 def stop_reason @stop_reason end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage
4 5 6 |
# File 'lib/little_ghost/model_response.rb', line 4 def usage @usage end |