Embedders convert text and documents into vector embeddings for semantic search and retrieval.
defineEmbedder()
Defines and registers an embedder.
Parameters
The Genkit registry instance
EmbedderOptions<ConfigSchema>
required
Embedder configurationShow EmbedderOptions properties
Unique name for the embedder
Zod schema for embedder-specific configuration options
Metadata about the embedder’s capabilitiesShow EmbedderInfo properties
Human-readable label for the embedder
Embedding vector dimension size
Array<'text' | 'image' | 'video'>
Supported input types
Whether the embedder supports multiple languages
EmbedderFn<ConfigSchema>
required
Implementation functionFunction signature:
Returns
EmbedderAction<ConfigSchema>
An embedder action that can be used with embed()
embed()
Generates embeddings for text or documents.
Parameters
The Genkit registry instance
EmbedderParams<CustomOptions>
required
Embedding request parametersShow EmbedderParams properties
EmbedderArgument<CustomOptions>
required
Embedder to use (string name, EmbedderAction, or EmbedderReference)
string | DocumentData
required
Text or document to embed
Metadata to attach to the document
Embedder-specific configuration options
Returns
Array of embedding objects
embedMany()
Generates embeddings for multiple documents in a batch.
Parameters
The Genkit registry instance
EmbedderArgument<ConfigSchema>
required
Embedder to use
string[] | DocumentData[]
required
Array of texts or documents to embed
Metadata to attach to all documents
Embedder-specific options
Returns
embedderRef()
Creates a reference to an embedder with configuration.
Parameters
EmbedderReference<CustomOptionsSchema>
required
z.infer<CustomOptionsSchema>
Configuration values
Optional namespace prefix
Returns
EmbedderReference<CustomOptionsSchema>
An embedder reference that can be passed to embed()
Types
EmbedRequest
EmbedResponse
Embedding
EmbedderAction
Example: Custom Embedder