-
Notifications
You must be signed in to change notification settings - Fork 497
Fix guardrail interruption for realtime session #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix guardrail interruption for realtime session #17
Conversation
seratch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Still need to validate this myself. So do not merge |
🦋 Changeset detectedLatest commit: 5f7cf58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| id: z.string().optional(), | ||
| conversation_id: z.string().optional(), | ||
| max_output_tokens: z.number().or(z.literal('inf')).optional(), | ||
| id: z.string().optional().nullable(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to mark all of these as nullable since optional() in Zod now explicitly requires nullable()
| const feedbackText = getRealtimeGuardrailFeedbackMessage(result); | ||
| this.sendMessage(feedbackText); | ||
| break; | ||
| const firstTripwireTriggered = results.find( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the same behavior as before. Just makes it more explicit that we trip on the first guardrail
| 'interruptedByGuardrail', | ||
| this.#interruptedByGuardrail[responseId], | ||
| ); | ||
| if (this.#interruptedByGuardrail[responseId]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this there might be jankyness since other guardrail checks might have been kicked off already. So this makes sure that we are only tripping once per response
Summary
response.canceleven when audio hasn't startedTesting
pnpm buildCI=1 pnpm testpnpm linthttps://chatgpt.com/codex/tasks/task_i_68409f83804883318c5bf86f8a0457ca