A powerful RAG (Retrieval Augmented Generation) chatbot with conversational booking capabilities, built with FastAPI, Streamlit, and Google AI.
- Multi-format Support: Upload PDF and TXT documents
- Intelligent Chunking: Smart document segmentation with metadata preservation
- Vector Search: Semantic search using Google's text-embedding-004
- Citation Tracking: Source attribution with page numbers and snippets
- Conversational Memory: Context-aware follow-up questions
- Natural Language Processing: Book calls through natural conversation
- Flexible Information Collection: Collect name, phone, email, and date/time at any point
- Smart Date Parsing: Understand "tomorrow", "next Monday at 3pm", etc.
- Google Calendar Integration: Automatic calendar event creation
- Booking Persistence: Save and track all bookings
- Intent Detection: Automatically detect booking vs. document queries
- Basic Conversation: Handle greetings, gratitude, and casual chat
- Real-time Chat Interface: Modern Streamlit UI with conversation history
- Document Management: Upload, clear, and track document status
- Debug Tools: Built-in testing and verification tools
SmartDocs Assistant -monorepo/
βββ apps/
β βββ api/ # FastAPI backend
β β βββ main.py # API entry point
β β βββ routers/ # API endpoints
β β βββ models/ # Request/response models
β βββ frontend/ # Streamlit frontend
β βββ streamlit_app.py # Chat interface
βββ packages/
β βββ rag/ # RAG system
β β βββ ingestion/ # Document processing
β β βββ retrieval/ # Vector search
β β βββ chains/ # QA chains
β βββ agents/ # Booking agent
β β βββ booking_agent.py # Main agent logic
β β βββ state.py # Conversation state
β β βββ tools/ # Agent tools
β βββ shared/ # Shared utilities
βββ data/ # Document storage
βββ tests/ # Test suite
βββ docs/ # Documentation
- FastAPI: High-performance API framework
- Qdrant: Vector database for embeddings
- Google AI: Gemini-1.5-flash for LLM, text-embedding-004 for embeddings
- LangChain: LLM orchestration and prompt management
- Streamlit: Interactive web interface
- Chat Interface: Real-time conversation with message history
- pypdf: PDF parsing and text extraction
- RecursiveCharacterTextSplitter: Intelligent text chunking
- UUID5: Stable chunk identification
- Google Calendar API: Real calendar event creation
- Pydantic: Data validation and serialization
- JSON Storage: Local booking persistence
- Python 3.12+
- Google AI API key
- Qdrant vector database
- Google Calendar API (for booking feature)
git clone <repository-url>
cd SmartDocs Assistant -monorepo
uv syncCreate .env file:
# Google AI
GOOGLE_API_KEY=your_google_api_key
GOOGLE_LLM_MODEL=gemini-1.5-flash
GOOGLE_EMBEDDING_MODEL=text-embedding-004
# Qdrant
QDRANT_URL=http://localhost:6333
QDRANT_COLLECTION=smartdocs
# Google Calendar (for booking feature)
GOOGLE_CALENDAR_CREDENTIALS_FILE=path/to/credentials.json
GOOGLE_CALENDAR_TOKEN_FILE=path/to/token.json# Start Qdrant (Docker)
docker run -p 6333:6333 qdrant/qdrant
# Start FastAPI backend
uv run python apps/api/main.py
# Start Streamlit frontend
uv run streamlit run apps/frontend/streamlit_app.py- Frontend: http://localhost:8501
- API Docs: http://localhost:8000/docs
-
Upload Documents
- Navigate to the upload section
- Select PDF or TXT files
- Click "Upload" to ingest documents
-
Ask Questions
- Use the chat interface to ask questions
- Get answers with source citations
- View confidence scores and source snippets
-
Start Booking
- Say "I'd like to book a call" or similar
- Provide information naturally: "My name is John, email is john@example.com"
-
Flexible Information Collection
- Provide details in any order
- Use natural language: "tomorrow at 3pm"
- Agent will collect missing information
-
Confirmation
- Review booking details
- Calendar event is automatically created
- Receive booking ID and meeting link
- Upload: Add new documents to the knowledge base
- Clear: Remove all documents from the system
- Status: View current document count in sidebar
POST /upload- Upload and ingest documentsDELETE /upload/clear- Clear all documentsGET /upload/status- Get document status
POST /chat- Main chat endpoint (RAG + Booking)GET /search- Raw vector searchGET /chat/bookings- Get all bookings
{
"answer": "Response text",
"confidence": 0.95,
"citations": [
{
"page": 1,
"snippet": "Relevant text snippet...",
"filename": "document.pdf"
}
],
"intent": "rag|booking|booking_complete",
"booking_state": {...}
}- Chunking: ~1000 characters per chunk with overlap
- Embedding: Google's text-embedding-004 (768 dimensions)
- Search: Top-K retrieval with configurable K (default: 6)
- RAG Queries: 2-5 seconds (embedding + retrieval + generation)
- Booking Agent: 1-3 seconds (intent detection + state management)
- Document Upload: 10-30 seconds (parsing + chunking + embedding)
βββ apps/ # Application layer
βββ packages/ # Core packages
βββ data/ # Data storage
βββ docs/ # Documentation
βββ scripts/ # Utility scripts
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request


