pub struct SessionConfig {
pub pre_prompt: Option<String>,
pub language: Option<String>,
pub pipeline_mode: PipelineMode,
pub ai_speaks_first: bool,
pub allow_harm_category: bool,
pub tools: Option<Vec<Tool>>,
}Expand description
Session configuration
Fields§
§pre_prompt: Option<String>System prompt for the AI (optional)
language: Option<String>Language code for speech recognition (e.g., “en-US”, “ko-KR”)
pipeline_mode: PipelineModePipeline mode for audio processing (default: Live)
ai_speaks_first: boolEnable AI to speak first before user input (live mode only) When enabled, the AI will initiate the conversation based on the pre_prompt. Make sure your pre_prompt includes instructions for how the AI should greet the user. Default: false
allow_harm_category: boolAllow harmful content categories in AI responses Default: false
tools: Option<Vec<Tool>>Tools (functions) that the AI can call during conversation (live mode only) Default: None
Implementations§
Source§impl SessionConfig
impl SessionConfig
Sourcepub fn new(pre_prompt: impl Into<String>) -> Self
pub fn new(pre_prompt: impl Into<String>) -> Self
Create a new session config with a pre-prompt
Sourcepub fn with_language(self, language: impl Into<String>) -> Self
pub fn with_language(self, language: impl Into<String>) -> Self
Set the language for speech recognition
Sourcepub fn with_pre_prompt(self, pre_prompt: impl Into<String>) -> Self
pub fn with_pre_prompt(self, pre_prompt: impl Into<String>) -> Self
Set the pre-prompt
Sourcepub fn with_pipeline_mode(self, mode: PipelineMode) -> Self
pub fn with_pipeline_mode(self, mode: PipelineMode) -> Self
Set the pipeline mode
PipelineMode::Live: Direct audio-to-audio conversation (default, lower latency)PipelineMode::Composed: Separate STT + LLM + TTS services (more customizable)
Sourcepub fn with_ai_speaks_first(self, enabled: bool) -> Self
pub fn with_ai_speaks_first(self, enabled: bool) -> Self
Enable AI to speak first before user input (live mode only)
When enabled, the AI will initiate the conversation based on the pre_prompt. Make sure your pre_prompt includes instructions for how the AI should greet the user.
§Example
use livespeech_sdk::SessionConfig;
let config = SessionConfig::new("You are a helpful assistant. Start by greeting the user.")
.with_ai_speaks_first(true);Sourcepub fn with_allow_harm_category(self, allow: bool) -> Self
pub fn with_allow_harm_category(self, allow: bool) -> Self
Set whether to allow harmful content categories in AI responses
§Example
use livespeech_sdk::SessionConfig;
// Enable content safety filtering
let config = SessionConfig::empty()
.with_allow_harm_category(false);Sourcepub fn with_tools(self, tools: Vec<Tool>) -> Self
pub fn with_tools(self, tools: Vec<Tool>) -> Self
Set tools (functions) that the AI can call during conversation
§Example
use livespeech_sdk::{SessionConfig, Tool};
let tools = vec![
Tool::new("open_login", "Opens the login popup when user wants to sign in"),
];
let config = SessionConfig::new("You are a helpful assistant.")
.with_tools(tools);Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§fn clone(&self) -> SessionConfig
fn clone(&self) -> SessionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more