Struct 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,

Source

pub fn from_agent(agent: A) -> Self

Source

pub fn with_max_iterations(self, max_iterations: i32) -> Self

Source

pub fn with_memory(self, memory: Arc<Mutex<dyn BaseMemory>>) -> Self

Source

pub fn with_break_if_error(self, break_if_error: bool) -> Self

Trait Implementations§

Source§

impl<A> Chain for AgentExecutor<A>
where A: Agent + Send + Sync,

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,

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

fn get_input_keys(&self) -> Vec<String>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<U, <U as TryFrom<T>>::Error>> + 'async_trait>>
where T: 'async_trait,

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,