Implementation:BerriAI Litellm Managed Vector Stores
| Attribute | Value |
|---|---|
| Sources | enterprise/litellm_enterprise/proxy/hooks/managed_vector_stores.py |
| Domains | Vector Stores, Proxy Hooks, Enterprise, Resource Management |
| Last Updated | 2026-02-15 16:00 GMT |
Overview
_PROXY_LiteLLMManagedVectorStores is a proxy hook that manages vector stores across multiple LLM providers using unified IDs, providing transparent CRUD operations, access control, and router integration for vector store search and retrieval.
Description
This class extends both CustomLogger and BaseManagedResource[VectorStoreCreateResponse] to provide managed vector store functionality in the LiteLLM proxy. It follows the same unified ID pattern as Managed Files.
Core Capabilities:
- Cross-Model Vector Store Creation -- Creates vector stores across multiple models and generates a unified base64-encoded ID.
- Unified ID Management -- Encodes resource type, UUID, target model names, provider resource ID, and model ID.
- Access Control -- Validates user access to managed vector stores before operations.
- Pre-Call Hook -- Intercepts
avector_store_search,avector_store_retrieve, andavector_store_deletecalls to resolve unified IDs and enforce access. - Deployment Filtering -- Filters deployments to only those that have the vector store available.
- User Listing -- Lists vector stores created by a specific user with pagination support.
The resource_type property returns "vector_store" and the database table is litellm_managedvectorstoretable.
Usage
Instantiated by the proxy server and registered as a proxy hook. Requires InternalUsageCache and PrismaClient.
Code Reference
Source Location
enterprise/litellm_enterprise/proxy/hooks/managed_vector_stores.py
Signature
class _PROXY_LiteLLMManagedVectorStores(CustomLogger, BaseManagedResource[VectorStoreCreateResponse]):
def __init__(self, internal_usage_cache: InternalUsageCache, prisma_client: PrismaClient): ...
async def acreate_vector_store(
self, create_request, llm_router, target_model_names_list, litellm_parent_otel_span, user_api_key_dict
) -> VectorStoreCreateResponse: ...
async def alist_vector_stores(self, user_api_key_dict, limit, after, order) -> Dict[str, Any]: ...
async def check_vector_store_access(self, vector_store_id, user_api_key_dict) -> bool: ...
async def check_managed_vector_store_access(self, data, user_api_key_dict) -> bool: ...
async def async_pre_call_hook(self, user_api_key_dict, cache, data, call_type) -> Union[Exception, str, Dict, None]: ...
async def async_post_call_success_hook(self, data, user_api_key_dict, response) -> Any: ...
async def async_filter_deployments(self, model, healthy_deployments, messages, request_kwargs, parent_otel_span) -> List[Dict]: ...
Import
from litellm_enterprise.proxy.hooks.managed_vector_stores import _PROXY_LiteLLMManagedVectorStores
I/O Contract
Inputs
| Parameter | Type | Description |
|---|---|---|
internal_usage_cache |
InternalUsageCache |
Cache for storing vector store mappings. |
prisma_client |
PrismaClient |
Database client for persistent storage. |
create_request |
VectorStoreCreateOptionalRequestParams |
Vector store creation parameters. |
target_model_names_list |
List[str] |
Models to create vector stores across. |
user_api_key_dict |
UserAPIKeyAuth |
Authentication info for access control. |
Outputs
| Output | Type | Description |
|---|---|---|
| Vector store response | VectorStoreCreateResponse |
Response with unified vector store ID. |
| List response | Dict[str, Any] |
Paginated list of vector stores with metadata. |
| Access check | bool |
Whether the user has access to the resource. |
Usage Examples
from litellm_enterprise.proxy.hooks.managed_vector_stores import _PROXY_LiteLLMManagedVectorStores
managed_vs = _PROXY_LiteLLMManagedVectorStores(
internal_usage_cache=cache,
prisma_client=prisma_client,
)
# Create a managed vector store across models
response = await managed_vs.acreate_vector_store(
create_request={"name": "my-vector-store"},
llm_router=router,
target_model_names_list=["openai/gpt-4"],
litellm_parent_otel_span=None,
user_api_key_dict=user_key,
)
Related Pages
- BerriAI_Litellm_Vector_Store_Endpoints -- REST management endpoints for vector stores
- BerriAI_Litellm_Managed_Files -- Managed files hook with similar unified ID patterns