mirror of
https://github.com/openai/codex.git
synced 2026-04-29 08:56:38 +00:00
Add realtime voice selection (#17176)
- Add realtime voice selection for realtime/start. - Expose the supported v1/v2 voice lists and cover explicit, configured, default, and invalid voice paths.
This commit is contained in:
@@ -414,6 +414,11 @@ client_request_definitions! {
|
||||
params: v2::ThreadRealtimeStopParams,
|
||||
response: v2::ThreadRealtimeStopResponse,
|
||||
},
|
||||
#[experimental("thread/realtime/listVoices")]
|
||||
ThreadRealtimeListVoices => "thread/realtime/listVoices" {
|
||||
params: v2::ThreadRealtimeListVoicesParams,
|
||||
response: v2::ThreadRealtimeListVoicesResponse,
|
||||
},
|
||||
ReviewStart => "review/start" {
|
||||
params: v2::ReviewStartParams,
|
||||
response: v2::ReviewStartResponse,
|
||||
@@ -1764,6 +1769,7 @@ mod tests {
|
||||
prompt: Some(Some("You are on a call".to_string())),
|
||||
session_id: Some("sess_456".to_string()),
|
||||
transport: None,
|
||||
voice: Some(codex_protocol::protocol::RealtimeVoice::Marin),
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -1774,7 +1780,8 @@ mod tests {
|
||||
"threadId": "thr_123",
|
||||
"prompt": "You are on a call",
|
||||
"sessionId": "sess_456",
|
||||
"transport": null
|
||||
"transport": null,
|
||||
"voice": "marin"
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&request)?,
|
||||
@@ -1791,6 +1798,7 @@ mod tests {
|
||||
prompt: None,
|
||||
session_id: None,
|
||||
transport: None,
|
||||
voice: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -1800,7 +1808,8 @@ mod tests {
|
||||
"params": {
|
||||
"threadId": "thr_123",
|
||||
"sessionId": null,
|
||||
"transport": null
|
||||
"transport": null,
|
||||
"voice": null
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&default_prompt_request)?,
|
||||
@@ -1813,6 +1822,7 @@ mod tests {
|
||||
prompt: Some(None),
|
||||
session_id: None,
|
||||
transport: None,
|
||||
voice: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -1823,7 +1833,8 @@ mod tests {
|
||||
"threadId": "thr_123",
|
||||
"prompt": null,
|
||||
"sessionId": null,
|
||||
"transport": null
|
||||
"transport": null,
|
||||
"voice": null
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&null_prompt_request)?,
|
||||
@@ -1835,7 +1846,8 @@ mod tests {
|
||||
"params": {
|
||||
"threadId": "thr_123",
|
||||
"sessionId": null,
|
||||
"transport": null
|
||||
"transport": null,
|
||||
"voice": null
|
||||
}
|
||||
});
|
||||
assert_eq!(
|
||||
@@ -1850,7 +1862,8 @@ mod tests {
|
||||
"threadId": "thr_123",
|
||||
"prompt": null,
|
||||
"sessionId": null,
|
||||
"transport": null
|
||||
"transport": null,
|
||||
"voice": null
|
||||
}
|
||||
});
|
||||
assert_eq!(
|
||||
@@ -1934,6 +1947,7 @@ mod tests {
|
||||
prompt: Some(Some("You are on a call".to_string())),
|
||||
session_id: None,
|
||||
transport: None,
|
||||
voice: None,
|
||||
},
|
||||
};
|
||||
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&request);
|
||||
|
||||
@@ -72,6 +72,8 @@ use codex_protocol::protocol::RateLimitWindow as CoreRateLimitWindow;
|
||||
use codex_protocol::protocol::ReadOnlyAccess as CoreReadOnlyAccess;
|
||||
use codex_protocol::protocol::RealtimeAudioFrame as CoreRealtimeAudioFrame;
|
||||
use codex_protocol::protocol::RealtimeConversationVersion;
|
||||
use codex_protocol::protocol::RealtimeVoice;
|
||||
use codex_protocol::protocol::RealtimeVoicesList;
|
||||
use codex_protocol::protocol::ReviewDecision as CoreReviewDecision;
|
||||
use codex_protocol::protocol::SessionSource as CoreSessionSource;
|
||||
use codex_protocol::protocol::SkillDependencies as CoreSkillDependencies;
|
||||
@@ -3866,6 +3868,8 @@ pub struct ThreadRealtimeStartParams {
|
||||
pub session_id: Option<String>,
|
||||
#[ts(optional = nullable)]
|
||||
pub transport: Option<ThreadRealtimeStartTransport>,
|
||||
#[ts(optional = nullable)]
|
||||
pub voice: Option<RealtimeVoice>,
|
||||
}
|
||||
|
||||
/// EXPERIMENTAL - transport used by thread realtime.
|
||||
@@ -3931,6 +3935,20 @@ pub struct ThreadRealtimeStopParams {
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadRealtimeStopResponse {}
|
||||
|
||||
/// EXPERIMENTAL - list voices supported by thread realtime.
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadRealtimeListVoicesParams {}
|
||||
|
||||
/// EXPERIMENTAL - response for listing supported realtime voices.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadRealtimeListVoicesResponse {
|
||||
pub voices: RealtimeVoicesList,
|
||||
}
|
||||
|
||||
/// EXPERIMENTAL - emitted when thread realtime startup is accepted.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
Reference in New Issue
Block a user