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

Returns:

  • (Object)

    the current value of input_tokens



83
84
85
# File 'lib/console_agent/providers/base.rb', line 83

def input_tokens
  @input_tokens
end

#output_tokensObject

Returns the value of attribute output_tokens

Returns:

  • (Object)

    the current value of output_tokens



83
84
85
# File 'lib/console_agent/providers/base.rb', line 83

def output_tokens
  @output_tokens
end

#stop_reasonObject

Returns the value of attribute stop_reason

Returns:

  • (Object)

    the current value of stop_reason



83
84
85
# File 'lib/console_agent/providers/base.rb', line 83

def stop_reason
  @stop_reason
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



83
84
85
# File 'lib/console_agent/providers/base.rb', line 83

def text
  @text
end

#tool_callsObject

Returns the value of attribute tool_calls

Returns:

  • (Object)

    the current value of tool_calls



83
84
85
# File 'lib/console_agent/providers/base.rb', line 83

def tool_calls
  @tool_calls
end

Instance Method Details

#tool_use?Boolean

Returns:

  • (Boolean)


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

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

#total_tokensObject



84
85
86
# File 'lib/console_agent/providers/base.rb', line 84

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