How It Works
When you upload a file, Honcho:- Extracts text from the file using specialized processors based on file type
- Creates messages with the extracted content split into chunks that fit within message limits (messages are limited to 50,000 characters)
- Queues processing for background analysis and insight derivation like any other message
Supported File Types
Honcho currently supports the following file types with more to come:- PDF files (
application/pdf) - Text extraction with page numbers - Text files (
text/*) - Plain text, markdown, code files, etc. - JSON files (
application/json) - Structured data converted to readable format
Files are processed in memory and not stored on disk. Only the extracted text content is preserved in Honcho’s message system.
Basic Usage
Upload Parameters
The upload methods accept the following parameters:File Processing Details
Text Extraction
PDF Files: Text is extracted page by page with page numbers preserved:Chunking Strategy
Large files are automatically split into chunks of ~49,500 characters. The system seeks to break at natural boundaries if present:- Paragraph breaks (
\n\n) - Line breaks (
\n) - Sentence endings (
.) - Word boundaries (
)
Querying Uploaded Content
Once files are uploaded, you can query the content using Honcho’s natural language interface:Error Handling
Unsupported File Types
Files with unsupported content types will raise an exception:Missing Required Fields
Session uploads require apeer_id parameter:
Complete Example: Document Analysis Assistant
Here’s a complete example of building a document analysis assistant:Error Handling
- Always wrap uploads in try-catch blocks for robust error handling
- Validate file types before upload to avoid processing errors
- Handle large files gracefully with progress indicators
- Implement retry logic for network failures