A production-ready end-to-end AI SaaS platform that allows users to query financial, technical, and business documents with AI-powered insights using LangGraph agent orchestration.
- LangGraph Agent Workflow: Multi-step agentic LLM behavior with query parsing, retrieval, analysis, summary, and evaluation
- OpenAI Integration: Powered by GPT-4o for reasoning and text-embedding-ada-002 for embeddings
- Vector Search: FAISS-based document embedding and similarity search
- Modern Frontend: Next.js 14 with Tailwind CSS and shadcn/ui components
- Document Processing: Support for PDF, TXT, and DOCX files
- Real-time Evaluation: LLM-as-a-judge scoring for answer quality
- Production Ready: Docker containerization and CI/CD pipeline
- Analytics: Query history, performance metrics, and evaluation scores
- MCP Server: Model Context Protocol integration for AI assistants
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend β β Vector Store β
β (Next.js) ββββββ (FastAPI) ββββββ (FAISS) β
β - Query UI β β - LangGraph β β - Embeddings β
β - Upload β β - Agents β β - Similarity β
β - Analytics β β - Evaluation β β - Retrieval β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βββββββββββββββββββ
β MCP Server β
β (Protocol) β
β - Tools β
β - Integration β
β - AI Assistantβ
βββββββββββββββββββ
- Query Parser Agent: Extracts intent, entities, and query type
- Retriever Agent: Searches FAISS vector store for relevant documents
- Analysis Agent: Performs reasoning over retrieved content using GPT-4o
- Summary Agent: Creates final answer with citations and key points
- Evaluation Agent: Scores output quality using LLM-as-a-judge
- FastAPI: Modern Python web framework
- LangGraph: Agent workflow orchestration
- FAISS: Vector similarity search
- OpenAI: GPT-4o and text-embedding-ada-002
- SQLAlchemy: Database ORM
- PostgreSQL: Production database
- Redis: Caching and session storage
- Next.js 14: React framework with App Router
- Tailwind CSS: Utility-first CSS framework
- shadcn/ui: Modern UI components
- Framer Motion: Animation library
- SWR: Data fetching and caching
- TypeScript: Type safety
- Docker: Containerization
- GitHub Actions: CI/CD pipeline
- Vercel: Frontend deployment
- Fly.io: Backend deployment
- Docker and Docker Compose
- Node.js 18+
- Python 3.11+
- OpenAI API key
- Clone the repository
git clone https://github.com/your-username/insightbot.git
cd insightbot- Set up environment variables
cp .env.example .env
# Edit .env with your OpenAI API key- Start the services
docker-compose up -d- Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reloadcd frontend
npm install
npm run devCreate a .env file in the root directory:
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/insightbot
# Application Configuration
BACKEND_URL=http://localhost:8000
FRONTEND_URL=http://localhost:3000
# File Upload Configuration
UPLOAD_DIR=./uploads
MAX_FILE_SIZE=10485760 # 10MB
# FAISS Configuration
FAISS_INDEX_PATH=./faiss_index
EMBEDDING_MODEL=text-embedding-ada-002
# Evaluation Configuration
EVALUATION_MODEL=gpt-4o-mini
EVALUATION_THRESHOLD=3.0
# Security
SECRET_KEY=your_secret_key_here
CORS_ORIGINS=http://localhost:3000POST /api/query
Content-Type: application/json
{
"query": "Compare Tesla and NVIDIA performance in 2023",
"session_id": "optional-session-id"
}POST /api/upload
Content-Type: multipart/form-data
file: <PDF/TXT/DOCX file>GET /api/queries?page=1&page_size=10&session_id=optionalPOST /api/eval
Content-Type: application/json
{
"query_id": "query-uuid"
}{
"query": "User's question",
"answer": "AI-generated answer with citations",
"sources": [
{
"content": "Relevant text snippet",
"filename": "document.pdf",
"page": 1,
"relevance_score": 0.95
}
],
"evaluation": {
"score": 4.2,
"rationale": "Well-structured answer with good sources",
"criteria": {
"accuracy": 4.5,
"completeness": 4.0,
"relevance": 4.3,
"clarity": 4.1,
"coherence": 4.2
}
},
"session_id": "session-uuid",
"timestamp": "2024-01-15T10:30:00Z"
}cd backend
pytest tests/ -vcd frontend
npm testdocker-compose -f docker-compose.test.yml up --build- Build and push images
docker build -f docker/Dockerfile.backend -t insightbot-backend .
docker build -f docker/Dockerfile.frontend -t insightbot-frontend .- Deploy with Docker Compose
docker-compose -f docker-compose.prod.yml up -dcd frontend
vercel --prodfly deploy -f fly.tomlUse the provided docker-compose.yml with AWS ECS CLI or create ECS task definitions.
- Query volume and patterns
- Response evaluation scores
- Document processing statistics
- Agent execution times
- Error rates and types
- Backend:
GET /health - Database: Connection status
- Vector Store: Index status
- OpenAI: API connectivity
- API Keys: Securely stored in environment variables
- File Uploads: Type and size validation
- CORS: Configured for specific origins
- Rate Limiting: Implemented for API endpoints
- Input Validation: Pydantic models for request validation
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit changes:
git commit -m 'Add your feature' - Push to branch:
git push origin feature/your-feature - Submit a pull request
- Backend: Black formatting, Ruff linting
- Frontend: Prettier formatting, ESLint
- Commits: Conventional commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check the
/docsendpoint for API documentation - Issues: Create an issue on GitHub
- Discord: Join our Discord community
- Multi-user authentication with Supabase
- Real-time chat interface
- Advanced analytics dashboard
- Mobile app support
- Enterprise features (SSO, audit logs)
- Multi-language support
- Advanced evaluation metrics
- Query Response: < 5 seconds average
- File Processing: < 30 seconds for 10MB documents
- Concurrent Users: 100+ supported
- Uptime: 99.9% target
InsightBot includes a Model Context Protocol (MCP) server for seamless integration with AI assistants like Claude Code.
# Start MCP server with Docker
docker-compose up mcp-server
# Or run locally
python -m mcp_server.main- query_documents: Query documents using AI workflow
- upload_document: Upload and process documents
- get_document_stats: Get collection statistics
- search_similar_documents: Find similar documents
- get_query_history: Retrieve query history
- evaluate_response: Evaluate response quality
Add to your ~/.claude-code/settings.json:
{
"mcpServers": {
"insightbot": {
"command": "python",
"args": ["-m", "mcp_server.main"],
"cwd": "/path/to/insightbot/backend",
"env": {
"OPENAI_API_KEY": "your-api-key"
}
}
}
}For detailed MCP integration guide, see MCP_INTEGRATION.md.
Built with β€οΈ by the InsightBot team. Powered by OpenAI, LangGraph, and modern web technologies.