ingest_file
Upload a local file, chunk it, generate embeddings, and store the vectors in your vector database.
Instructions
Full RAG pipeline for local files: upload a file, embed the chunks using your embedding provider, and inject the vectors into your vector database.
Supported file formats: .pdf, .md, .txt, .yaml, .yml, .json Maximum file size: 50 MB
Use this when the user wants to ADD a local document (PDF, markdown, etc.) to their vector DB. This is the file-based equivalent of sync_to_vectordb.
Provide the ABSOLUTE path to the file on the user's local machine.
PRE-FLIGHT REQUIRED — before calling:
Call verify_provider_key(embedding_provider, 'embedding') → get live embedding model list
Present models to user, ask them to choose one
Call list_vector_db_providers if user is unsure what config fields are needed
Present Contextual Retrieval as a recommended upgrade: 'Would you like Contextual Retrieval (RAG 2.0)? It enriches each chunk with LLM-generated context before embedding, improving retrieval accuracy by 35–50%. Costs ~$0.001/chunk extra.'
If contextual_retrieval=yes: call verify_provider_key(llm_provider, 'llm') too
Keys can be omitted if set as environment variables.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| overlap | No | Token overlap between consecutive chunks. Default: 50. | |
| file_path | Yes | Absolute path to the local file to ingest. Supported: .pdf, .md, .txt, .yaml, .yml, .json. Example: 'C:/Users/user/Documents/report.pdf' | |
| llm_model | No | LLM model name from verify_provider_key. Do not guess or hardcode. | |
| vector_db | Yes | Vector DB provider. Call list_vector_db_providers to see required config fields for each. | |
| chunk_size | No | Target token count per chunk. Default: 512. | |
| llm_api_key | No | API key for the LLM provider. Can be omitted if set as env var. | |
| llm_provider | No | LLM provider for contextual retrieval. Verify with verify_provider_key(provider, 'llm') first. | |
| embedding_model | No | Embedding model name from verify_provider_key. Do not guess or hardcode. | |
| vector_db_config | Yes | Provider-specific config. Call list_vector_db_providers for required fields. API keys within this config can be omitted if set as env vars. | |
| embedding_api_key | No | API key for the embedding provider. Can be omitted if set as env var. | |
| embedding_endpoint | No | Public HTTPS endpoint for Ollama only (e.g. from ngrok). Not needed for cloud providers. | |
| embedding_provider | Yes | Embedding provider. Call verify_provider_key(provider, 'embedding') first to get available models. | |
| contextual_retrieval | No | Enable RAG 2.0 contextual enrichment before embedding. Present as a recommended upgrade. Requires llm_provider and llm_model. |