Implementation:BerriAI Litellm Vector Store Registry
| Property | Value |
|---|---|
| sources | litellm/vector_stores/vector_store_registry.py
|
| domains | Vector Stores, Registry, Configuration, Database, Credentials |
| last_updated | 2026-02-15 16:00 GMT |
Overview
The Vector Store Registry module provides two registry classes that manage vector store configurations and indexes in-memory with database fallback, handling credential resolution, YAML config loading, tool parameter extraction, and cache synchronization across multiple proxy instances.
Description
This module contains two registry classes. VectorStoreIndexRegistry manages LiteLLM_ManagedVectorStoreIndex objects with methods for CRUD operations (get_vector_store_indexes, get_vector_store_index_by_name, upsert_vector_store_index, delete_vector_store_index, is_vector_store_index) and a static database helper (_get_vector_store_indexes_from_db) for loading indexes from the Prisma database.
VectorStoreRegistry is the primary registry class that manages LiteLLM_ManagedVectorStore objects. It maintains an in-memory list of vector stores with a vector_store_ids_to_vector_store_map for fast lookups. Key capabilities include:
- Configuration loading via
load_vector_stores_from_config()which parses YAML config entries - Tool parameter extraction via
get_and_pop_recognised_vector_store_tools()which identifies vector store tools from request tool lists, extracts their parameters, removes them from the tool list, and returns a parameter-by-ID mapping - Pop-and-run semantics via
pop_vector_stores_to_run()andpop_vector_stores_to_run_with_db_fallback()which extract vector store IDs, merge tool parameters, and return copies with mergedlitellm_params - Database synchronization via
get_litellm_managed_vector_store_from_registry_or_db()andpop_vector_stores_to_run_with_db_fallback()which verify in-memory entries against the database and auto-remove stale entries - Credential resolution via
get_credentials_for_vector_store()which looks uplitellm_credential_nameand resolves it throughCredentialAccessor
Usage
Import this module when you need to manage vector store configurations in the LiteLLM proxy, load vector stores from YAML config, resolve vector store credentials for API calls, or extract vector store tool parameters from request payloads. The VectorStoreRegistry is typically instantiated as litellm.vector_store_registry and used by the vector store search and file management modules.
Code Reference
Source Location
| Property | Value |
|---|---|
| Repository | github.com/BerriAI/litellm |
| File | litellm/vector_stores/vector_store_registry.py
|
| Lines | 559 |
| Module | litellm.vector_stores.vector_store_registry
|
Signature
class VectorStoreIndexRegistry:
def __init__(self, vector_store_indexes: List[LiteLLM_ManagedVectorStoreIndex] = [])
def get_vector_store_indexes(self) -> List[LiteLLM_ManagedVectorStoreIndex]
def get_vector_store_index_by_name(self, name: str) -> Optional[LiteLLM_ManagedVectorStoreIndex]
def upsert_vector_store_index(self, index: LiteLLM_ManagedVectorStoreIndex) -> None
def delete_vector_store_index(self, index: str) -> None
def is_vector_store_index(self, name: str) -> bool
@staticmethod
async def _get_vector_store_indexes_from_db(prisma_client) -> List[LiteLLM_ManagedVectorStoreIndex]
class VectorStoreRegistry:
def __init__(self, vector_stores: List[LiteLLM_ManagedVectorStore] = [])
def pop_vector_stores_to_run(self, non_default_params: Dict, tools: Optional[List[Dict]] = None) -> List[LiteLLM_ManagedVectorStore]
async def pop_vector_stores_to_run_with_db_fallback(self, non_default_params: Dict, tools=None, prisma_client=None) -> List[LiteLLM_ManagedVectorStore]
def get_and_pop_recognised_vector_store_tools(self, tools=None, vector_store_ids=None) -> Dict[str, VectorStoreToolParams]
def load_vector_stores_from_config(self, vector_stores_config: List[Dict]) -> None
def get_credentials_for_vector_store(self, vector_store_id: str) -> Dict[str, Any]
def list_all_vector_stores(self) -> LiteLLM_ManagedVectorStoreListResponse
def add_vector_store_to_registry(self, vector_store: LiteLLM_ManagedVectorStore) -> None
def delete_vector_store_from_registry(self, vector_store_id: str) -> None
def update_vector_store_in_registry(self, vector_store_id: str, updated_data: LiteLLM_ManagedVectorStore) -> None
Import
from litellm.vector_stores.vector_store_registry import (
VectorStoreRegistry,
VectorStoreIndexRegistry,
)
I/O Contract
Inputs
| Method | Key Parameters | Description |
|---|---|---|
load_vector_stores_from_config |
vector_stores_config: List[Dict] |
Parses YAML config entries with vector_store_name and litellm_params |
pop_vector_stores_to_run |
non_default_params: Dict, tools: Optional[List[Dict]] |
Extracts and pops vector store IDs from params and tool definitions |
get_credentials_for_vector_store |
vector_store_id: str |
Looks up credentials by vector store ID |
get_and_pop_recognised_vector_store_tools |
tools: Optional[List[Dict]] |
Identifies, extracts, and removes vector store tools from tool list |
Outputs
| Method | Return Type | Description |
|---|---|---|
pop_vector_stores_to_run |
List[LiteLLM_ManagedVectorStore] |
Vector stores with merged tool parameters in litellm_params |
get_credentials_for_vector_store |
Dict[str, Any] |
Unpacked credential values for the vector store |
list_all_vector_stores |
LiteLLM_ManagedVectorStoreListResponse |
Paginated response with all registered vector stores |
get_and_pop_recognised_vector_store_tools |
Dict[str, VectorStoreToolParams] |
Mapping of vector store ID to extracted tool parameters |
Usage Examples
from litellm.vector_stores.vector_store_registry import VectorStoreRegistry
# Initialize and load from config
registry = VectorStoreRegistry()
registry.load_vector_stores_from_config([
{
"vector_store_name": "knowledge_base",
"litellm_params": {
"vector_store_id": "vs_abc123",
"custom_llm_provider": "openai",
"api_key": "sk-...",
},
}
])
# Get credentials for a vector store
credentials = registry.get_credentials_for_vector_store("vs_abc123")
# Pop vector stores to run from a request
vector_stores = registry.pop_vector_stores_to_run(
non_default_params={"vector_store_ids": ["vs_abc123"]},
tools=[{"vector_store_ids": ["vs_def456"], "max_num_results": 5}],
)
for vs in vector_stores:
print(f"Running vector store: {vs['vector_store_id']}")
Related Pages
- BerriAI_Litellm_Vector_Stores_API -- Vector store create and search operations that use this registry for credential lookup
- BerriAI_Litellm_Vector_Store_Files_API -- File management that uses registry credentials via
_prepare_registry_credentials()