| Property |
Value
|
| sources |
litellm/vector_store_files/main.py
|
| domains |
Vector Stores, File Management, CRUD, OpenAI
|
| last_updated |
2026-02-15 16:00 GMT
|
Overview
The Vector Store Files API module provides full CRUD operations for managing files within vector stores, including creating, listing, retrieving, retrieving content, updating attributes, and deleting vector store files with automatic registry credential integration.
Description
This module implements six sync/async function pairs for vector store file management: create/acreate, list/alist, retrieve/aretrieve, retrieve_content/aretrieve_content, update/aupdate, and delete/adelete. All functions use the @client decorator and default to "openai" as the provider via the _ensure_provider() helper. Each function integrates with the vector store registry through _prepare_registry_credentials(), which automatically pulls stored credentials for the given vector store ID when litellm.vector_store_registry is available. The module uses VectorStoreFileRequestUtils for parameter extraction, ProviderConfigManager.get_provider_vector_store_files_config() for provider config loading, and delegates HTTP calls to specialized handlers on BaseLLMHTTPHandler. File attributes support typed values (str, int, float, bool) and can be set during creation or updated via the update endpoint.
Usage
Import this module when you need to manage individual files within a vector store, including uploading files, listing files with pagination, retrieving file metadata or content, updating file attributes for filtering, and deleting files.
Code Reference
Source Location
| Property |
Value
|
| Repository |
github.com/BerriAI/litellm
|
| File |
litellm/vector_store_files/main.py
|
| Lines |
781
|
| Module |
litellm.vector_store_files.main
|
Signature
@client
def create(
*, vector_store_id: str, file_id: str,
attributes: Optional[VectorStoreFileAttributes] = None,
chunking_strategy: Optional[Dict[str, Any]] = None,
extra_headers=None, extra_query=None, extra_body=None,
timeout=None, custom_llm_provider=None, **kwargs,
) -> Union[VectorStoreFileObject, Coroutine[Any, Any, VectorStoreFileObject]]
@client
def list(*, vector_store_id: str, after=None, before=None, filter=None,
limit=None, order=None, ...) -> VectorStoreFileListResponse
@client
def retrieve(*, vector_store_id: str, file_id: str, ...) -> VectorStoreFileObject
@client
def retrieve_content(*, vector_store_id: str, file_id: str, ...) -> VectorStoreFileContentResponse
@client
def update(*, vector_store_id: str, file_id: str,
attributes: VectorStoreFileAttributes, ...) -> VectorStoreFileObject
@client
def delete(*, vector_store_id: str, file_id: str, ...) -> VectorStoreFileDeleteResponse
Import
from litellm.vector_store_files.main import (
create, acreate,
list, alist,
retrieve, aretrieve,
retrieve_content, aretrieve_content,
update, aupdate,
delete, adelete,
)
I/O Contract
Inputs
| Parameter |
Type |
Required |
Description
|
vector_store_id |
str |
Yes |
The ID of the vector store containing the files
|
file_id |
str |
For create/retrieve/update/delete |
The ID of the file to operate on
|
attributes |
VectorStoreFileAttributes |
For update |
Key-value pairs (str, int, float, bool values)
|
chunking_strategy |
Optional[Dict[str, Any]] |
No |
Chunking strategy for file processing
|
after |
Optional[str] |
No |
Pagination cursor for list
|
before |
Optional[str] |
No |
Reverse pagination cursor for list
|
filter |
Optional[str] |
No |
Filter for list results
|
limit |
Optional[int] |
No |
Number of items per page
|
custom_llm_provider |
Optional[str] |
No |
Provider; defaults to "openai"
|
Outputs
| Function |
Return Type |
Description
|
create |
VectorStoreFileObject |
The created file object with metadata
|
list |
VectorStoreFileListResponse |
Paginated list of files
|
retrieve |
VectorStoreFileObject |
The retrieved file object
|
retrieve_content |
VectorStoreFileContentResponse |
The file's parsed content
|
update |
VectorStoreFileObject |
The updated file object
|
delete |
VectorStoreFileDeleteResponse |
Deletion confirmation
|
Usage Examples
import litellm
# Create a file in a vector store
file_obj = litellm.vector_store_files.create(
vector_store_id="vs_abc123",
file_id="file_xyz789",
attributes={"category": "documentation", "priority": 1},
)
print(f"File: {file_obj.id}, Status: {file_obj.status}")
import litellm
# List files in a vector store
files = litellm.vector_store_files.list(
vector_store_id="vs_abc123",
limit=10,
)
for f in files.data:
print(f"File: {f.id}")
# Update file attributes
updated = litellm.vector_store_files.update(
vector_store_id="vs_abc123",
file_id="file_xyz789",
attributes={"category": "updated_docs", "reviewed": True},
)
Related Pages