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.



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

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

Instance Method Details

#call_toolsObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/smart_agent/result.rb', line 10

def call_tools
  if @response.class == String
    return false
  else
    tool_calls = normalized_tool_calls
    return false if tool_calls.empty?

    return tool_calls
  end
end

#contentObject



21
22
23
24
25
26
27
# File 'lib/smart_agent/result.rb', line 21

def content
  if @response.class == Hash
    @response.dig("choices", 0, "message", "content")
  else
    @response
  end
end

#responseObject



29
30
31
# File 'lib/smart_agent/result.rb', line 29

def response
  @response
end