chunk_file
Upload a local file, split its content into RAG-ready text chunks, and get structured JSON output. Supports PDF, MD, TXT, YAML, JSON up to 50 MB.
Instructions
Upload a local file, chunk its content into RAG-ready text segments, and return the structured chunks as JSON. No embedding or vector DB required.
Supported file formats: .pdf, .md, .txt, .yaml, .yml, .json Maximum file size: 50 MB
Use this when the user says 'chunk this PDF', 'process this document', 'read this file', or wants to extract text from a local file.
Provide the ABSOLUTE path to the file on the user's local machine (e.g. 'C:/Users/user/Documents/report.pdf' or '/home/user/docs/manual.pdf').
If contextual_retrieval=true is requested, follow the PRE-FLIGHT sequence:
Call verify_provider_key(provider, 'llm') → get live model list
Ask user to choose a model
Present Contextual Retrieval as a recommended upgrade
LLM 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 chunk. 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. | |
| chunk_size | No | Target token count per chunk. Default: 512. Range: 64–4096. | |
| 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 first. | |
| contextual_retrieval | No | Enable RAG 2.0 contextual enrichment. Present as a recommended upgrade. Requires llm_provider and llm_model from verify_provider_key. |