pub struct RealtimeConfig {Show 15 fields
pub model: Option<String>,
pub instruction: Option<String>,
pub voice: Option<String>,
pub modalities: Option<Vec<String>>,
pub input_audio_format: Option<AudioEncoding>,
pub output_audio_format: Option<AudioEncoding>,
pub turn_detection: Option<VadConfig>,
pub tools: Option<Vec<ToolDefinition>>,
pub tool_choice: Option<String>,
pub input_audio_transcription: Option<TranscriptionConfig>,
pub temperature: Option<f32>,
pub max_response_output_tokens: Option<u32>,
pub cached_content: Option<String>,
pub interruption_detection: Option<InterruptionDetection>,
pub extra: Option<Value>,
}realtime only.Expand description
Configuration for a realtime session.
Fields§
§model: Option<String>Model to use (provider-specific).
instruction: Option<String>System instruction for the agent.
voice: Option<String>Voice to use for audio output.
modalities: Option<Vec<String>>Output modalities: [“text”], [“audio”], or [“text”, “audio”].
input_audio_format: Option<AudioEncoding>Input audio format.
output_audio_format: Option<AudioEncoding>Output audio format.
turn_detection: Option<VadConfig>VAD configuration.
tools: Option<Vec<ToolDefinition>>Available tools/functions.
tool_choice: Option<String>Tool selection mode: “auto”, “none”, “required”.
input_audio_transcription: Option<TranscriptionConfig>Whether to include input audio transcription.
temperature: Option<f32>Temperature for response generation.
max_response_output_tokens: Option<u32>Maximum output tokens.
cached_content: Option<String>Cached content resource name (e.g. cachedContents/1234).
interruption_detection: Option<InterruptionDetection>Interruption detection mode for voice sessions.
Controls whether the session automatically detects user speech to
cancel agent audio output, or relies on explicit API calls.
Defaults to Manual when None.
extra: Option<Value>Provider-specific options.
Implementations§
Source§impl RealtimeConfig
impl RealtimeConfig
Sourcepub fn new() -> RealtimeConfig
pub fn new() -> RealtimeConfig
Create a new empty configuration.
Sourcepub fn builder() -> RealtimeConfigBuilder
pub fn builder() -> RealtimeConfigBuilder
Create a builder for RealtimeConfig.
Sourcepub fn with_model(self, model: impl Into<String>) -> RealtimeConfig
pub fn with_model(self, model: impl Into<String>) -> RealtimeConfig
Set the model.
Sourcepub fn with_instruction(self, instruction: impl Into<String>) -> RealtimeConfig
pub fn with_instruction(self, instruction: impl Into<String>) -> RealtimeConfig
Set the system instruction.
Sourcepub fn with_voice(self, voice: impl Into<String>) -> RealtimeConfig
pub fn with_voice(self, voice: impl Into<String>) -> RealtimeConfig
Set the voice.
Sourcepub fn with_modalities(self, modalities: Vec<String>) -> RealtimeConfig
pub fn with_modalities(self, modalities: Vec<String>) -> RealtimeConfig
Set output modalities.
Sourcepub fn with_text_and_audio(self) -> RealtimeConfig
pub fn with_text_and_audio(self) -> RealtimeConfig
Enable text and audio output.
Sourcepub fn with_audio_only(self) -> RealtimeConfig
pub fn with_audio_only(self) -> RealtimeConfig
Enable audio-only output.
Sourcepub fn with_vad(self, vad: VadConfig) -> RealtimeConfig
pub fn with_vad(self, vad: VadConfig) -> RealtimeConfig
Set VAD configuration.
Sourcepub fn with_server_vad(self) -> RealtimeConfig
pub fn with_server_vad(self) -> RealtimeConfig
Enable server-side VAD with default settings.
Sourcepub fn without_vad(self) -> RealtimeConfig
pub fn without_vad(self) -> RealtimeConfig
Disable VAD (manual turn management).
Sourcepub fn with_tool(self, tool: ToolDefinition) -> RealtimeConfig
pub fn with_tool(self, tool: ToolDefinition) -> RealtimeConfig
Add a tool definition.
Sourcepub fn with_tools(self, tools: Vec<ToolDefinition>) -> RealtimeConfig
pub fn with_tools(self, tools: Vec<ToolDefinition>) -> RealtimeConfig
Set multiple tools.
Sourcepub fn with_transcription(self) -> RealtimeConfig
pub fn with_transcription(self) -> RealtimeConfig
Enable input audio transcription.
Sourcepub fn with_temperature(self, temp: f32) -> RealtimeConfig
pub fn with_temperature(self, temp: f32) -> RealtimeConfig
Set temperature.
Sourcepub fn with_cached_content(self, content: impl Into<String>) -> RealtimeConfig
pub fn with_cached_content(self, content: impl Into<String>) -> RealtimeConfig
Set cached content resource.
Sourcepub fn with_interruption_detection(
self,
mode: InterruptionDetection,
) -> RealtimeConfig
pub fn with_interruption_detection( self, mode: InterruptionDetection, ) -> RealtimeConfig
Set the interruption detection mode.
See InterruptionDetection for details on each variant.
Sourcepub fn with_automatic_interruption(self) -> RealtimeConfig
pub fn with_automatic_interruption(self) -> RealtimeConfig
Enable automatic interruption detection.
The session will detect user speech onset and cancel the current agent audio output automatically.
Trait Implementations§
Source§impl Clone for RealtimeConfig
impl Clone for RealtimeConfig
Source§fn clone(&self) -> RealtimeConfig
fn clone(&self) -> RealtimeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RealtimeConfig
impl Debug for RealtimeConfig
Source§impl Default for RealtimeConfig
impl Default for RealtimeConfig
Source§fn default() -> RealtimeConfig
fn default() -> RealtimeConfig
Source§impl<'de> Deserialize<'de> for RealtimeConfig
impl<'de> Deserialize<'de> for RealtimeConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RealtimeConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RealtimeConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<RealtimeConfig> for SessionUpdateConfig
impl From<RealtimeConfig> for SessionUpdateConfig
Source§fn from(config: RealtimeConfig) -> SessionUpdateConfig
fn from(config: RealtimeConfig) -> SessionUpdateConfig
Source§impl PartialEq for RealtimeConfig
impl PartialEq for RealtimeConfig
Source§impl Serialize for RealtimeConfig
impl Serialize for RealtimeConfig
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,
impl StructuralPartialEq for RealtimeConfig
Auto Trait Implementations§
impl Freeze for RealtimeConfig
impl RefUnwindSafe for RealtimeConfig
impl Send for RealtimeConfig
impl Sync for RealtimeConfig
impl Unpin for RealtimeConfig
impl UnsafeUnpin for RealtimeConfig
impl UnwindSafe for RealtimeConfig
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§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