From the course: OpenAI API: Building Front-End Voice Apps with the Realtime API and WebRTC

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Adding text chat to a Realtime app

Adding text chat to a Realtime app

- [Instructor] The main feature of the Realtime API is voice and audio. But the API can also receive text inputs and produce text outputs. This can be used in several ways. You can use it to introduce our text chat in your interface. You can also use it to pass in information from, say, function calling. And you can use it to add additional context to the conversation. This process is described in the Realtime models capabilities page, under Text inputs and outputs. And what you see here is, you start out by creating a conversation item, where you pass in the text message, and then you fire off response.create, asking for only text in response. This will give you a pure text-to-text chat with the Realtime API. To see how this works, you can go to the Voice and Text example. Here we have everything from the previous examples, plus a new chat interface at the bottom. So I'll create a connection. - [AI] Hey there, how can I help you today? - [Instructor] Can you write a haiku about a…

Contents