pub struct ReActAgent { /* private fields */ }Expand description
ReAct Agent
使用 ReAct (Reasoning + Acting) 模式的 Agent。
会先思考,然后决定执行什么工具,最后观察结果。
支持任何实现了 BaseChatModel 的 LLM Provider。
Implementations§
Trait Implementations§
Source§impl BaseAgent for ReActAgent
impl BaseAgent for ReActAgent
Source§fn plan<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
intermediate_steps: &'life1 [AgentStep],
inputs: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn plan<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
intermediate_steps: &'life1 [AgentStep],
inputs: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn input_keys(&self) -> Vec<&str>
fn input_keys(&self) -> Vec<&str>
Returns input keys.
Source§fn return_stopped_response(
&self,
_intermediate_steps: &[AgentStep],
) -> AgentFinish
fn return_stopped_response( &self, _intermediate_steps: &[AgentStep], ) -> AgentFinish
Returns stopped response when max iterations reached.
Auto Trait Implementations§
impl !RefUnwindSafe for ReActAgent
impl !UnwindSafe for ReActAgent
impl Freeze for ReActAgent
impl Send for ReActAgent
impl Sync for ReActAgent
impl Unpin for ReActAgent
impl UnsafeUnpin for ReActAgent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more