View source: R/service-openai_streaming.R
| stream_chat_completion | R Documentation | 
stream_chat_completion sends the prepared chat completion request to the
OpenAI API and retrieves the streamed response.
stream_chat_completion(
  messages = NULL,
  element_callback = cat,
  model = "gpt-3.5-turbo",
  openai_api_key = Sys.getenv("OPENAI_API_KEY")
)
| messages | A list of messages in the conversation, including the current user prompt (optional). | 
| element_callback | A callback function to handle each element of the streamed response (optional). | 
| model | A character string specifying the model to use for chat completion. The default model is "gpt-3.5-turbo". | 
| openai_api_key | A character string of the OpenAI API key. By default, it is fetched from the "OPENAI_API_KEY" environment variable. Please note that the OpenAI API key is sensitive information and should be treated accordingly. | 
The same as curl::curl_fetch_stream
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.