OpenAIEmbeddings class
A EmbeddingsModel
for calling OpenAI and Azure OpenAI hosted models.
Constructors
Open |
Creates a new |
Properties
options | Options the client was configured with. |
Methods
create |
Creates embeddings for the given inputs using the OpenAI API. |
Constructor Details
OpenAIEmbeddings(OpenAIEmbeddingsOptions | AzureOpenAIEmbeddingsOptions)
Creates a new OpenAIEmbeddings
instance.
new OpenAIEmbeddings(options: OpenAIEmbeddingsOptions | AzureOpenAIEmbeddingsOptions)
Parameters
Options for configuring the embeddings client.
Property Details
options
Options the client was configured with.
options: OpenAIEmbeddingsOptions | OpenAILikeEmbeddingsOptions | AzureOpenAIEmbeddingsOptions
Property Value
Method Details
createEmbeddings(string, string | string[])
Creates embeddings for the given inputs using the OpenAI API.
function createEmbeddings(model: string, inputs: string | string[]): Promise<EmbeddingsResponse>
Parameters
- model
-
string
Name of the model to use (or deployment for Azure).
- inputs
-
string | string[]
Text inputs to create embeddings for.
Returns
Promise<EmbeddingsResponse>
A EmbeddingsResponse
with a status and the generated embeddings or a message when an error occurs.