(create-chat-completion params)
(create-chat-completion params options)
Creates a model response for the given chat conversation.
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?"}]})
Response:
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-3.5-turbo-0613",
"system_fingerprint": "fp_44709d6fcb",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?",
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}
For Azure OpenAI pass {:impl :azure}
for the options
argument
Streaming of token events is supported via the :stream
param, see Streaming Tokens
Also see the OpenAI documentation
Creates a model response for the given chat conversation. 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?"}]}) ``` Response: ``` { "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "\n\nHello there, how may I assist you today?", }, "finish_reason": "stop" }], "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 } } ``` 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)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close