Fix guardrail interruption for realtime session#17
Conversation
|
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.
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.
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.
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