Class: Rixie::Agent::ReAct
- Inherits:
-
Object
- Object
- Rixie::Agent::ReAct
- Defined in:
- lib/rixie/agent/re_act.rb
Constant Summary collapse
- DEFAULT_REACT_INSTRUCTIONS =
<<~INSTRUCTIONS You are operating in ReAct (Reasoning + Acting) mode. For every step that requires a tool, FIRST output your reasoning as plain text BEFORE making the tool call. Format your reasoning as: Thought: <one or two sentences explaining what you need to do next and why> Then make exactly ONE tool call. Do not call multiple tools at once. After the tool returns (an Observation), produce another Thought before the next Action, or provide the final answer if you have enough information to respond. The reasoning trace is essential — always include a Thought before each Action. INSTRUCTIONS
Instance Method Summary collapse
-
#initialize(base_agent:, react_instructions: DEFAULT_REACT_INSTRUCTIONS) ⇒ ReAct
constructor
A new instance of ReAct.
- #instructions ⇒ Object
- #llm_client ⇒ Object
- #think(messages:, listener:) ⇒ Object
- #tools ⇒ Object
Constructor Details
#initialize(base_agent:, react_instructions: DEFAULT_REACT_INSTRUCTIONS) ⇒ ReAct
Returns a new instance of ReAct.
20 21 22 23 |
# File 'lib/rixie/agent/re_act.rb', line 20 def initialize(base_agent:, react_instructions: DEFAULT_REACT_INSTRUCTIONS) @base_agent = base_agent @react_instructions = react_instructions end |
Instance Method Details
#instructions ⇒ Object
25 26 27 |
# File 'lib/rixie/agent/re_act.rb', line 25 def instructions [@base_agent.instructions, @react_instructions].compact.reject(&:empty?).join("\n\n") end |
#llm_client ⇒ Object
33 34 35 |
# File 'lib/rixie/agent/re_act.rb', line 33 def llm_client @base_agent.llm_client end |
#think(messages:, listener:) ⇒ Object
37 38 39 |
# File 'lib/rixie/agent/re_act.rb', line 37 def think(messages:, listener:) internal_agent.think(messages:, listener:) end |
#tools ⇒ Object
29 30 31 |
# File 'lib/rixie/agent/re_act.rb', line 29 def tools @base_agent.tools end |