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

x/openai_deno/mod.ts>OpenAI#createEmbeddings

OpenAI API wrapper for deno.
Latest
method OpenAI.prototype.createEmbeddings
import { OpenAI } from "https://deno.land/x/openai_deno@v0.9.8/mod.ts";

Creates an embedding vector representing the input text.

Parameters

model: string

ID of the model to use. You can use the OpenAI#listModels to see all of your available models, or see OpenAI's Model overview for descriptions of them.

input: string | string[] | number[][]

Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens for text-embedding-ada-002). Example Python code for counting tokens.

optional
user: string

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

Returns

Embeddings for the input text.