pub struct Agent<TCtx> {
pub name: String,
/* private fields */
}Fields§
§name: StringA unique name for the agent. The name can only contain letters and underscores.
Implementations§
Source§impl<TCtx> Agent<TCtx>
impl<TCtx> Agent<TCtx>
pub fn new(params: AgentParams<TCtx>) -> Self
Sourcepub async fn run(
&self,
request: AgentRequest<TCtx>,
) -> Result<AgentResponse, AgentError>
pub async fn run( &self, request: AgentRequest<TCtx>, ) -> Result<AgentResponse, AgentError>
Create a one-time run of the agent and generate a response. A session is created for the run and cleaned up afterwards.
Sourcepub async fn run_stream(
&self,
request: AgentRequest<TCtx>,
) -> Result<AgentStream, AgentError>
pub async fn run_stream( &self, request: AgentRequest<TCtx>, ) -> Result<AgentStream, AgentError>
Create a one-time streaming run of the agent and generate a response. A session is created for the run and cleaned up afterwards.
Sourcepub async fn create_session(
&self,
context: TCtx,
) -> Result<RunSession<TCtx>, AgentError>
pub async fn create_session( &self, context: TCtx, ) -> Result<RunSession<TCtx>, AgentError>
Create a session for stateful multiple runs of the agent.
pub fn builder( name: &str, model: Arc<dyn LanguageModel + Send + Sync>, ) -> AgentParams<TCtx>
Auto Trait Implementations§
impl<TCtx> Freeze for Agent<TCtx>
impl<TCtx> !RefUnwindSafe for Agent<TCtx>
impl<TCtx> Send for Agent<TCtx>
impl<TCtx> Sync for Agent<TCtx>
impl<TCtx> Unpin for Agent<TCtx>
impl<TCtx> !UnwindSafe for Agent<TCtx>
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