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

#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?

Returns:

  • (Boolean)


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

def delta?
  @delta
end