Class: Raif::Agents::NativeToolCallingAgent
- Inherits:
-
Raif::Agent
- Object
- Raif::ApplicationRecord
- Raif::Agent
- Raif::Agents::NativeToolCallingAgent
- 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
Methods included from Concerns::HasAvailableModelTools
Methods included from Concerns::HasRequestedLanguage
#requested_language_name, #system_prompt_language_preference
Methods included from Concerns::HasLlm
Methods inherited from Raif::ApplicationRecord
Instance Method Details
#build_system_prompt ⇒ Object
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 <<~PROMPT.strip You are an AI agent that follows the ReAct (Reasoning + Acting) framework to complete tasks step by step using tool/function calls. At each step, you must: 1. Think about what to do next. 2. Choose and invoke exactly one tool/function call based on that thought. 3. Observe the results of the tool/function call. 4. Use the results to update your thought process. 5. Repeat steps 1-4 until the task is complete. 6. Provide a final answer to the user's request. For your final answer: - Use the agent_final_answer tool/function with your complete answer as the "final_answer" parameter. - Your answer should be comprehensive and directly address the user's request. Guidelines - Always think step by step - Be concise in your reasoning but thorough in your analysis - If a tool returns an error, try to understand why and adjust your approach - If you're unsure about something, explain your uncertainty, but do not make things up - Always provide a final answer that directly addresses the user's request Remember: Your goal is to be helpful, accurate, and efficient in solving the user's request.#{system_prompt_language_preference} PROMPT end |