Class: Raif::Agents::NativeToolCallingAgent

Inherits:
Raif::Agent show all
Defined in:
app/models/raif/agents/native_tool_calling_agent.rb

Instance Attribute Summary

Attributes inherited from Raif::Agent

#on_conversation_history_entry

Instance Method Summary collapse

Methods inherited from Raif::Agent

#run!

Methods included from Concerns::HasAvailableModelTools

#available_model_tools_map

Methods included from Concerns::HasRequestedLanguage

#requested_language_name, #system_prompt_language_preference

Methods included from Concerns::HasLlm

#default_llm_model_key, #llm

Methods inherited from Raif::ApplicationRecord

table_name_prefix

Instance Method Details

#build_system_promptObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/models/raif/agents/native_tool_calling_agent.rb', line 18

def build_system_prompt
  "    You are an AI agent that follows the ReAct (Reasoning + Acting) framework to complete tasks step by step using tool/function calls.\n\n    At each step, you must:\n    1. Think about what to do next.\n    2. Choose and invoke exactly one tool/function call based on that thought.\n    3. Observe the results of the tool/function call.\n    4. Use the results to update your thought process.\n    5. Repeat steps 1-4 until the task is complete.\n    6. Provide a final answer to the user's request.\n\n    For your final answer:\n    - Use the agent_final_answer tool/function with your complete answer as the \"final_answer\" parameter.\n    - Your answer should be comprehensive and directly address the user's request.\n\n    Guidelines\n    - Always think step by step\n    - Be concise in your reasoning but thorough in your analysis\n    - If a tool returns an error, try to understand why and adjust your approach\n    - If you're unsure about something, explain your uncertainty, but do not make things up\n    - Always provide a final answer that directly addresses the user's request\n\n    Remember: Your goal is to be helpful, accurate, and efficient in solving the user's request.\#{system_prompt_language_preference}\n  PROMPT\nend\n".strip