Skip to main content

openai_embeddings

Generates vector embeddings to represent input text, using the OpenAI API.

This processor sends text to the OpenAI API and generates a vector embedding for each message. By default it submits the entire message payload as a string, unless you customize the input with the text_mapping field.

# Config fields, showing default values
processor:
label: ""
openai_embeddings:
api_key: "" # No default (required)
dimensions: 0
model: "" # No default (required)
server_address: https://api.openai.com/v1
text_mapping: ""

Examples

Generate a vector embedding for the contents of each message.

processor:
openai_embeddings:
api_key: "${OPENAI_API_KEY}"
model: text-embedding-3-small

Fields

api_key

The API key for the OpenAI API. :::warning Secret This field contains sensitive information that usually shouldn't be added to a config directly, read our secrets page for more info. :::

Type: string

dimensions

The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.

Type: int

model

The name of the OpenAI model to use, for example text-embedding-3-large, text-embedding-3-small, or text-embedding-ada-002.

Type: string

server_address

The OpenAI API endpoint that the processor sends requests to. Set this to point at another OpenAI-compatible service.

Type: string
Default: https://api.openai.com/v1

text_mapping

The text you want to generate a vector embedding for. By default the processor submits the entire message payload as a string. This field supports Bloblang mappings.

Type: string