Vector Store Files

Add, list, and delete files in a vector store via LiteLLM

Vector store file capabilities index a file into a vector store, list its files, and delete files — calling the real LiteLLM API and surfacing backend errors.

Diagram

Vector Store Files

📄 file_id

🔧 LiteLLM

✅ Indexed in Vector Store

Quick Start

  1. Index a file with an Agent

    Use knowledge sources to let an agent index and search files automatically.

    python
    from praisonaiagents import Agent
    
    agent = Agent(
        name="Docs Assistant",
        instructions="Answer questions from the indexed documents",
        knowledge=["report.pdf"]
    )
    
    agent.start("Summarise the key findings")
  2. Direct capability call

    Add an already-uploaded file to a vector store.

    python
    from praisonai.capabilities import vector_store_file_create
    
    result = vector_store_file_create(
        vector_store_id="vs_abc123",
        file_id="file_xyz789"
    )
    
    print(result.id, result.status)

How It Works

Diagram
LiteLLMvector_store_file_*UserLiteLLMvector_store_file_*Uservector_store_file_create(vs_id, file_id)litellm.vector_store_file_create(…)responseVectorStoreFileResult
FunctionLiteLLM callReturns
vector_store_file_createlitellm.vector_store_file_createVectorStoreFileResult
avector_store_file_createlitellm.avector_store_file_createVectorStoreFileResult
vector_store_file_listlitellm.vector_store_file_listList[VectorStoreFileResult]
avector_store_file_listlitellm.avector_store_file_listList[VectorStoreFileResult]
vector_store_file_deletelitellm.vector_store_file_deletebool
avector_store_file_deletelitellm.avector_store_file_deletebool

Configuration Options

vector_store_file_create

ParameterTypeDefaultDescription
vector_store_idstrRequiredID of the vector store
file_idstrRequiredID of the file to add
chunking_strategyDictNoneChunking configuration
custom_llm_providerstr"openai"Provider
timeoutfloat600.0Request timeout
api_keystrNoneOptional API key override
api_basestrNoneOptional API base URL override

vector_store_file_list

ParameterTypeDefaultDescription
vector_store_idstrRequiredID of the vector store
custom_llm_providerstr"openai"Provider
limitint20Max files to return
afterstrNoneCursor for pagination

vector_store_file_delete

ParameterTypeDefaultDescription
vector_store_idstrRequiredID of the vector store
file_idstrRequiredID of the file to delete
custom_llm_providerstr"openai"Provider
Capabilities SDK Reference

Auto-generated reference for the capabilities module


Common Patterns

List then delete files:

python
from praisonai.capabilities import vector_store_file_list, vector_store_file_delete

files = vector_store_file_list("vs_abc123")
for f in files:
    print(f.id, f.status)

deleted = vector_store_file_delete("vs_abc123", "file_xyz789")
print(f"Deleted: {deleted}")  # False if the backend omits the flag

Async indexing:

python
import asyncio
from praisonai.capabilities import avector_store_file_create

async def main():
    result = await avector_store_file_create("vs_abc123", "file_xyz789")
    print(result.id)

asyncio.run(main())

Best Practices

Check the deleted flag

vector_store_file_delete returns False when the backend does not confirm deletion. Verify the return value rather than assuming success.

Handle backend errors

Real LiteLLM errors now propagate. Wrap calls in try/except to handle provider or auth failures.

Prefer knowledge sources for agents

For most workflows, pass files via an agent’s knowledge parameter — indexing and retrieval are handled for you.


Related