pub struct Session<A, T, R> { /* private fields */ }Implementations§
Source§impl<R, T: Tools<R>, A: AsMut<Agent<T, R>>> Session<A, T, R>
impl<R, T: Tools<R>, A: AsMut<Agent<T, R>>> Session<A, T, R>
Sourcepub fn add_message(
&mut self,
message: impl Into<ChatCompletionRequestUserMessage>,
) -> &mut Self
pub fn add_message( &mut self, message: impl Into<ChatCompletionRequestUserMessage>, ) -> &mut Self
Append an additional message to the chat.
Sourcepub async fn run<C: Config>(&mut self, client: &Client<C>) -> R
pub async fn run<C: Config>(&mut self, client: &Client<C>) -> R
Runs the agent loop. If tools were provided, they may be called.
Terminates when a tool returns ControlFlow::Break.
It is assumed that any single message or tool response always fits in the context window fully. If this is not the case, this function may crash.
Auto Trait Implementations§
impl<A, T, R> Forget for Session<A, T, R>
impl<A, T, R> Freeze for Session<A, T, R>
impl<A, T, R> Move for Session<A, T, R>
impl<A, T, R> RefUnwindSafe for Session<A, T, R>
impl<A, T, R> Send for Session<A, T, R>
impl<A, T, R> Sync for Session<A, T, R>
impl<A, T, R> Unpin for Session<A, T, R>
impl<A, T, R> UnsafeUnpin for Session<A, T, R>
impl<A, T, R> UnwindSafe for Session<A, T, R>
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