OpenAI Embeddings
Model name: openai_embeddings
About OpenAI Embeddings
OpenAI Embeddings is a text embedding model that enables use of any supported OpenAI text embedding model. It is suitable for text classification, clustering, and other text embedding tasks.
See a list of supported OpenAI models here.
Supported aidb operations
- encode_tect
- encode_text_batch
Supported models
- Any text embedding model that is supported by OpenAI. This includes
text-embedding-3-small
,text-embedding-3-large
, andtext-embedding-ada-002
. - Defaults to
text-embedding-3-small
.
Registering the default model
As we are defaulting the model to text-embedding-3-small
, we do not need to specify the model in the configuration. But we do need to pass an OpenAI API key in the credentials, and for that we have to pass credentials as a named parameter.
Registering a model
You can register any supported OpenAI embedding model using the aidb.register_model
function. In this example, we are registering a text-embedding-3-large
model with the name my_openai_model
:
Because we are passing the configuration options and the credentials, unlike the previous example, we do not need to pass the credentials as a named parameter.
Model configuration settings
The following configuration settings are available for OpenAI models:
model
- The OpenAI model to use.url
- The URL of the OpenAI model to use. This is optional and can be used to specify a custom model URL. Defaults tohttps://api.openai.com/v1/chat/completions
.max_concurrent_requests
- The maximum number of concurrent requests to make to the OpenAI model. Defaults to25
.
Model credentials
The following credentials are required for OpenAI models:
api_key
- The OpenAI API key to use for authentication.
Could this page be better? Report a problem or suggest an addition!