You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sends a request to the `/chat/completions` endpoint. Also available as `client:chat(...)` for backward compatibility.
210
+
Sends a request to the `/chat/completions` endpoint.
207
211
208
212
-`messages`: An array of message objects.
209
213
-`opts`: Additional options for the chat, passed directly to the API (eg. model, temperature, etc.) https://platform.openai.com/docs/api-reference/chat
210
-
-`chunk_callback`: A function to be called for parsed streaming output when `stream = true` is passed to `opts`.
214
+
-`chunk_callback`: A function to be called for each raw event object when `stream = true` is passed to `opts`. Each chunk is the parsed API response (eg. `{object = "chat.completion.chunk", choices = {{delta = {content = "..."}, index = 0}}}`).
211
215
212
216
Returns HTTP status, response object, and output headers. The response object
213
217
will be decoded from JSON if possible, otherwise the raw string is returned.
Legacy alias for `create_chat_completion` with filtered streaming chunks. When streaming, the callback receives parsed chunks in the format `{content = "...", index = ...}` instead of raw event objects.
0 commit comments