Class: Ask::Agent::ResponseMessage
- Inherits:
-
Data
- Object
- Data
- Ask::Agent::ResponseMessage
- Defined in:
- lib/ask/agent/chat.rb
Overview
Response message returned by Chat#ask.
Includes token counts and cost when available from the provider.
tool_calls are calls that need local execution.
tool_results are pre-computed results from provider-executed tools.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#input_tokens ⇒ Object
readonly
Returns the value of attribute input_tokens.
-
#output_tokens ⇒ Object
readonly
Returns the value of attribute output_tokens.
-
#thinking ⇒ Object
readonly
Returns the value of attribute thinking.
-
#tool_calls ⇒ Object
readonly
Returns the value of attribute tool_calls.
-
#tool_results ⇒ Object
readonly
Returns the value of attribute tool_results.
Instance Method Summary collapse
-
#initialize(content:, tool_calls: {}, tool_results: {}, thinking: nil, input_tokens: nil, output_tokens: nil, cost: nil) ⇒ ResponseMessage
constructor
A new instance of ResponseMessage.
- #to_s ⇒ Object
- #tool_call? ⇒ Boolean
Constructor Details
#initialize(content:, tool_calls: {}, tool_results: {}, thinking: nil, input_tokens: nil, output_tokens: nil, cost: nil) ⇒ ResponseMessage
Returns a new instance of ResponseMessage.
10 11 12 13 |
# File 'lib/ask/agent/chat.rb', line 10 def initialize(content:, tool_calls: {}, tool_results: {}, thinking: nil, input_tokens: nil, output_tokens: nil, cost: nil) super(content: content, tool_calls: tool_calls, tool_results: tool_results, thinking: thinking, input_tokens: input_tokens, output_tokens: output_tokens, cost: cost) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content
9 10 11 |
# File 'lib/ask/agent/chat.rb', line 9 def content @content end |
#cost ⇒ Object (readonly)
Returns the value of attribute cost
9 10 11 |
# File 'lib/ask/agent/chat.rb', line 9 def cost @cost end |
#input_tokens ⇒ Object (readonly)
Returns the value of attribute input_tokens
9 10 11 |
# File 'lib/ask/agent/chat.rb', line 9 def input_tokens @input_tokens end |
#output_tokens ⇒ Object (readonly)
Returns the value of attribute output_tokens
9 10 11 |
# File 'lib/ask/agent/chat.rb', line 9 def output_tokens @output_tokens end |
#thinking ⇒ Object (readonly)
Returns the value of attribute thinking
9 10 11 |
# File 'lib/ask/agent/chat.rb', line 9 def thinking @thinking end |
#tool_calls ⇒ Object (readonly)
Returns the value of attribute tool_calls
9 10 11 |
# File 'lib/ask/agent/chat.rb', line 9 def tool_calls @tool_calls end |
#tool_results ⇒ Object (readonly)
Returns the value of attribute tool_results
9 10 11 |
# File 'lib/ask/agent/chat.rb', line 9 def tool_results @tool_results end |
Instance Method Details
#to_s ⇒ Object
16 |
# File 'lib/ask/agent/chat.rb', line 16 def to_s = content.to_s |
#tool_call? ⇒ Boolean
15 |
# File 'lib/ask/agent/chat.rb', line 15 def tool_call? = !tool_calls.empty? |