pub struct SessionConfig {
pub session_id: SessionId,
pub metadata: BTreeMap<String, Value>,
pub cache: Option<PromptCacheRequest>,
}Expand description
Configuration required to start a new model session.
Pass this to Agent::start to initialise the underlying ModelSession
and obtain a LoopDriver.
§Example
use agentkit_loop::{PromptCacheRequest, PromptCacheRetention, SessionConfig};
let config = SessionConfig::new("my-session").with_cache(
PromptCacheRequest::automatic().with_retention(PromptCacheRetention::Short),
);Fields§
§session_id: SessionIdUnique identifier for the session.
metadata: BTreeMap<String, Value>Arbitrary key-value metadata forwarded to the model adapter.
cache: Option<PromptCacheRequest>Default provider-side prompt caching policy for turns in this session.
Implementations§
Source§impl SessionConfig
impl SessionConfig
Sourcepub fn new(session_id: impl Into<SessionId>) -> SessionConfig
pub fn new(session_id: impl Into<SessionId>) -> SessionConfig
Builds a session config with empty metadata and no cache policy.
Sourcepub fn with_metadata(self, metadata: BTreeMap<String, Value>) -> SessionConfig
pub fn with_metadata(self, metadata: BTreeMap<String, Value>) -> SessionConfig
Replaces the session metadata map.
Sourcepub fn with_cache(self, cache: PromptCacheRequest) -> SessionConfig
pub fn with_cache(self, cache: PromptCacheRequest) -> SessionConfig
Sets the default prompt cache request for the session.
Sourcepub fn without_cache(self) -> SessionConfig
pub fn without_cache(self) -> SessionConfig
Clears any default prompt cache request for the session.
Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§fn clone(&self) -> SessionConfig
fn clone(&self) -> SessionConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionConfig
impl Debug for SessionConfig
Source§impl<'de> Deserialize<'de> for SessionConfig
impl<'de> Deserialize<'de> for SessionConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SessionConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SessionConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SessionConfig
Source§impl PartialEq for SessionConfig
impl PartialEq for SessionConfig
Source§fn eq(&self, other: &SessionConfig) -> bool
fn eq(&self, other: &SessionConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SessionConfig
impl Serialize for SessionConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq 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
Mutably borrows from an owned value. Read more