# Embedding Models

## What are Embeddings?

Content in your knowledge bases is automatically converted into vector embeddings - numerical representations that capture semantic meaning. When you search, your query is also embedded, and similar content is found by comparing vector distances using cosine similarity.

## Supported Models

Seclai supports embedding models from OpenAI, Google Vertex AI, and AWS Bedrock — with configurable dimensions, multilingual options, and multimodal support. See the [Models](https://seclai.com/docs/models) page for the full, up-to-date catalog with dimensions, credits, and language support.

## Choosing a Model

When selecting an embedding model, consider:

- **Dimensions**: Higher dimensions can capture more nuance but increase storage and compute costs
- **Language support**: Some models like multilingual-embedding-002 are optimized for multiple languages
- **Provider**: Choose based on your existing cloud infrastructure and API preferences
- **Performance**: Different models have different speed vs. quality tradeoffs

## Configurable Dimensions

Many models support multiple dimension sizes. Lower dimensions reduce:

- Storage costs
- Query latency
- Indexing time

While potentially trading off some semantic precision.

## Migrating Existing Custom Index Sources

If you already have a custom index source and want to move it to a different
embedding model or dimensions, use embedding migration.

Migration creates and indexes a shadow source, tracks progress, then switches
the source connection when indexing completes.

Channel support:

- **UI**: Open a source, go to the **Embeddings** tab, start migration, and monitor progress.
- **User-authenticated REST**: `POST /sources/{source_connection_id}/embedding-migration`, then poll `GET /sources/{source_connection_id}/embedding-migration`.
- **API-key REST (`/api/*`)**: `POST /api/sources/{source_connection_id}/embedding-migration`, then poll `GET /api/sources/{source_connection_id}/embedding-migration`.
- **MCP**: Use the `start_source_embedding_migration` and `get_source_embedding_migration` tools.

Migration is supported for `custom_index` sources and enforces model/dimension
compatibility.

## Reranking

After the initial similarity search using embeddings, you can optionally apply a reranking model to improve the relevance and quality of results. Reranking re-evaluates the retrieved content and reorders it based on deeper semantic understanding of the query.

### How Reranking Works

The retrieval pipeline works in two stages:

1. **Initial Retrieval** - Vector similarity search finds potentially relevant content quickly using cosine similarity
2. **Reranking (Optional)** - A specialized model re-scores the top results for better relevance

Reranking models are more computationally expensive than embedding similarity, so they're applied only to the top candidates from the initial search.

### Supported Reranking Models

Seclai supports several reranking models:

**AWS Bedrock Models:**

- **amazon.rerank-v1:0** - Amazon's reranking model (default)
- **cohere.reranker-v3.5:0** - Cohere's high-performance reranker

### When to Use Reranking

Consider enabling reranking when:

- **Precision is critical** - You need the most relevant results at the top
- **Semantic nuance matters** - Your queries require deep understanding of context
- **Large knowledge bases** - More content means initial similarity may miss subtle relevance

Reranking is optional and can be configured per knowledge base. If not enabled, results are ranked solely by embedding similarity scores.
