Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:BerriAI Litellm Vector Store Types

From Leeroopedia
Attribute Value
Sources litellm/types/vector_stores.py
Domains Vector Stores, Search, Indexing, OpenAI API Compatibility, Proxy Management
Last Updated 2026-02-15 16:00 GMT

Overview

TypedDicts, Pydantic models, enums, and dataclasses defining the complete type system for vector store creation, management, search, indexing, and access control in LiteLLM.

Description

This module provides the comprehensive type hierarchy for LiteLLM's vector store subsystem. It covers provider-agnostic vector store operations following the OpenAI API format, plus LiteLLM-specific managed vector store and index types. Key type groups include:

  • Provider integrations -- SupportedVectorStoreIntegrations enum (bedrock, ragflow).
  • Managed vector stores -- LiteLLM_VectorStoreConfig (proxy YAML config), LiteLLM_ManagedVectorStore (database object with credentials and access control), LiteLLM_ManagedVectorStoreListResponse (paginated listing).
  • CRUD operations -- VectorStoreUpdateRequest, VectorStoreDeleteRequest, VectorStoreInfoRequest for managing vector stores.
  • Search -- VectorStoreSearchRequest (query with filters, max results, ranking options, rewrite flag), VectorStoreSearchResult (score, content, file info), VectorStoreSearchResponse (paginated search results).
  • Creation -- VectorStoreCreateRequest with expiration policy, chunking strategy (auto/static), file IDs, and metadata. VectorStoreCreateResponse with full lifecycle state.
  • Chunking strategies -- VectorStoreAutoChunkingStrategy, VectorStoreStaticChunkingStrategy, VectorStoreStaticChunkingStrategyConfig, unified VectorStoreChunkingStrategy.
  • Indexing -- IndexCreateRequest, IndexCreateLiteLLMParams, LiteLLM_ManagedVectorStoreIndex, VectorStoreIndexType (read/write), VectorStoreIndexEndpoints.
  • Tool integration -- VectorStoreToolParams dataclass for extracting file_search tool parameters.
  • Authentication -- BaseVectorStoreAuthCredentials for provider API credentials.

Usage

Import from this module when:

  • Creating, updating, deleting, or searching vector stores through the proxy API.
  • Configuring vector stores in the proxy YAML configuration.
  • Implementing provider-specific vector store handlers (Bedrock, RAGFlow).
  • Building search interfaces that query vector stores with filtering and reranking.
  • Managing vector store indices for read/write routing.

Code Reference

Source Location

litellm/types/vector_stores.py (272 lines)

Key Types

Type Name Kind Description
SupportedVectorStoreIntegrations str, Enum Supported providers: bedrock, ragflow
LiteLLM_VectorStoreConfig TypedDict Proxy YAML config entry for a vector store
LiteLLM_ManagedVectorStore TypedDict Database-stored managed vector store object
LiteLLM_ManagedVectorStoreListResponse TypedDict Paginated list of managed vector stores
VectorStoreUpdateRequest BaseModel Update request for a vector store
VectorStoreDeleteRequest BaseModel Delete request by vector_store_id
VectorStoreInfoRequest BaseModel Info request by vector_store_id
VectorStoreResultContent TypedDict Content of a search result (text, type)
VectorStoreSearchResult TypedDict Single search result with score, content, file info
VectorStoreSearchResponse TypedDict Paginated search results response
VectorStoreSearchOptionalRequestParams TypedDict Optional search params (filters, max_num_results, ranking_options, rewrite_query)
VectorStoreSearchRequest TypedDict Search request with query and optional params
VectorStoreExpirationPolicy TypedDict Expiration policy (anchor, days)
VectorStoreAutoChunkingStrategy TypedDict Auto chunking configuration
VectorStoreStaticChunkingStrategyConfig TypedDict Static chunking config (max tokens, overlap)
VectorStoreStaticChunkingStrategy TypedDict Static chunking with config
VectorStoreChunkingStrategy TypedDict Unified chunking strategy (auto or static)
VectorStoreFileCounts TypedDict File processing state counts
VectorStoreCreateRequest TypedDict Create request with name, file_ids, expiration, chunking, metadata
VectorStoreCreateResponse TypedDict Create response with full vector store state
IndexCreateLiteLLMParams BaseModel LiteLLM params for index creation (store index, store name)
IndexCreateRequest BaseModel Index creation request
LiteLLM_ManagedVectorStoreIndex BaseModel Database-stored managed index object
VectorStoreIndexType str, Enum Index type: read, write
VectorStoreIndexEndpoints TypedDict Read/write endpoint tuples for an index
VECTOR_STORE_OPENAI_PARAMS Literal OpenAI-compatible search params literal type
VectorStoreToolParams dataclass Extracted file_search tool parameters
BaseVectorStoreAuthCredentials TypedDict Auth credentials (headers, query_params)

Import

