Class: Ragents::Response
- Inherits:
-
Object
- Object
- Ragents::Response
- Defined in:
- lib/ragents/provider.rb
Overview
Response from a provider generation
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#finish_reason ⇒ Object
readonly
Returns the value of attribute finish_reason.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
-
#tool_calls ⇒ Object
readonly
Returns the value of attribute tool_calls.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #has_tool_calls? ⇒ Boolean
-
#initialize(content: nil, tool_calls: nil, finish_reason: nil, usage: {}, raw_response: nil) ⇒ Response
constructor
A new instance of Response.
- #to_h ⇒ Object
- #to_message ⇒ Object
Constructor Details
#initialize(content: nil, tool_calls: nil, finish_reason: nil, usage: {}, raw_response: nil) ⇒ Response
Returns a new instance of Response.
95 96 97 98 99 100 101 |
# File 'lib/ragents/provider.rb', line 95 def initialize(content: nil, tool_calls: nil, finish_reason: nil, usage: {}, raw_response: nil) @content = content @tool_calls = tool_calls || [] @finish_reason = finish_reason @usage = usage @raw_response = raw_response end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
93 94 95 |
# File 'lib/ragents/provider.rb', line 93 def content @content end |
#finish_reason ⇒ Object (readonly)
Returns the value of attribute finish_reason.
93 94 95 |
# File 'lib/ragents/provider.rb', line 93 def finish_reason @finish_reason end |
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
93 94 95 |
# File 'lib/ragents/provider.rb', line 93 def raw_response @raw_response end |
#tool_calls ⇒ Object (readonly)
Returns the value of attribute tool_calls.
93 94 95 |
# File 'lib/ragents/provider.rb', line 93 def tool_calls @tool_calls end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
93 94 95 |
# File 'lib/ragents/provider.rb', line 93 def usage @usage end |
Instance Method Details
#has_tool_calls? ⇒ Boolean
103 104 105 |
# File 'lib/ragents/provider.rb', line 103 def has_tool_calls? !@tool_calls.empty? end |
#to_h ⇒ Object
114 115 116 117 118 119 120 121 |
# File 'lib/ragents/provider.rb', line 114 def to_h { content: @content, tool_calls: @tool_calls, finish_reason: @finish_reason, usage: @usage } end |