Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/openai/resources/beta/chat/mod.ts>Completions

Deno build of the official Typescript library for the OpenAI API. Source: https://github.com/openai/openai-node
Extremely Popular
Go to Latest
class Completions
extends APIResource
import { Completions } from "https://deno.land/x/openai@v4.19.1/resources/beta/chat/mod.ts";

Methods

runFunctions<FunctionsArgs extends BaseFunctionsArgs>(body: ChatCompletionFunctionRunnerParams<FunctionsArgs>, options?: Core.RequestOptions): ChatCompletionRunner

A convenience helper for using function calls with the /chat/completions endpoint which automatically calls the JavaScript functions you provide and sends their results back to the /chat/completions endpoint, looping as long as the model requests function calls.

For more details and examples, see the docs

runFunctions<FunctionsArgs extends BaseFunctionsArgs>(body: ChatCompletionStreamingFunctionRunnerParams<FunctionsArgs>, options?: Core.RequestOptions): ChatCompletionStreamingRunner
runTools<FunctionsArgs extends BaseFunctionsArgs>(body: ChatCompletionToolRunnerParams<FunctionsArgs>, options?: Core.RequestOptions): ChatCompletionRunner

A convenience helper for using tool calls with the /chat/completions endpoint which automatically calls the JavaScript functions you provide and sends their results back to the /chat/completions endpoint, looping as long as the model requests function calls.

For more details and examples, see the docs

runTools<FunctionsArgs extends BaseFunctionsArgs>(body: ChatCompletionStreamingToolRunnerParams<FunctionsArgs>, options?: Core.RequestOptions): ChatCompletionStreamingRunner
stream(body: ChatCompletionStreamParams, options?: Core.RequestOptions): ChatCompletionStream

Creates a chat completion stream