from litellm.types.vector_stores import (
    SupportedVectorStoreIntegrations,
    LiteLLM_VectorStoreConfig,
    LiteLLM_ManagedVectorStore,
    LiteLLM_ManagedVectorStoreListResponse,
    VectorStoreUpdateRequest,
    VectorStoreDeleteRequest,
    VectorStoreSearchRequest,
    VectorStoreSearchResponse,
    VectorStoreSearchResult,
    VectorStoreCreateRequest,
    VectorStoreCreateResponse,
    VectorStoreChunkingStrategy,
    VectorStoreExpirationPolicy,
    IndexCreateRequest,
    LiteLLM_ManagedVectorStoreIndex,
    VectorStoreToolParams,
)

I/O Contract

VectorStoreCreateRequest (Input)

Field Type Description
name Optional[str] Name of the vector store
file_ids Optional[List[str]] File IDs to include in the store
expires_after Optional[VectorStoreExpirationPolicy] Expiration policy (anchor + days)
chunking_strategy Optional[VectorStoreChunkingStrategy] Chunking configuration
metadata Optional[Dict[str, str]] Key-value metadata pairs

VectorStoreCreateResponse (Output)

Field Type Description
id str Vector store ID
object Literal["vector_store"] Object type constant
created_at int Unix timestamp of creation
name Optional[str] Vector store name
bytes int Size in bytes
file_counts VectorStoreFileCounts File processing state counts
status Literal["expired", "in_progress", "completed"] Processing status
expires_after Optional[VectorStoreExpirationPolicy] Expiration policy
expires_at Optional[int] Expiration unix timestamp
last_active_at Optional[int] Last activity unix timestamp
metadata Optional[Dict[str, str]] Metadata key-value pairs

VectorStoreSearchRequest (Input)

Field Type Description
query Union[str, List[str]] Search query string or list of queries
filters Optional[Dict] Filter criteria
max_num_results Optional[int] Maximum number of results to return
ranking_options Optional[Dict] Ranking configuration
rewrite_query Optional[bool] Whether to rewrite the query for better retrieval

VectorStoreSearchResponse (Output)

Field Type Description
object Literal["vector_store.search_results.page"] Object type constant
search_query Optional[str] The executed search query
data Optional[List[VectorStoreSearchResult]] List of search results

LiteLLM_ManagedVectorStore (Database Object)

Field Type Description
vector_store_id str Unique vector store identifier
custom_llm_provider str Provider name (bedrock, ragflow, etc.)
vector_store_name Optional[str] Display name
vector_store_description Optional[str] Description
vector_store_metadata Optional[Union[Dict[str, Any], str]] Additional metadata
litellm_credential_name Optional[str] Credential reference name
litellm_params Optional[Dict[str, Any]] LiteLLM-specific parameters
team_id Optional[str] Owning team for access control
user_id Optional[str] Owning user for access control
created_at Optional[datetime] Creation timestamp
updated_at Optional[datetime] Last update timestamp

Usage Examples

Creating a vector store

from litellm.types.vector_stores import VectorStoreCreateRequest

request: VectorStoreCreateRequest = {
    "name": "knowledge-base",
    "file_ids": ["file-001", "file-002"],
    "chunking_strategy": {
        "type": "static",
        "static": {
            "max_chunk_size_tokens": 1000,
            "chunk_overlap_tokens": 200,
        },
    },
    "expires_after": {
        "anchor": "last_active_at",
        "days": 90,
    },
    "metadata": {"department": "engineering"},
}

Searching a vector store

from litellm.types.vector_stores import VectorStoreSearchRequest

search: VectorStoreSearchRequest = {
    "query": "How does caching work in LiteLLM?",
    "max_num_results": 5,
    "filters": {"department": "engineering"},
    "rewrite_query": True,
}

Configuring a managed vector store in YAML

from litellm.types.vector_stores import LiteLLM_VectorStoreConfig

config: LiteLLM_VectorStoreConfig = {
    "vector_store_name": "bedrock-kb",
    "litellm_params": {
        "custom_llm_provider": "bedrock",
        "vector_store_id": "KB_ABC123",
        "aws_region_name": "us-east-1",
    },
}

Creating an index

from litellm.types.vector_stores import IndexCreateRequest, IndexCreateLiteLLMParams

request = IndexCreateRequest(
    index_name="search-index",
    litellm_params=IndexCreateLiteLLMParams(
        vector_store_index="idx-001",
        vector_store_name="knowledge-base",
    ),
    index_info={"description": "Primary search index"},
)

Using VectorStoreToolParams

from litellm.types.vector_stores import VectorStoreToolParams

params = VectorStoreToolParams(
    filters={"source": "docs"},
    max_num_results=10,
    ranking_options={"ranker": "auto"},
)

# Convert to dict for API call, excluding None values
params_dict = params.to_dict()
# {'filters': {'source': 'docs'}, 'max_num_results': 10, 'ranking_options': {'ranker': 'auto'}}

Updating a vector store

from litellm.types.vector_stores import VectorStoreUpdateRequest

update = VectorStoreUpdateRequest(
    vector_store_id="vs-abc123",
    vector_store_name="updated-knowledge-base",
    vector_store_description="Updated description",
    vector_store_metadata={"version": "2.0"},
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment