Class: Nanobot::Providers::LLMResponse

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

Overview

LLMResponse represents the response from an LLM

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content: nil, tool_calls: nil, finish_reason: nil) ⇒ LLMResponse

Returns a new instance of LLMResponse.



10
11
12
13
14
15
16
# File 'lib/nanobot/providers/base.rb', line 10

def initialize(content: nil, tool_calls: nil, finish_reason: nil)
  super(
    content: content || '',
    tool_calls: tool_calls || [],
    finish_reason: finish_reason
  )
end

Instance Attribute Details

#content ⇒ Object

Returns the value of attribute content

Returns:

  • (Object) —

    the current value of content



9
10
11
# File 'lib/nanobot/providers/base.rb', line 9

def content
  @content
end

#finish_reason ⇒ Object

Returns the value of attribute finish_reason

Returns:

  • (Object) —

    the current value of finish_reason



9
10
11
# File 'lib/nanobot/providers/base.rb', line 9

def finish_reason
  @finish_reason
end

#tool_calls ⇒ Object

Returns the value of attribute tool_calls

Returns:

  • (Object) —

    the current value of tool_calls



9
10
11
# File 'lib/nanobot/providers/base.rb', line 9

def tool_calls
  @tool_calls
end

Instance Method Details

#tool_calls? ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/nanobot/providers/base.rb', line 18

def tool_calls?
  tool_calls && !tool_calls.empty?
end