Purpose
- Define which OpenAI embedding model to use
- Specify the dimensionality of the embeddings
- Configure optional parameters like user identifier for API calls
- Set the name of the environment variable that holds your OpenAI API key
Samples
Basic OpenAI embedding
With custom API key name
With user tracking
With custom base URL
Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
model | text | - | ✔ | Name of the OpenAI embedding model (e.g., text-embedding-3-small) |
dimensions | int | - | ✔ | Number of dimensions for the embedding vectors |
chat_user | text | - | ✖ | Identifier for the user making the API call (for tracking/monitoring) |
api_key_name | text | OPENAI_API_KEY | ✖ | Name of the environment variable containing the OpenAI API key |
base_url | text | - | ✖ | Custom base URL for the OpenAI API |
Returns
A JSON configuration object for use increate_vectorizer().
Related functions
embedding_ollama(): use local Ollama modelsembedding_litellm(): use any provider through LiteLLMembedding_voyageai(): use Voyage AI models