Skip to content
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

Interrupt the model with text message #501

Open
thoddnn opened this issue Dec 25, 2024 · 4 comments
Open

Interrupt the model with text message #501

thoddnn opened this issue Dec 25, 2024 · 4 comments

Comments

@thoddnn
Copy link

thoddnn commented Dec 25, 2024

Hello,

Would it be possible to add functionality to interrupt the model's audio output from webRTC template with a text message, similar to how it works in the playground ? (The interruption behavior with audio works great.)

Thank you!

@htaoufikallah
Copy link

try this from https://github.com/openai/openai-realtime-api-beta readme

// Send a item and triggers a generation
client.sendUserMessageContent([{ type: 'input_text', text: `How are you?` }]);

@thoddnn
Copy link
Author

thoddnn commented Dec 26, 2024

thanks @htaoufikallah but it doesn't work. Once the I get the response.done event from the server the audio doesn't stop.

I’ve tried using response.cancel, conversation.item.truncate then conversation.item.create with input_text and response.create but the audio continues playing until the end of the transcript.

(I'm using the webRTC template)

@sitozeta
Copy link

I need it too. A realtime model that works only with text data, pls if u know how do it reply this message. Ty

@thoddnn
Copy link
Author

thoddnn commented Dec 27, 2024

It works using the cancelResponse function from the WebSocket example: https://github.com/openai/openai-realtime-api-beta?tab=readme-ov-file#interrupting-the-model.

I think it is all about modifying the audioElement from the WebRTC template to make the audio interrupt and restart correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants