Let’s say we have the following scenario, for a quiz application:
- using the realtime API, a browser client is connected via WebRTC
- a function tool named “get_next_question” is used by the agent to retrieve the next quiz question to ask, together with its correct answer and explanation
- when the agent wants to retrieve the next question, it requests a function tool call
- the client reacts by sending an API request to a server (e.g. the same from which it retrieves the ephemeral API key)
Now, the server can’t simply answer to the client with the question and solution, as that would leak the data. Instead, what I would like to be able to do is the server would receive the session_id and call_id in the payload from the client, and it would send the output directly to the OpenAI API.
Is this possible?
This example from the docs shows a client sending a conversation item with the function call output using the data channel, but I haven’t been able to figure out whether there’s a way to simply send the item using the conversation API.