pub struct RealtimeConfig {Show 16 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 affective_dialog: Option<bool>,
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.
affective_dialog: Option<bool>Enable emotion-aware (“affective”) dialog, where the model adapts its tone to the user’s emotional state. Gemini Live native-audio models only (requires the v1alpha endpoint); ignored by other providers.
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 automatic VAD, taking ownership of turn detection.
See VadMode::None — on Gemini Live this is also what unlocks client
activityStart / activityEnd signalling, which the protocol permits
only while server-side detection is disabled.
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_affective_dialog(self, enabled: bool) -> RealtimeConfig
pub fn with_affective_dialog(self, enabled: bool) -> RealtimeConfig
Enable emotion-aware (“affective”) dialog. Only honored by Gemini Live native-audio models (v1alpha); a no-op for other providers/models.
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 (const: unstable) · 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.