Embeddings
Generate vector embeddings for semantic search, similarity matching, and RAG applications.
The embeddings API generates vector representations of text. Use embeddings for semantic search, document similarity, clustering, and Retrieval-Augmented Generation (RAG).
What Are Embeddings
Embeddings convert text into numerical vectors that capture semantic meaning. Similar texts produce similar vectors, enabling:
Semantic search - Find content by meaning, beyond keyword matching
Document similarity - Compare how related two pieces of content are
Clustering - Group similar content together
RAG - Retrieve relevant context for AI responses
IAIEmbeddingService
The primary interface for embedding operations:
public interface IAIEmbeddingService
{
// Single embedding
Task<Embedding<float>> GenerateEmbeddingAsync(
Action<AIEmbeddingBuilder> configure,
string value,
CancellationToken cancellationToken = default);
// Multiple embeddings
Task<GeneratedEmbeddings<Embedding<float>>> GenerateEmbeddingsAsync(
Action<AIEmbeddingBuilder> configure,
IEnumerable<string> values,
CancellationToken cancellationToken = default);
// Advanced: Get a configured generator
Task<IEmbeddingGenerator<string, Embedding<float>>> CreateEmbeddingGeneratorAsync(
Action<AIEmbeddingBuilder> configure,
CancellationToken cancellationToken = default);
}Basic Usage
Choosing a Profile
Default Profile
Once you have configured a default embedding profile in the backoffice, you can call without specifying a profile on the builder:
Specific Profile
Select a profile by ID or alias on the builder:
Common Use Cases
Semantic Search
Generate embeddings for all searchable content
Store embeddings in a vector database
When searching, embed the query and find nearest neighbors
Content Similarity
Compare two pieces of content:
RAG (Retrieval-Augmented Generation)
Embed user question
Find relevant content via vector search
Include retrieved content in chat prompt
In This Section
Generating EmbeddingsBatch EmbeddingsLast updated
Was this helpful?