Class: TurnKit::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/turnkit/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text: "", tool_calls: [], usage: Usage.new, model: nil, finish_reason: nil) ⇒ Result

Returns a new instance of Result.



7
8
9
10
11
12
13
# File 'lib/turnkit/result.rb', line 7

def initialize(text: "", tool_calls: [], usage: Usage.new, model: nil, finish_reason: nil)
  @text = text.to_s
  @tool_calls = Array(tool_calls)
  @usage = usage || Usage.new
  @model = model
  @finish_reason = finish_reason
end

Instance Attribute Details

#finish_reasonObject (readonly)

Returns the value of attribute finish_reason.



5
6
7
# File 'lib/turnkit/result.rb', line 5

def finish_reason
  @finish_reason
end

#modelObject (readonly)

Returns the value of attribute model.



5
6
7
# File 'lib/turnkit/result.rb', line 5

def model
  @model
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/turnkit/result.rb', line 5

def text
  @text
end

#tool_callsObject (readonly)

Returns the value of attribute tool_calls.



5
6
7
# File 'lib/turnkit/result.rb', line 5

def tool_calls
  @tool_calls
end

#usageObject (readonly)

Returns the value of attribute usage.



5
6
7
# File 'lib/turnkit/result.rb', line 5

def usage
  @usage
end

Instance Method Details

#tool_calls?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/turnkit/result.rb', line 15

def tool_calls?
  tool_calls.any?
end