Skip to main content

Embedding functions

openai_embedding

  • Added in v2.5.0.
  • Since v2.6.0, openai_embedding function has been updated to accept a single config argument as a constant JSONB value containing the embedding configuration, instead of separate api_key and model arguments.
Get the text embedding vector for a given text. The config argument must be a constant JSONB value containing the embedding configuration.
Syntax
The config parameter is a JSONB object that supports the following options:
OptionRequiredDescription
modelYesThe embedding model to use (e.g., text-embedding-3-small)
api_keyNoOpenAI API key
org_idNoOpenAI organization ID
proj_idNoOpenAI project ID
api_baseNoCustom API base URL. Default: https://api.openai.com/v1
Example