Indexes are critical components in Semantic Router that store and retrieve embeddings efficiently. They act as the search backend that enables Semantic Router to find the most relevant routes for incoming queries.
In Semantic Router, an index serves several key purposes:
The choice of index can significantly impact the performance, scalability, and persistence capabilities of your semantic routing system.
Semantic Router supports both local (in-memory) and remote (cloud-based) indexes:
Local indexes store embeddings in memory, making them fast but ephemeral. They’re perfect for development, testing, or applications with a small number of routes.
Example usage:
Remote indexes store embeddings in cloud-based vector databases, making them persistent and scalable. They’re ideal for production applications or systems with many routes.
Example usage with Pinecone:
For advanced use cases, Semantic Router also provides a hybrid index that combines both dense and sparse embeddings:
Index | Description | Installation |
---|---|---|
LocalIndex | In-memory index for development and testing | pip install -qU semantic-router |
HybridLocalIndex | In-memory index supporting hybrid search | pip install -qU "semantic-router[hybrid]" |
PineconeIndex | Pinecone vector database integration | pip install -qU "semantic-router[pinecone]" |
QdrantIndex | Qdrant vector database integration | pip install -qU "semantic-router[qdrant]" |
PostgresIndex | PostgreSQL with pgvector extension | pip install -qU "semantic-router[postgres]" |
Semantic Router provides an auto-sync feature that keeps your routes in sync between local and remote indexes:
Auto-sync modes:
"local"
: Sync from remote to local (pull)"remote"
: Sync from local to remote (push)None
: No automatic syncingWhen selecting an index for your application, consider:
All indexes in Semantic Router inherit from BaseIndex
and implement these key methods:
add()
: Add embeddings to the indexquery()
: Search for similar vectorsdelete()
: Remove routes from the indexdescribe()
: Get information about the indexis_ready()
: Check if the index is initialized and ready for useFor detailed information on specific indexes and their configuration options, refer to their respective documentation pages.
Indexes are critical components in Semantic Router that store and retrieve embeddings efficiently. They act as the search backend that enables Semantic Router to find the most relevant routes for incoming queries.
In Semantic Router, an index serves several key purposes:
The choice of index can significantly impact the performance, scalability, and persistence capabilities of your semantic routing system.
Semantic Router supports both local (in-memory) and remote (cloud-based) indexes:
Local indexes store embeddings in memory, making them fast but ephemeral. They’re perfect for development, testing, or applications with a small number of routes.
Example usage:
Remote indexes store embeddings in cloud-based vector databases, making them persistent and scalable. They’re ideal for production applications or systems with many routes.
Example usage with Pinecone:
For advanced use cases, Semantic Router also provides a hybrid index that combines both dense and sparse embeddings:
Index | Description | Installation |
---|---|---|
LocalIndex | In-memory index for development and testing | pip install -qU semantic-router |
HybridLocalIndex | In-memory index supporting hybrid search | pip install -qU "semantic-router[hybrid]" |
PineconeIndex | Pinecone vector database integration | pip install -qU "semantic-router[pinecone]" |
QdrantIndex | Qdrant vector database integration | pip install -qU "semantic-router[qdrant]" |
PostgresIndex | PostgreSQL with pgvector extension | pip install -qU "semantic-router[postgres]" |
Semantic Router provides an auto-sync feature that keeps your routes in sync between local and remote indexes:
Auto-sync modes:
"local"
: Sync from remote to local (pull)"remote"
: Sync from local to remote (push)None
: No automatic syncingWhen selecting an index for your application, consider:
All indexes in Semantic Router inherit from BaseIndex
and implement these key methods:
add()
: Add embeddings to the indexquery()
: Search for similar vectorsdelete()
: Remove routes from the indexdescribe()
: Get information about the indexis_ready()
: Check if the index is initialized and ready for useFor detailed information on specific indexes and their configuration options, refer to their respective documentation pages.