Class: RubynCode::LLM::Response
- Inherits:
-
Data
- Object
- Data
- RubynCode::LLM::Response
- Defined in:
- lib/rubyn_code/llm/message_builder.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#stop_details ⇒ Object
readonly
Returns the value of attribute stop_details.
-
#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(id:, content:, stop_reason:, usage:, stop_details: nil) ⇒ Response
constructor
A new instance of Response.
- #refusal? ⇒ Boolean
- #text ⇒ Object
- #tool_calls ⇒ Object
- #tool_use? ⇒ Boolean
Constructor Details
#initialize(id:, content:, stop_reason:, usage:, stop_details: nil) ⇒ Response
Returns a new instance of Response.
36 37 38 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 36 def initialize(id:, content:, stop_reason:, usage:, stop_details: nil) super end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content
35 36 37 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 35 def content @content end |
#id ⇒ Object (readonly)
Returns the value of attribute id
35 36 37 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 35 def id @id end |
#stop_details ⇒ Object (readonly)
Returns the value of attribute stop_details
35 36 37 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 35 def stop_details @stop_details end |
#stop_reason ⇒ Object (readonly)
Returns the value of attribute stop_reason
35 36 37 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 35 def stop_reason @stop_reason end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage
35 36 37 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 35 def usage @usage end |
Instance Method Details
#refusal? ⇒ Boolean
52 53 54 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 52 def refusal? stop_reason == 'refusal' end |
#text ⇒ Object
40 41 42 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 40 def text content.select { |b| b.type == 'text' }.map(&:text).join end |
#tool_calls ⇒ Object
44 45 46 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 44 def tool_calls content.select { |b| b.type == 'tool_use' } end |
#tool_use? ⇒ Boolean
48 49 50 |
# File 'lib/rubyn_code/llm/message_builder.rb', line 48 def tool_use? stop_reason == 'tool_use' end |