Knowledge Base
Give your agents access to custom knowledge and data sources.
The Knowledge Base lets you upload documents, data, and other content that your agents can reference when answering questions. It powers retrieval-augmented generation (RAG) to ground agent responses in your proprietary data.
Supported Formats
- PDF documents
- Markdown / plain text files
- CSV and structured data
- HTML pages and web content
- JSON and JSONL data files
Uploading Content
Via Dashboard
Navigate to the Knowledge Base section in the dashboard and drag-and-drop your files, or click to browse. Files are automatically processed, chunked, and indexed.
Via API
upload.ts
await lens.knowledgeBase.upload({
file: './data/product-docs.pdf',
metadata: {
category: 'product',
version: '2.0',
},
})How Retrieval Works
When an agent receives a question, LensOS automatically:
- Converts the query into an embedding vector
- Searches the knowledge base for semantically similar content
- Retrieves the most relevant chunks
- Injects the context into the agent's prompt
This process is fully automatic — you don't need to manage the retrieval pipeline yourself.
Configuration
- Chunk Size — Control how documents are split (default: 512 tokens).
- Overlap — Set overlap between chunks for better context (default: 50 tokens).
- Top K — Number of chunks to retrieve per query (default: 5).
- Similarity Threshold — Minimum relevance score for retrieved content.
Tip
For best results, keep your documents focused and well-structured. Smaller, topic-specific documents tend to produce better retrieval results than large, monolithic files.