pub struct LLMSessionConfig {
pub provider: LLMProvider,
pub api_key: String,
pub model: String,
pub max_tokens: Option<u32>,
pub system_prompt: Option<String>,
pub temperature: Option<f32>,
pub streaming: bool,
pub context_limit: i32,
pub compaction: Option<CompactorType>,
}Expand description
Configuration for creating an LLM session
Fields§
§provider: LLMProviderThe LLM provider to use
api_key: StringAPI key for the provider
model: StringModel to use (e.g., “claude-3-sonnet-20240229”, “gpt-4”)
max_tokens: Option<u32>Default maximum tokens for responses
system_prompt: Option<String>Default system prompt
temperature: Option<f32>Default temperature
streaming: boolEnable streaming responses
context_limit: i32Model’s context window size (for compaction decisions)
compaction: Option<CompactorType>Compaction configuration (None to disable compaction)
Implementations§
Source§impl LLMSessionConfig
impl LLMSessionConfig
Sourcepub fn anthropic(api_key: impl Into<String>, model: impl Into<String>) -> Self
pub fn anthropic(api_key: impl Into<String>, model: impl Into<String>) -> Self
Creates a new Anthropic session config
Sourcepub fn openai(api_key: impl Into<String>, model: impl Into<String>) -> Self
pub fn openai(api_key: impl Into<String>, model: impl Into<String>) -> Self
Creates a new OpenAI session config
Sourcepub fn with_streaming(self, streaming: bool) -> Self
pub fn with_streaming(self, streaming: bool) -> Self
Enable or disable streaming
Sourcepub fn with_max_tokens(self, max_tokens: u32) -> Self
pub fn with_max_tokens(self, max_tokens: u32) -> Self
Sets the default max tokens
Sourcepub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
Sets the default system prompt
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Sets the default temperature
Sourcepub fn with_context_limit(self, context_limit: i32) -> Self
pub fn with_context_limit(self, context_limit: i32) -> Self
Sets the model’s context window size
Sourcepub fn with_threshold_compaction(self, config: CompactionConfig) -> Self
pub fn with_threshold_compaction(self, config: CompactionConfig) -> Self
Enables threshold compaction with custom configuration
Sourcepub fn with_llm_compaction(self, config: LLMCompactorConfig) -> Self
pub fn with_llm_compaction(self, config: LLMCompactorConfig) -> Self
Enables LLM-based compaction with custom configuration
Sourcepub fn with_compaction(self, compactor_type: CompactorType) -> Self
pub fn with_compaction(self, compactor_type: CompactorType) -> Self
Enables compaction with the specified compactor type
Sourcepub fn without_compaction(self) -> Self
pub fn without_compaction(self) -> Self
Disables compaction
Trait Implementations§
Source§impl Clone for LLMSessionConfig
impl Clone for LLMSessionConfig
Source§fn clone(&self) -> LLMSessionConfig
fn clone(&self) -> LLMSessionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LLMSessionConfig
impl RefUnwindSafe for LLMSessionConfig
impl Send for LLMSessionConfig
impl Sync for LLMSessionConfig
impl Unpin for LLMSessionConfig
impl UnwindSafe for LLMSessionConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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