Optional fields: Partial<OpenAIEmbeddingsParams> & Partial<AzureOpenAIInput> & { Optional configuration: ClientOptions & LegacyOpenAIInputThe maximum number of documents to embed in a single request. This is limited by the OpenAI API to a maximum of 2048.
Model name to use
Model name to use
Alias for model
Whether to strip new lines from the input text. This is recommended by OpenAI for older models, but may not be suitable for all use cases. See: https://github.com/openai/openai-python/issues/418#issuecomment-1525939500
Optional azureAzure OpenAI API deployment name to use for completions when making requests to Azure OpenAI. This is the name of the deployment you created in the Azure portal. e.g. "my-openai-deployment" this will be used in the endpoint URL: https://{InstanceName}.openai.azure.com/openai/deployments/my-openai-deployment/
Optional azureAzure OpenAI API instance name to use when making requests to Azure OpenAI. this is the name of the instance you created in the Azure portal. e.g. "my-openai-instance" this will be used in the endpoint URL: https://my-openai-instance.openai.azure.com/openai/deployments/{DeploymentName}/
Optional azureAPI key to use when making requests to Azure OpenAI.
Optional azureAPI version to use when making requests to Azure OpenAI.
Optional azureCustom endpoint for Azure OpenAI API. This is useful in case you have a deployment in another region. e.g. setting this value to "https://westeurope.api.cognitive.microsoft.com/openai/deployments" will be result in the endpoint URL: https://westeurope.api.cognitive.microsoft.com/openai/deployments/{DeploymentName}/
Optional dimensionsThe number of dimensions the resulting output embeddings should have.
Only supported in text-embedding-3 and later models.
Optional organizationOptional timeoutTimeout to use when making requests to OpenAI.
Method to generate embeddings for an array of documents. Splits the documents into batches and makes requests to the OpenAI API to generate embeddings.
Array of documents to generate embeddings for.
Promise that resolves to a 2D array of embeddings for each document.
Generated using TypeDoc
Class for generating embeddings using the OpenAI API. Extends the Embeddings class and implements OpenAIEmbeddingsParams and AzureOpenAIInput.
Example