Class: SmartAgent::Result

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

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Result

Returns a new instance of Result.



3
4
5
6
# File 'lib/smart_agent/result.rb', line 3

def initialize(response)
  SmartAgent.logger.info("response is:" + response.to_s)
  @response = response
end

Instance Method Details

#call_toolsObject



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

def call_tools
  if @response.class == String
    return nil
  else
    @response.dig("choices", 0, "message", "tool_calls")
  end
end

#contentObject



16
17
18
# File 'lib/smart_agent/result.rb', line 16

def content
  @response.dig("choices", 0, "message", "content")
end

#responseObject



20
21
22
# File 'lib/smart_agent/result.rb', line 20

def response
  @response
end