Class: RailsConsoleAi::Providers::ChatResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cache_read_input_tokensObject

Returns the value of attribute cache_read_input_tokens

Returns:

  • (Object)

    the current value of cache_read_input_tokens



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

def cache_read_input_tokens
  @cache_read_input_tokens
end

#cache_write_input_tokensObject

Returns the value of attribute cache_write_input_tokens

Returns:

  • (Object)

    the current value of cache_write_input_tokens



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

def cache_write_input_tokens
  @cache_write_input_tokens
end

#input_tokensObject

Returns the value of attribute input_tokens

Returns:

  • (Object)

    the current value of input_tokens



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

def input_tokens
  @input_tokens
end

#output_tokensObject

Returns the value of attribute output_tokens

Returns:

  • (Object)

    the current value of output_tokens



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

def output_tokens
  @output_tokens
end

#stop_reasonObject

Returns the value of attribute stop_reason

Returns:

  • (Object)

    the current value of stop_reason



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

def stop_reason
  @stop_reason
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



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

def text
  @text
end

#tool_callsObject

Returns the value of attribute tool_calls

Returns:

  • (Object)

    the current value of tool_calls



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

def tool_calls
  @tool_calls
end

Instance Method Details

#tool_use?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/rails_console_ai/providers/base.rb', line 93

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

#total_tokensObject



89
90
91
# File 'lib/rails_console_ai/providers/base.rb', line 89

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