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::AgentInferenceStats
#total_completion_tokens, #total_cost, #total_output_token_cost, #total_prompt_token_cost, #total_prompt_tokens, #total_tokens_sum
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
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'app/models/raif/agents/native_tool_calling_agent.rb', line 54 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 |