Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/simple_openai/mod.ts>OpenAI#createChatCompletion

Simple API connection compatible with OpenAI and AzureOpenAI.
Latest
method OpenAI.prototype.createChatCompletion
import { OpenAI } from "https://deno.land/x/simple_openai@v1.3.2/mod.ts";

Please check OpenAI official document for details.

Examples

Example 1

const result = await openai.createChatCompletion({
    model: "gpt-3.5-turbo",
    messages: [{
        role: "user",
        content: "hello."
    }]
});

Parameters

option: NativeOpenAI.Chat.ChatCompletionCreateParamsNonStreaming

Returns

Promise<NativeOpenAI.Chat.ChatCompletion>