Skip to main content
Generate vector embeddings from text, text arrays, or tokens using OpenAI’s embedding models. Embeddings are numerical representations of text that capture semantic meaning, making them ideal for semantic search, recommendations, and clustering.

Samples

Generate an embedding from text

Create a vector embedding for a single piece of text:

Generate embeddings for multiple texts

Process multiple texts at once for efficiency:

Specify embedding dimensions

Control the size of the output vector (model-dependent):

Use pre-tokenized input

Provide tokens directly instead of text:

Store embeddings in a table

Generate and store embeddings for your data:

Arguments

Returns

For single text input:
  • vector: A pgvector compatible vector containing the embedding
For array input:
  • TABLE(index INT, embedding vector): A table with an index and embedding for each input text