Class: Antigravity::Message

Inherits:
Base
  • Object
show all
Defined in:
lib/antigravity/message.rb

Overview

Represents a response message from the agent. Mirrors Python SDK's ChatResponse with metadata.

Direct Known Subclasses

Chunk

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited

Methods included from Emojifiable

#emoji, included

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

#contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/antigravity/message.rb', line 7

def content
  @content
end

#deltaObject

Returns the value of attribute delta.



7
8
9
# File 'lib/antigravity/message.rb', line 7

def delta
  @delta
end

#model_idObject

Returns the value of attribute model_id.



7
8
9
# File 'lib/antigravity/message.rb', line 7

def model_id
  @model_id
end

#roleObject

Returns the value of attribute role.



7
8
9
# File 'lib/antigravity/message.rb', line 7

def role
  @role
end

#stepsObject

Returns the value of attribute steps.



7
8
9
# File 'lib/antigravity/message.rb', line 7

def steps
  @steps
end

#thinkingObject

Returns the value of attribute thinking.



7
8
9
# File 'lib/antigravity/message.rb', line 7

def thinking
  @thinking
end

#tokensObject

Returns the value of attribute tokens.



7
8
9
# File 'lib/antigravity/message.rb', line 7

def tokens
  @tokens
end

#tool_callsObject

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_countObject

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

#usageObject

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?

Returns:

  • (Boolean)


26
27
28
# File 'lib/antigravity/message.rb', line 26

def delta?
  @delta
end