mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Fix realtime transcription session.update tools payload (#14635)
Only attach session tools for Realtime v2 conversational sessions, and omit tools in transcription mode so realtime startup no longer fails with unknown parameter errors. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
1 parent
9a44a7e499
commit
e9050e3e64
1 file changed
+23
-22
@@ -363,24 +363,28 @@ impl RealtimeWebsocketWriter {
|
|||||||
}
|
}
|
||||||
RealtimeSessionMode::Transcription => ("transcription".to_string(), None, None),
|
RealtimeSessionMode::Transcription => ("transcription".to_string(), None, None),
|
||||||
};
|
};
|
||||||
let tools = match self.event_parser {
|
let tools = match (self.event_parser, session_mode) {
|
||||||
RealtimeEventParser::RealtimeV2 => Some(vec![SessionFunctionTool {
|
(RealtimeEventParser::RealtimeV2, RealtimeSessionMode::Conversational) => {
|
||||||
kind: "function".to_string(),
|
Some(vec![SessionFunctionTool {
|
||||||
name: REALTIME_V2_CODEX_TOOL_NAME.to_string(),
|
kind: "function".to_string(),
|
||||||
description: REALTIME_V2_CODEX_TOOL_DESCRIPTION.to_string(),
|
name: REALTIME_V2_CODEX_TOOL_NAME.to_string(),
|
||||||
parameters: json!({
|
description: REALTIME_V2_CODEX_TOOL_DESCRIPTION.to_string(),
|
||||||
"type": "object",
|
parameters: json!({
|
||||||
"properties": {
|
"type": "object",
|
||||||
"prompt": {
|
"properties": {
|
||||||
"type": "string",
|
"prompt": {
|
||||||
"description": "Prompt text for the delegated Codex task."
|
"type": "string",
|
||||||
}
|
"description": "Prompt text for the delegated Codex task."
|
||||||
},
|
}
|
||||||
"required": ["prompt"],
|
},
|
||||||
"additionalProperties": false
|
"required": ["prompt"],
|
||||||
}),
|
"additionalProperties": false
|
||||||
}]),
|
}),
|
||||||
RealtimeEventParser::V1 => None,
|
}])
|
||||||
|
}
|
||||||
|
(RealtimeEventParser::RealtimeV2, RealtimeSessionMode::Transcription)
|
||||||
|
| (RealtimeEventParser::V1, RealtimeSessionMode::Conversational)
|
||||||
|
| (RealtimeEventParser::V1, RealtimeSessionMode::Transcription) => None,
|
||||||
};
|
};
|
||||||
self.send_json(RealtimeOutboundMessage::SessionUpdate {
|
self.send_json(RealtimeOutboundMessage::SessionUpdate {
|
||||||
session: SessionUpdateSession {
|
session: SessionUpdateSession {
|
||||||
@@ -1533,10 +1537,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
assert!(first_json["session"].get("instructions").is_none());
|
assert!(first_json["session"].get("instructions").is_none());
|
||||||
assert!(first_json["session"]["audio"].get("output").is_none());
|
assert!(first_json["session"]["audio"].get("output").is_none());
|
||||||
assert_eq!(
|
assert!(first_json["session"].get("tools").is_none());
|
||||||
first_json["session"]["tools"][0]["name"],
|
|
||||||
Value::String("codex".to_string())
|
|
||||||
);
|
|
||||||
|
|
||||||
ws.send(Message::Text(
|
ws.send(Message::Text(
|
||||||
json!({
|
json!({
|
||||||
|
|||||||
Reference in new issue
Block a user