pub struct SessionInferer { /* private fields */ }Expand description
Infers session ids by prompt-prefix continuation.
Opt-in and off by default (explicit ids are the primary mechanism). When
enabled, a new call whose prompt fully contains a recent call’s prompt as
a prefix (message-level, equality allowed — e.g. a retry of the same step)
joins that call’s session; otherwise a new auto- session is started.
Only strong prefix continuation is merged — weak similarity is not.
Implementations§
Source§impl SessionInferer
impl SessionInferer
Sourcepub fn with_capacity(enabled: bool, capacity: usize) -> Self
pub fn with_capacity(enabled: bool, capacity: usize) -> Self
Inferer with an explicit capacity (recent calls remembered). Panics if the capacity is zero.
Sourcepub fn resolve(
&mut self,
explicit: Option<&str>,
prompt: &LanguageModelPrompt,
) -> Option<(String, SessionSource)>
pub fn resolve( &mut self, explicit: Option<&str>, prompt: &LanguageModelPrompt, ) -> Option<(String, SessionSource)>
Resolve the session id for one call.
- explicit id: used as-is and remembered (later calls without an id can continue this session via prefix matching);
- no id + enabled: strong-prefix match against recent calls, otherwise
a new
auto-session id; - no id + disabled:
None(isolated request view).
Auto Trait Implementations§
impl Freeze for SessionInferer
impl RefUnwindSafe for SessionInferer
impl Send for SessionInferer
impl Sync for SessionInferer
impl Unpin for SessionInferer
impl UnsafeUnpin for SessionInferer
impl UnwindSafe for SessionInferer
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