fix(voice): send OpenAI Realtime tool schemas the API accepts

OpenAI Realtime now answers 400 invalid_function_parameters for a whole
session whose tool schema uses Unicode property classes, as resolve_area's
area-id pattern does, so voice never connects ("Failed to create Realtime
token"). The session sends its tools through chatSchema, the filter typed
chat adopted in #1616, which leaves out only \p{…} patterns; area ids are
still checked against the action's own contract before the tool runs.

Fixes #1618
This commit is contained in:
Andrés Valdez committed 2026-11-09 07:34:44 +00:00
1 parent 027c9616a5
commit 9f2dfdf820
3 files changed
+49 -11

No files matched your search

+1 -1
View File
@@ -69,7 +69,7 @@ function validMessages(messages) {
* 400 for a whole request whose tool uses Unicode property classes (`\p{L}`),
* as `resolve_area`'s area ids do. Every argument is still checked against
* the action's own contract before the tool runs, so the model loses a hint,
* not a rule. Realtime voice accepts these patterns and keeps them.
* not a rule. Realtime voice refuses them too now (#1618) and uses this as well.
*/
export function chatSchema(schema) {
if (Array.isArray(schema)) return schema.map(chatSchema);