File size: 2,089 Bytes
a26f084
4ca4b71
fb479cf
 
 
ff1c93a
 
 
a26f084
ff1c93a
fb479cf
a26f084
 
ff1c93a
a26f084
ff1c93a
a26f084
ff1c93a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: RAG Chat Flow
emoji: πŸš€
colorFrom: gray
colorTo: gray
sdk: streamlit
sdk_version: 1.29.0
app_file: app.py
pinned: false
license: mit
short_description: 'RAG-powered document intelligence with vector search and AI '
---

# RAG Chat Flow πŸ“š

An intelligent document Q&A chatbot powered by Retrieval-Augmented Generation (RAG). Upload your documents and ask questions to get accurate, context-aware answers.

## Features

- πŸ” **Smart Document Search**: Uses semantic search to find relevant information
- πŸ€– **AI-Enhanced Answers**: Combines document retrieval with AI processing for natural responses
- πŸ“ **Multi-Document Support**: Upload multiple text files for comprehensive knowledge base
- πŸ’¬ **Chat History**: Persistent chat sessions with automatic saving
- πŸ‘₯ **Multi-User Support**: Real-time user tracking and session management
- 🎯 **Confidence Scoring**: Shows how confident the system is in its answers
- πŸ“Š **Source Attribution**: Always shows which documents answers come from

## How to Use

1. **Upload Documents**: Use the sidebar to upload .txt files containing your knowledge base
2. **Index Documents**: Click "Re-index Documents" to process your files
3. **Ask Questions**: Start chatting! Ask specific questions about your uploaded documents
4. **Get Answers**: Receive both AI-enhanced and extracted answers with source citations

## Technical Details

- **Embedding Model**: all-mpnet-base-v2 for semantic understanding
- **Vector Database**: ChromaDB for efficient similarity search
- **Text Splitting**: Intelligent chunking that preserves context
- **AI Enhancement**: Optional OpenRouter API integration for natural language responses

## Environment Variables

Set `OPENROUTER_API_KEY` for AI-enhanced responses (optional - works without it too).

## Example Use Cases

- Corporate policy documents
- Technical documentation
- Research papers
- Product manuals
- Legal documents
- Knowledge bases

## Setup

The app automatically handles document processing and indexing. Simply upload your text files and start asking questions!