Struct langchain_rust::agent::AgentExecutor
source · pub struct AgentExecutor<A>where
A: Agent,{
pub memory: Option<Arc<Mutex<dyn BaseMemory>>>,
/* private fields */
}Fields§
§memory: Option<Arc<Mutex<dyn BaseMemory>>>Implementations§
source§impl<A> AgentExecutor<A>where
A: Agent,
impl<A> AgentExecutor<A>where
A: Agent,
pub fn from_agent(agent: A) -> Self
pub fn with_max_iterations(self, max_iterations: i32) -> Self
pub fn with_memory(self, memory: Arc<Mutex<dyn BaseMemory>>) -> Self
pub fn with_break_if_error(self, break_if_error: bool) -> Self
Trait Implementations§
source§impl<A> Chain for AgentExecutor<A>
impl<A> Chain for AgentExecutor<A>
source§fn call<'life0, 'async_trait>(
&'life0 self,
input_variables: PromptArgs
) -> Pin<Box<dyn Future<Output = Result<GenerateResult, ChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn call<'life0, 'async_trait>(
&'life0 self,
input_variables: PromptArgs
) -> Pin<Box<dyn Future<Output = Result<GenerateResult, ChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Call the
Chain and receive as output the result of the generation process along with
additional information like token consumption. The input is a set of variables passed
as a PromptArgs hashmap. Read moresource§fn invoke<'life0, 'async_trait>(
&'life0 self,
input_variables: PromptArgs
) -> Pin<Box<dyn Future<Output = Result<String, ChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invoke<'life0, 'async_trait>(
&'life0 self,
input_variables: PromptArgs
) -> Pin<Box<dyn Future<Output = Result<String, ChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Invoke the
Chain and receive just the generation result as a String.
The input is a set of variables passed as a PromptArgs hashmap. Read moresource§fn execute<'life0, 'async_trait>(
&'life0 self,
input_variables: PromptArgs
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, ChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
input_variables: PromptArgs
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, ChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the
Chain and return the result of the generation process
along with additional information like token consumption formatted as a HashMap.
The input is a set of variables passed as a PromptArgs hashmap.
The key for the generated output is specified by the get_output_keys
method (default key is output). Read moresource§fn stream<'life0, 'async_trait>(
&'life0 self,
_input_variables: PromptArgs
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamData, ChainError>> + Send>>, ChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream<'life0, 'async_trait>(
&'life0 self,
_input_variables: PromptArgs
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamData, ChainError>> + Send>>, ChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stream the
Chain and get an asynchronous stream of chain generations.
The input is a set of variables passed as a PromptArgs hashmap.
If the chain have memroy, the tream method will not be able to automaticaly
set the memroy, bocause it will not know if the how to extract the output message
out of the stram Read morefn get_input_keys(&self) -> Vec<String>
fn get_output_keys(&self) -> Vec<String>
Auto Trait Implementations§
impl<A> Freeze for AgentExecutor<A>where
A: Freeze,
impl<A> !RefUnwindSafe for AgentExecutor<A>
impl<A> Send for AgentExecutor<A>
impl<A> Sync for AgentExecutor<A>
impl<A> Unpin for AgentExecutor<A>where
A: Unpin,
impl<A> !UnwindSafe for AgentExecutor<A>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more