pub struct LLMSessionManager { /* private fields */ }Expand description
Manages multiple LLM sessions
Implementations§
Source§impl LLMSessionManager
impl LLMSessionManager
Sourcepub async fn create_session(
&self,
config: LLMSessionConfig,
from_llm: Sender<FromLLMPayload>,
) -> Result<i64, LlmError>
pub async fn create_session( &self, config: LLMSessionConfig, from_llm: Sender<FromLLMPayload>, ) -> Result<i64, LlmError>
Creates a new LLM session and starts it.
§Arguments
config- Session configuration (includes model, API key, etc.)from_llm- Channel sender for responses from the LLM
§Returns
The session ID of the newly created session
§Errors
Returns an error if the session fails to initialize (e.g., TLS setup failure)
Sourcepub async fn get_session_by_id(
&self,
session_id: i64,
) -> Option<Arc<LLMSession>>
pub async fn get_session_by_id( &self, session_id: i64, ) -> Option<Arc<LLMSession>>
Sourcepub async fn remove_session(&self, session_id: i64) -> bool
pub async fn remove_session(&self, session_id: i64) -> bool
Sourcepub async fn shutdown(&self)
pub async fn shutdown(&self)
Shuts down all sessions managed by this manager. This is idempotent and safe to call multiple times.
Sourcepub async fn session_count(&self) -> usize
pub async fn session_count(&self) -> usize
Returns the number of active sessions
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LLMSessionManager
impl !RefUnwindSafe for LLMSessionManager
impl Send for LLMSessionManager
impl Sync for LLMSessionManager
impl Unpin for LLMSessionManager
impl !UnwindSafe for LLMSessionManager
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