pub struct Agent { /* private fields */ }Expand description
Main AI agent that processes requests and manages conversations
Implementations§
Source§impl Agent
impl Agent
Sourcepub async fn new(
config: CoderLibConfig,
storage: Arc<dyn Storage>,
) -> Result<Self, CoderLibError>
pub async fn new( config: CoderLibConfig, storage: Arc<dyn Storage>, ) -> Result<Self, CoderLibError>
Create a new agent with the given configuration
Sourcepub fn set_host_integration(&mut self, host: Arc<dyn HostIntegration>)
pub fn set_host_integration(&mut self, host: Arc<dyn HostIntegration>)
Set the host integration
Sourcepub async fn process_request(
&self,
request: CodeRequest,
) -> Result<Receiver<CodeResponse>, CoderLibError>
pub async fn process_request( &self, request: CodeRequest, ) -> Result<Receiver<CodeResponse>, CoderLibError>
Process a code request and return a stream of responses
Sourcepub async fn cancel_request(
&self,
session_id: &str,
) -> Result<(), CoderLibError>
pub async fn cancel_request( &self, session_id: &str, ) -> Result<(), CoderLibError>
Cancel an ongoing request
Sourcepub fn available_models(&self) -> Vec<Model>
pub fn available_models(&self) -> Vec<Model>
Get available models from all providers
Sourcepub async fn update_config(
&mut self,
config: CoderLibConfig,
) -> Result<(), CoderLibError>
pub async fn update_config( &mut self, config: CoderLibConfig, ) -> Result<(), CoderLibError>
Update the agent configuration
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
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