Class: Antigravity::Message
Overview
Represents a response message from the agent. Mirrors Python SDK's ChatResponse with metadata.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#delta ⇒ Object
Returns the value of attribute delta.
-
#model_id ⇒ Object
Returns the value of attribute model_id.
-
#role ⇒ Object
Returns the value of attribute role.
-
#steps ⇒ Object
Returns the value of attribute steps.
-
#thinking ⇒ Object
Returns the value of attribute thinking.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
-
#tool_calls ⇒ Object
Returns the value of attribute tool_calls.
-
#tool_calls_count ⇒ Object
Returns the value of attribute tool_calls_count.
-
#usage ⇒ Object
Returns the value of attribute usage.
Instance Method Summary collapse
-
#delta? ⇒ Boolean
Is this a streaming delta (partial) or a complete response?.
-
#initialize(role: :assistant, content: '', thinking: '', tool_calls: [], model_id: nil, steps: [], tool_calls_count: 0, usage: nil, delta: false) ⇒ Message
constructor
A new instance of Message.
Methods inherited from Base
Methods included from Emojifiable
Constructor Details
#initialize(role: :assistant, content: '', thinking: '', tool_calls: [], model_id: nil, steps: [], tool_calls_count: 0, usage: nil, delta: false) ⇒ Message
Returns a new instance of Message.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/antigravity/message.rb', line 10 def initialize(role: :assistant, content: '', thinking: '', tool_calls: [], model_id: nil, steps: [], tool_calls_count: 0, usage: nil, delta: false) @role = role @content = content @thinking = thinking @tool_calls = tool_calls @model_id = model_id @tokens = { input: 0, output: 0 } @steps = steps @tool_calls_count = tool_calls_count @usage = usage || { prompt_token_count: 0, candidates_token_count: 0, total_token_count: 0 } @delta = delta end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def content @content end |
#delta ⇒ Object
Returns the value of attribute delta.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def delta @delta end |
#model_id ⇒ Object
Returns the value of attribute model_id.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def model_id @model_id end |
#role ⇒ Object
Returns the value of attribute role.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def role @role end |
#steps ⇒ Object
Returns the value of attribute steps.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def steps @steps end |
#thinking ⇒ Object
Returns the value of attribute thinking.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def thinking @thinking end |
#tokens ⇒ Object
Returns the value of attribute tokens.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def tokens @tokens end |
#tool_calls ⇒ Object
Returns the value of attribute tool_calls.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def tool_calls @tool_calls end |
#tool_calls_count ⇒ Object
Returns the value of attribute tool_calls_count.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def tool_calls_count @tool_calls_count end |
#usage ⇒ Object
Returns the value of attribute usage.
7 8 9 |
# File 'lib/antigravity/message.rb', line 7 def usage @usage end |
Instance Method Details
#delta? ⇒ Boolean
Is this a streaming delta (partial) or a complete response?
26 27 28 |
# File 'lib/antigravity/message.rb', line 26 def delta? @delta end |