Embeddings
Model name: embeddings
Model aliases:
openai_embeddings
nim_embeddings
About Embeddings
OpenAI Embeddings is a text embedding model that enables use of any OpenAI API complatible text embedding model. It is suitable for text classification, clustering, and other text embedding tasks.
Depending on the name of the model, the model provider will set defaults accordingly.
When invoked as embeddings
or openai_embeddings
, the model provider will default to using the OpenAI API.
When invoked as nim_embeddings
, the model provider will default to using the NVIDIA NIM API.
Supported aidb operations
- encode_text
- encode_text_batch
Supported models
- Any text embedding model that is supported by the provider.
Supported OpenAI models
- Any text embedding model that is supported by OpenAI. This includes
text-embedding-3-small
,text-embedding-3-large
, andtext-embedding-ada-002
. See a list of supported OpenAI models here. - Defaults to
text-embedding-3-small
.
Supported NIM models
- nvidia/nv-embedqa-e5-v5 (default)
Creating the default with OpenAI model
SELECT aidb.create_model('my_openai_embeddings', 'openai_embeddings', credentials=>'{"api_key": "sk-abc123xyz456def789ghi012jkl345mn"'::JSONB);
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.
Creating a specific model
You can create any supported OpenAI embedding model using the aidb.create_model
function. In this example, we are creating a text-embedding-3-large
model with the name my_openai_model
:
SELECT aidb.create_model( 'my_openai_model', 'openai_embeddings', '{"model": "text-embedding-3-large"}'::JSONB, '{"api_key": "sk-abc123xyz456def789ghi012jkl345mn"}'::JSONB );
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 model to use. This is optional and can be used to specify a custom model URL.- If
openai_completions
(orcompletions
) is themodel
,url
defaults tohttps://api.openai.com/v1/chat/completions
. - If
nim_completions
is themodel
,url
defaults tohttps://integrate.api.nvidia.com/v1/chat/completions
.
- If
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!