pub struct SessionConfig {
pub max_turns: usize,
pub context_window: usize,
pub summarise_after_turns: usize,
pub session_ttl: Duration,
pub history_header: String,
pub history_separator: String,
}Expand description
Configuration for the SessionContext manager.
Fields§
§max_turns: usizeMaximum number of conversation turns kept per session.
When the ring buffer reaches this limit the oldest turn is evicted
before the new one is added. Defaults to 20.
context_window: usizeNumber of recent turns to inject into each new prompt.
Must be ≤ max_turns. Defaults to 6.
summarise_after_turns: usizeIf the number of stored turns exceeds this threshold the manager
returns SessionAction::RequestSummary from SessionContext::enrich
so the caller can ask the model to condense the history.
Set to usize::MAX to disable summarisation. Defaults to 15.
session_ttl: DurationSessions idle for longer than this TTL are evicted from memory.
The eviction runs lazily on each SessionContext::enrich call (no
background task required). Defaults to 30 minutes.
history_header: StringHeader prepended to the injected history block.
Defaults to "[Conversation so far]\n".
history_separator: StringSeparator between injected history and the new user turn.
Defaults to "\n[New message]\n".
Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§fn clone(&self) -> SessionConfig
fn clone(&self) -> SessionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SessionConfig
impl Debug for SessionConfig
Auto Trait Implementations§
impl Freeze for SessionConfig
impl RefUnwindSafe for SessionConfig
impl Send for SessionConfig
impl Sync for SessionConfig
impl Unpin for SessionConfig
impl UnsafeUnpin for SessionConfig
impl UnwindSafe for SessionConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request