Class: Raif::ModelTools::AgentFinalAnswer

Inherits:
Raif::ModelTool
  • Object
show all
Defined in:
app/models/raif/model_tools/agent_final_answer.rb

Class Method Summary collapse

Class Method Details

.observation_for_invocation(tool_invocation) ⇒ Object



20
21
22
23
24
# File 'app/models/raif/model_tools/agent_final_answer.rb', line 20

def observation_for_invocation(tool_invocation)
  return "No answer provided" unless tool_invocation.result.present?

  tool_invocation.result
end

.process_invocation(tool_invocation) ⇒ Object



26
27
28
29
# File 'app/models/raif/model_tools/agent_final_answer.rb', line 26

def process_invocation(tool_invocation)
  tool_invocation.update!(result: tool_invocation.tool_arguments["final_answer"])
  tool_invocation.result
end