Class: Rixie::LLM::Response
- Inherits:
-
Data
- Object
- Data
- Rixie::LLM::Response
- Defined in:
- lib/rixie/llm/response.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#finish_reason ⇒ Object
readonly
Returns the value of attribute finish_reason.
-
#tool_calls ⇒ Object
readonly
Returns the value of attribute tool_calls.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content
5 6 7 |
# File 'lib/rixie/llm/response.rb', line 5 def content @content end |
#finish_reason ⇒ Object (readonly)
Returns the value of attribute finish_reason
5 6 7 |
# File 'lib/rixie/llm/response.rb', line 5 def finish_reason @finish_reason end |
#tool_calls ⇒ Object (readonly)
Returns the value of attribute tool_calls
5 6 7 |
# File 'lib/rixie/llm/response.rb', line 5 def tool_calls @tool_calls end |
Class Method Details
.from_openai_wire(raw) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/rixie/llm/response.rb', line 6 def self.from_openai_wire(raw) choices = raw["choices"] || [] choice = choices.first || {} = choice["message"] || {} tool_calls = (["tool_calls"] || []).map { |tc| LLM::ToolCall.from_openai_wire(tc) } new(content: ["content"], tool_calls: tool_calls, finish_reason: choice["finish_reason"]) end |
Instance Method Details
#has_tool_calls? ⇒ Boolean
14 15 16 |
# File 'lib/rixie/llm/response.rb', line 14 def has_tool_calls? tool_calls.any? end |