Knowledge-Guided Conversational Forms (RAG)
Extend conversational forms with Retrieval-Augmented Generation (RAG) to ground AI responses in builder-supplied documents. The AI can answer questions using uploaded knowledge bases, guide users through complex forms, and provide accurate, traceable information.
What is RAG?โ
RAG (Retrieval-Augmented Generation) enhances conversational forms by allowing the AI to reference uploaded documents when answering questions. Instead of relying solely on its training data, the AI uses your specific documents to provide accurate, context-aware answers.
Key Featuresโ
Document Uploadโ
Attach knowledge base documents to your conversational forms:
- Supported Formats: PDF, DOCX, TXT
- File Size Limit: Up to 5MB per document
- Multiple Documents: Upload multiple documents per form
- Automatic Processing: Text extraction and intelligent chunking
- Secure Storage: Documents stored in Vercel Blob with private access
Semantic Searchโ
Vector search across document content:
- MongoDB Atlas Vector Search: Efficient semantic document retrieval
- OpenAI Embeddings: Uses text-embedding-3-small for embeddings
- Intelligent Chunking: Sentence-aware chunking preserves context
- Relevance Scoring: Results ranked by semantic similarity
Source Citationsโ
Every AI response includes traceable source references:
- Inline References:
[1],[2]markers in AI responses - Expandable Citations: Click to see full source details
- Document Links: Direct links to source documents
- Confidence Scores: Per-citation confidence levels
- Page References: Specific page numbers when available
Context-Aware Answersโ
AI uses document content to answer user questions accurately:
- Policy References: Quote specific policies and guidelines
- Procedural Guidance: Step-by-step instructions from documents
- Compliance Information: Regulatory requirements from uploaded docs
- Form Completion Help: Guide users using document knowledge
Schema-Aware Suggestionsโ
All AI suggestions respect form validation rules:
- Field Types: Suggestions match expected field types
- Validation Rules: Respects min/max, patterns, required fields
- Format Compliance: Ensures data format matches requirements
Use Casesโ
Compliance Formsโ
Reference policy documents to answer questions:
- Travel Policy: Answer reimbursement questions using policy docs
- HR Policies: Guide employees through policy-related forms
- Regulatory Forms: Reference compliance documents during intake
Example:
User: What's the maximum reimbursement amount?
AI: According to the travel policy document [1], the maximum
reimbursement amount is $500 per day for domestic travel
and $750 per day for international travel. This includes
accommodation, meals, and transportation.
[1] Travel Policy Document, Section 4.2, Page 12
Legal Intakeโ
Use contract templates to guide data collection:
- Contract Review: Reference contract terms during intake
- Legal Forms: Guide clients using legal documentation
- Terms & Conditions: Answer questions about terms
Healthcare Formsโ
Reference medical guidelines during patient intake:
- Clinical Guidelines: Reference treatment protocols
- Medication Information: Use drug reference documents
- Procedure Guides: Guide through medical procedures
Vendor Risk Assessmentโ
Use vendor policies to complete assessments:
- Security Policies: Reference vendor security documentation
- Compliance Requirements: Use compliance checklists
- Risk Evaluation: Guide through risk assessment using policies
Complex Applicationsโ
Guide users through multi-step processes with documentation:
- Grant Applications: Reference grant guidelines
- Research Proposals: Use research protocol documents
- Regulatory Submissions: Guide through regulatory requirements
Document Managementโ
Uploading Documentsโ
-
Navigate to Form Settings:
- Open your conversational form
- Go to Settings > Knowledge Base
-
Upload Documents:
- Click "Upload Document"
- Select PDF, DOCX, or TXT file
- Add metadata (title, description, tags)
- Click "Upload"
-
Processing:
- Document is automatically processed
- Text is extracted and chunked
- Embeddings are generated
- Document is indexed for search
Document Metadataโ
Each document includes:
- Title: Document name
- Description: What the document contains
- Source Type: Policy, Guide, Template, etc.
- Tags: Searchable tags
- Upload Date: When uploaded
- File Size: Document size
- Page Count: Number of pages (for PDFs)
Managing Documentsโ
- View All: See all uploaded documents
- Select for Form: Choose which documents to use
- Edit Metadata: Update title, description, tags
- Delete: Remove documents (requires confirmation)
RAG Configurationโ
Enabling RAGโ
- Upload Documents: Add knowledge base documents
- Enable RAG: Toggle RAG in form settings
- Select Documents: Choose which documents to use
- Configure Retrieval: Set retrieval parameters
Retrieval Configurationโ
{
enabled: true,
documents: ["doc-id-1", "doc-id-2"], // Document IDs to use
retrievalConfig: {
maxChunks: 5, // Maximum chunks to retrieve (default: 5)
minScore: 0.7, // Minimum similarity score (default: 0.7)
retrievalThreshold: 0.5 // Threshold for using retrieved context (default: 0.5)
}
}
Configuration Options:
- maxChunks: Maximum number of document chunks to retrieve per query
- minScore: Minimum similarity score for chunks to be included
- retrievalThreshold: Confidence threshold for using retrieved context
Document Selectionโ
Choose which documents to use for each form:
- All Documents: Use all uploaded documents
- Selected Documents: Choose specific documents
- Tag-Based: Select documents by tags
- Category-Based: Select by document category
How RAG Worksโ
1. Document Processingโ
When you upload a document:
- Text Extraction: Extract text from PDF, DOCX, or TXT
- Chunking: Split into sentence-aware chunks
- Embedding Generation: Create embeddings using OpenAI
- Vector Storage: Store in MongoDB Atlas Vector Search
- Indexing: Index for fast retrieval
2. Query Processingโ
When a user asks a question:
- Query Embedding: Generate embedding for user question
- Vector Search: Search document chunks using MongoDB Atlas Vector Search
- Relevance Scoring: Rank chunks by semantic similarity
- Context Selection: Select top chunks above threshold
- Prompt Enhancement: Inject context into AI prompt
- Response Generation: AI generates answer using context
- Citation Generation: Add source citations to response
3. Response Formatโ
AI responses include:
- Answer: Context-aware response using document content
- Citations: Inline references
[1],[2], etc. - Source Details: Expandable citation section with:
- Document title
- Section/page reference
- Confidence score
- Direct link to document
Source Citation Formatโ
Inline Referencesโ
Citations appear inline in AI responses:
According to the travel policy [1], the maximum reimbursement
is $500 per day. For international travel [2], the limit is
$750 per day.
[1] Travel Policy Document, Section 4.2, Page 12
[2] Travel Policy Document, Section 4.3, Page 13
Citation Detailsโ
Click citations to see full details:
- Document Title: Name of source document
- Section: Section or chapter reference
- Page Number: Specific page (for PDFs)
- Confidence Score: How relevant this source is (0-1)
- Document Link: Direct link to view document
- Chunk Preview: Preview of relevant text chunk
Requirementsโ
RAG features have different requirements depending on your deployment mode. See Deployment Modes for a complete comparison of Cloud vs Self-Hosted deployment.
Cloud Deployment (netpad.io)โ
For the hosted NetPad platform:
| Requirement | Details |
|---|---|
| Subscription | Team or Enterprise plan |
| Infrastructure | MongoDB Atlas M10+ cluster |
| Vector Search | Atlas Vector Search (included with M10+) |
| Embeddings | OpenAI API key required |
Self-Hosted Deploymentโ
For self-hosted NetPad instances:
| Requirement | Details |
|---|---|
| Subscription | Any tier (Free, Pro, Team, Enterprise) |
| Infrastructure | MongoDB Atlas Local (Docker) |
| Vector Search | Included with Atlas Local |
| Embeddings | OpenAI API key required |
Self-Hosted RAG Setup:
# Option 1: Atlas CLI
atlas deployments setup local --type local
# Option 2: Docker
docker run -d -p 27017:27017 mongodb/mongodb-atlas-local
Set the deployment mode in your environment:
NETPAD_DEPLOYMENT_MODE=self-hosted
This enables RAG features for all subscription tiers without requiring an M10 cluster upgrade.
API Keysโ
Required API keys:
- OpenAI API Key: For generating embeddings (text-embedding-3-small)
- MongoDB Atlas: For Vector Search (included with cluster or Atlas Local)
Document Storageโ
Documents are stored in:
- Vercel Blob: Private document storage
- Access Control: Only accessible to form owners
- Encryption: Documents encrypted at rest
Feature Gatesโ
RAG features use a two-tier gating system that varies by deployment mode:
Cloud Mode (netpad.io)โ
- Subscription Tier: Team or Enterprise plan required
- Infrastructure Tier: M10+ MongoDB Atlas cluster required
Both requirements must be met to use RAG features in cloud mode.
Self-Hosted Modeโ
- Subscription Tier: Any tier (including Free)
- Infrastructure Tier: Atlas Local (Docker) or any MongoDB with Vector Search support
Self-hosted mode removes subscription restrictions for RAG features.
Checking Requirementsโ
The form builder will show:
- Subscription Status: Current subscription tier
- Cluster Status: Current Atlas cluster tier (or LOCAL for Atlas Local)
- Deployment Mode: Cloud or Self-Hosted
- Feature Availability: Whether RAG is available
- Upgrade Prompts: How to enable RAG if not available
Best Practicesโ
Document Preparationโ
- Clear Structure: Use well-structured documents
- Relevant Content: Upload only relevant documents
- Good Metadata: Add descriptive titles and descriptions
- Tagging: Use tags to organize documents
- Regular Updates: Keep documents current
Retrieval Configurationโ
- Start Default: Begin with default settings
- Adjust Based on Results: Tune based on response quality
- Monitor Citations: Check citation relevance
- Test Queries: Test with various question types
- Iterate: Refine configuration over time
Form Designโ
- Clear Objectives: Define what documents help with
- User Guidance: Explain that AI can reference documents
- Citation Expectations: Set expectations about citations
- Document Selection: Choose most relevant documents
- Testing: Test with real questions before publishing
Troubleshootingโ
Low-Quality Responsesโ
- Check Documents: Ensure documents are relevant
- Adjust Thresholds: Lower minScore or retrievalThreshold
- More Chunks: Increase maxChunks
- Better Documents: Upload more specific documents
Missing Citationsโ
- Check Relevance: Documents may not be relevant
- Lower Threshold: Reduce minScore threshold
- More Documents: Add more related documents
Slow Responsesโ
- Reduce Chunks: Lower maxChunks
- Cluster Performance: Check Atlas cluster performance
- Document Size: Consider splitting large documents
Next Stepsโ
- Conversational Forms - Create conversational forms
- Template Management - Use templates
- AI Agents - Explore AI capabilities
- Configuration - Configure AI settings