Class: ConsoleAgent::Providers::ChatResult

Inherits:
Struct
  • Object
show all
Defined in:
lib/console_agent/providers/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#input_tokensObject

Returns the value of attribute input_tokens



87
88
89
# File 'lib/console_agent/providers/base.rb', line 87

def input_tokens
  @input_tokens
end

#output_tokensObject

Returns the value of attribute output_tokens



87
88
89
# File 'lib/console_agent/providers/base.rb', line 87

def output_tokens
  @output_tokens
end

#stop_reasonObject

Returns the value of attribute stop_reason



87
88
89
# File 'lib/console_agent/providers/base.rb', line 87

def stop_reason
  @stop_reason
end

#textObject

Returns the value of attribute text



87
88
89
# File 'lib/console_agent/providers/base.rb', line 87

def text
  @text
end

#tool_callsObject

Returns the value of attribute tool_calls



87
88
89
# File 'lib/console_agent/providers/base.rb', line 87

def tool_calls
  @tool_calls
end

Instance Method Details

#tool_use?Boolean



92
93
94
# File 'lib/console_agent/providers/base.rb', line 92

def tool_use?
  stop_reason == :tool_use && tool_calls && !tool_calls.empty?
end

#total_tokensObject



88
89
90
# File 'lib/console_agent/providers/base.rb', line 88

def total_tokens
  (input_tokens || 0) + (output_tokens || 0)
end