Back

create-chat-completion (clj)

(source)

function

(create-chat-completion params) (create-chat-completion params options)
Creates a completion for the chat message Example: ``` (create-chat-completion {:model "gpt-3.5-turbo" :messages [{:role "system" :content "You are a helpful assistant."} {:role "user" :content "Who won the world series in 2020?"} {:role "assistant" :content "The Los Angeles Dodgers won the World Series in 2020."} {:role "user" :content "Where was it played?"}]}) ``` For Azure OpenAI pass `{:impl :azure}` for the `options` argument Streaming of token events is supported via the `:stream` param, see [Streaming Tokens](/doc/03-streaming.md) Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/chat/create) / [Azure OpenAI](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#chat-completions) documentation

Examples