SessionConfig

Struct SessionConfig 

Source
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: PipelineMode

Pipeline mode for audio processing (default: Live)

§ai_speaks_first: bool

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. Default: false

§allow_harm_category: bool

Allow 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

Source

pub fn new(pre_prompt: impl Into<String>) -> Self

Create a new session config with a pre-prompt

Source

pub fn empty() -> Self

Create an empty session config

Source

pub fn with_language(self, language: impl Into<String>) -> Self

Set the language for speech recognition

Source

pub fn with_pre_prompt(self, pre_prompt: impl Into<String>) -> Self

Set the pre-prompt

Source

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)
Source

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);
Source

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);
Source

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

Source§

fn clone(&self) -> SessionConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SessionConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more