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

x/openai/resources/mod.ts

Deno build of the official Typescript library for the OpenAI API.
Extremely Popular
Latest
import * as openai from "https://deno.land/x/openai@v4.69.0/resources/mod.ts";

Classes

Note: no pagination actually occurs yet, this is for forwards-compatibility.

Note: no pagination actually occurs yet, this is for forwards-compatibility.

Interfaces

The request counts for different statuses within the batch.

Represents a chat completion response returned by model, based on the provided input.

Log probability information for the choice.

Data about a previous audio response from the model. Learn more.

If the audio output modality is requested, this object contains data about the audio response from the model. Learn more.

Parameters for audio output. Required when audio output is requested with modalities: ["audio"]. Learn more.

Represents a streamed chunk of a chat completion response returned by model, based on the provided input.

A chat completion delta generated by streamed model responses.

Log probability information for the choice.

Learn about image inputs.

Learn about audio inputs.

Learn about text inputs.

Specifying a particular function via {"name": "my_function"} forces the model to call that function.

A chat completion message generated by the model.

The function that the model called.

Specifies a tool the model should use. Use to force the model to call a specific function.

Options for streaming response. Only set this when you set stream: true.

Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).

Usage statistics for the completion request.

Breakdown of tokens used in a completion.

Breakdown of tokens used in the prompt.

The usage information for the request.

Represents an embedding vector returned by embedding endpoint.

The File object represents a document that has been uploaded to OpenAI.

Represents the url or the content of an image generated by the OpenAI API.

Describes an OpenAI model offering that can be used with the API.

A list of the categories, and whether they are flagged or not.

A list of the categories along with the input type(s) that the score applies to.

A list of the categories along with their scores as predicted by model.

Represents if a given text input is potentially harmful.

An object describing an image to classify.

Contains either an image URL or a data URL for a base64 encoded image.

An object describing text to classify.

The Upload object can accept byte chunks in the form of Parts.

Type Aliases

The format of the output, in one of these options: json, text, srt, verbose_json, or vtt.

Learn about text inputs.

The role of the author of a message

Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

The intended purpose of the uploaded file.

The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.

An object describing an image to classify.