Share feedback, ideas and get community help

Updated 3 months ago

Stream OpenAI

There is no information on how to handle the stream response from OpenAI via the API. Can you shed some light on it? I am completely stuck because I received the following response:

{
"messages": [],
"clientSideActions": [
{
"type": "stream",
"stream": true,
"expectsDedicatedReply": true
}
]
}

What should i do next?
W
B
4 comments
If you are on typebot cloud app and are using the openai block, streaming works by default, nothing to be done
Indeed, this is not documented.
If you enabled stream, whenever a AI message should be streamed, you will receive that kind of JSON response:

Plain Text
{
  "messages": [],
  "clientSideActions": [
    {
      "type": "stream",
      "stream": true,
      "expectsDedicatedReply": true
    }
  ]
}


The bot is ready to accept the message streaming. You now need to send the following query:

Plain Text
curl -X POST https://typebot.co/api/v2/sessions/{sessionId}/streamMessage


This endpoint will send Server-Sent events with all the information to display the streamed message.

Once it is done, you can contine the flow by sending a continue chat request with the streamed message as the message content
Add a reply
Sign up and join the conversation on Discord