You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ai-gateway/openai-realtime-api.js
+20-3Lines changed: 20 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,10 @@ const {
21
21
VOICE_DURATION_MS_DEFAULT,
22
22
VOICE_DURATION_MS_MAX,
23
23
VOICE_DURATION_MS_MIN,
24
+
VOICE_DISTANCE_M_MIN,
25
+
VOICE_DISTANCE_M_MAX,
26
+
VOICE_ROTATION_DEG_MIN,
27
+
VOICE_ROTATION_DEG_MAX,
24
28
}=require("./constants");
25
29
26
30
/**
@@ -67,8 +71,11 @@ function buildRealtimeVoiceSessionPayload() {
67
71
"If ambiguous, prefer slower/shorter movements.",
68
72
`Call tool ${EXECUTE_BASE_MOVE} at most ONCE per user utterance.`,
69
73
`After a tool result, confirm warmly in one brief sentence — never call ${EXECUTE_BASE_MOVE} again unless the user gives a new command.`,
70
-
`Call tool ${EXECUTE_BASE_MOVE} with action (enum), speed (${BASE_MOVE_SPEEDS.join("|")}), duration_ms (${VOICE_DURATION_MS_MIN}-${VOICE_DURATION_MS_MAX}).`,
71
-
`Default duration_ms ${VOICE_DURATION_MS_DEFAULT} if unstated; default speed ${BASE_MOVE_SPEED_DEFAULT}.`,
74
+
`Call tool ${EXECUTE_BASE_MOVE} with action (enum), speed (${BASE_MOVE_SPEEDS.join("|")}), and EITHER duration_ms OR distance_m — not both.`,
75
+
`If the user specifies a distance (e.g. "move forward half a meter", "go forward 0.5 meters"), set distance_m in meters (${VOICE_DISTANCE_M_MIN}–${VOICE_DISTANCE_M_MAX}) and omit duration_ms.`,
76
+
`If the user specifies a rotation angle (e.g. "rotate 90 degrees", "turn left a quarter turn"), set distance_m in degrees (e.g. 90) and omit duration_ms.`,
77
+
`If the user specifies a time (e.g. "move forward for 2 seconds"), set duration_ms and omit distance_m.`,
78
+
`If neither distance nor time is specified, use default duration_ms ${VOICE_DURATION_MS_DEFAULT} and omit distance_m.`,
72
79
`When the user wants to halt base motion (stop, wait, freeze, do not move, cut that, enough), call tool ${STOP_BASE_MOVE} with no arguments — not ${EXECUTE_BASE_MOVE}.`,
73
80
`When the user wants to repeat the last base move (again, same thing, one more time, do that again), call tool ${REPEAT_BASE_MOVE} with no arguments — not ${EXECUTE_BASE_MOVE} with guessed parameters. Ensure you are over 90% confident that the user asked you to repeat previous movement before you move.`,
74
81
"Do not respond to the user. Do not speak to the user. Only call tools as instructed.",
@@ -97,11 +104,21 @@ function buildRealtimeVoiceSessionPayload() {
97
104
duration_ms: {
98
105
type: "integer",
99
106
description:
100
-
"How long to move in milliseconds before stopping.",
107
+
"How long to move in milliseconds before stopping. Use when the user specifies a time. Omit if distance_m is set.",
101
108
minimum: VOICE_DURATION_MS_MIN,
102
109
maximum: VOICE_DURATION_MS_MAX,
103
110
default: VOICE_DURATION_MS_DEFAULT,
104
111
},
112
+
distance_m: {
113
+
type: "number",
114
+
description:
115
+
"Distance to travel in meters (for translation actions: forward, backward, strafe). "+
116
+
"For rotation actions (rotate_left, rotate_right), pass the angle in degrees (e.g. 90 for a quarter turn). "+
0 commit comments