pub struct Agent<M: Completion> {Show 13 fields
pub model: Ref<M>,
pub store_indices: Vec<(usize, Box<dyn Storage>)>,
pub tools: Ref<Vec<Box<dyn Tool>>>,
pub knowledges: Arc<Vec<Box<dyn Knowledge>>>,
pub memory: Option<Ref<dyn Memory>>,
pub id: Uuid,
pub name: String,
pub preamble: String,
pub temperature: Option<f32>,
pub max_tokens: Option<usize>,
pub max_execution_time: Option<usize>,
pub respect_context_window: bool,
pub allow_code_execution: bool,
/* private fields */
}Fields§
§model: Ref<M>The model to use.
store_indices: Vec<(usize, Box<dyn Storage>)>Indexed storage for the agent.
tools: Ref<Vec<Box<dyn Tool>>>The tools to use.
knowledges: Arc<Vec<Box<dyn Knowledge>>>Knowledge sources for the agent.
memory: Option<Ref<dyn Memory>>Agent memory.
id: UuidThe unique ID of the agent.
name: StringThe name of the agent.
preamble: StringSystem prompt for the agent.
temperature: Option<f32>Temperature of the model.
max_tokens: Option<usize>Maximum number of tokens for the completion.
max_execution_time: Option<usize>Maximum execution time for the agent to complete a task.
respect_context_window: boolWhether to respect the context window.
allow_code_execution: boolWhether code execution is allowed.
Implementations§
Source§impl<M> Agent<M>where
M: Completion,
impl<M> Agent<M>where
M: Completion,
Sourcepub fn new_with_tools<I>(name: impl ToString, model: M, tools: I) -> Agent<M>
pub fn new_with_tools<I>(name: impl ToString, model: M, tools: I) -> Agent<M>
Creates a new agent with some tools
Sourcepub fn store_index(self, sample: usize, store: impl Storage + 'static) -> Self
pub fn store_index(self, sample: usize, store: impl Storage + 'static) -> Self
Adds a storage index to the agent.
Sourcepub async fn mcp_client(self, mcp_client: MCPClient) -> Self
pub async fn mcp_client(self, mcp_client: MCPClient) -> Self
Set the MCP client.
Sourcepub async fn mcp_config_path<P: AsRef<Path>>(
self,
path: P,
) -> Result<Self, MCPError>
pub async fn mcp_config_path<P: AsRef<Path>>( self, path: P, ) -> Result<Self, MCPError>
Set the MCP server config path.
Sourcepub async fn mcp_sse_client<S: AsRef<str> + 'static>(
self,
sse_url: S,
env: HashMap<String, String>,
) -> Result<Self>
pub async fn mcp_sse_client<S: AsRef<str> + 'static>( self, sse_url: S, env: HashMap<String, String>, ) -> Result<Self>
Set the MCP sse client.
Sourcepub async fn mcp_stdio_client<S: AsRef<str> + 'static>(
self,
command: S,
args: Vec<S>,
env: HashMap<String, String>,
) -> Result<Self>
pub async fn mcp_stdio_client<S: AsRef<str> + 'static>( self, command: S, args: Vec<S>, env: HashMap<String, String>, ) -> Result<Self>
Set the MCP sse client.
Auto Trait Implementations§
impl<M> Freeze for Agent<M>
impl<M> !RefUnwindSafe for Agent<M>
impl<M> Send for Agent<M>
impl<M> Sync for Agent<M>
impl<M> Unpin for Agent<M>
impl<M> !UnwindSafe for Agent<M>
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