pub struct Agent { /* private fields */ }Expand description
Agent - the main orchestrator for LLM interactions
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn builder() -> AgentBuilder
pub fn builder() -> AgentBuilder
Create an agent builder
Sourcepub fn with_config(self, config: AgentConfig) -> Self
pub fn with_config(self, config: AgentConfig) -> Self
Set configuration
Sourcepub async fn query(&self, message: impl Into<String>) -> Result<String>
pub async fn query(&self, message: impl Into<String>) -> Result<String>
Query the agent synchronously (returns final response)
Sourcepub async fn query_stream<'a, M: Into<String> + 'a>(
&'a self,
message: M,
) -> Result<impl Stream<Item = AgentEvent> + 'a>
pub async fn query_stream<'a, M: Into<String> + 'a>( &'a self, message: M, ) -> Result<impl Stream<Item = AgentEvent> + 'a>
Query the agent with streaming events
Sourcepub async fn get_usage(&self) -> UsageSummary
pub async fn get_usage(&self) -> UsageSummary
Get usage summary
Sourcepub async fn clear_history(&self)
pub async fn clear_history(&self)
Clear history
Sourcepub async fn load_history(&self, messages: Vec<Message>)
pub async fn load_history(&self, messages: Vec<Message>)
Load history
Sourcepub async fn get_history(&self) -> Vec<Message>
pub async fn get_history(&self) -> Vec<Message>
Get current history
Auto Trait Implementations§
impl Freeze for Agent
impl !RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl !UnwindSafe for Agent
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