Docsai
Knowledge Bases (RAG)
Create knowledge bases from documents and use retrieval-augmented generation in workflows.
Knowledge Bases allow you to upload documents and use their content as context in AI workflows through Retrieval-Augmented Generation (RAG).
Setup
- Go to Settings → Knowledge Bases
- Click Create Knowledge Base
- Name it and select an embedding model
- Upload documents (PDF, DOCX, TXT, CSV, etc.)
- Assign the KB to a workspace in Settings → Workspaces → Edit
Using in Workflows
Agent Node (Recommended)
Add Knowledge Bases to an Agent node's Knowledge Bases (RAG) section. Relevant document chunks are automatically injected into the system prompt before the LLM call.
Configure per-KB:
- Top K - number of chunks to retrieve (1-50)
- Score Threshold - minimum similarity score (0-1)
RAG Action Node
Use actionType: "rag" for standalone search. Returns matched chunks as data that can be processed by downstream nodes.
Useful when you need search results as structured data rather than agent context.
Template Variables
Agent RAG context is injected automatically - no template variables needed.
For RAG Action output:
{{steps.rag-1.output.results}}
{{steps.rag-1.output.results[0].text}}
{{steps.rag-1.output.results[0].score}}