An intelligent document assistant that handles both unstructured text (PDF, TXT, Word, Markdown) via semantic vector search and structured tabular data (CSV, Excel, JSON) via SQL queries. Built with a Python FastAPI backend and React frontend, styled similar to OpenWebUI.
- Document Management: Upload, organize, and manage documents in collections
- Multi-Format Support:
- Text documents: PDF, TXT, Word (.docx), Markdown
- Tabular data: CSV, Excel (.xlsx), JSON
- AI-Powered Chat: Conversational interface with intelligent tool selection
- Vector Search: Semantic search for unstructured text with re-ranking
- SQL Analysis: Query structured data using natural language
- Cross-Document Analysis: Query and compare multiple documents simultaneously
- Bilingual Support: Italian and English responses
- Export & Backup: Export analysis results and create full backups
- Runtime: Python 3.11+
- Framework: FastAPI
- AI: LangChain / LangGraph
- Database: PostgreSQL with pgvector extension
- LLM: OpenAI (GPT-4o, GPT-4o-mini) or Ollama
- Embeddings: OpenAI text-embedding-3-small or Ollama
- Re-ranking: Cohere or Cross-Encoder
- Framework: React 18 with TypeScript
- Styling: Tailwind CSS
- State Management: Zustand + React Query
- UI Style: OpenWebUI-inspired interface
Before you begin, ensure you have the following installed:
- Python 3.11 or higher
- Node.js 18 or higher
- PostgreSQL 15+ with pgvector extension
- OpenAI API key (configurable via UI)
- (Optional) Ollama for local model support
- (Optional) Cohere API key for re-ranking
-
Clone the repository
cd RAG_4 -
Run the setup script
./init.sh
This script will:
- Check prerequisites
- Set up Python virtual environment
- Install backend dependencies
- Install frontend dependencies
- Start both servers
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
-
Configure API keys
- Open Settings from the sidebar
- Enter your OpenAI API key
- (Optional) Enter Cohere API key for re-ranking
- Select your preferred models
RAG_4/
βββ backend/
β βββ api/ # API route handlers
β βββ core/ # Core application logic
β βββ models/ # Database models
β βββ services/ # Business logic services
β βββ utils/ # Utility functions
β βββ main.py # FastAPI entry point
β βββ requirements.txt # Python dependencies
βββ frontend/
β βββ src/
β β βββ components/ # React components
β β βββ pages/ # Page components
β β βββ hooks/ # Custom React hooks
β β βββ services/ # API service functions
β β βββ styles/ # CSS styles
β β βββ utils/ # Utility functions
β βββ public/ # Static assets
β βββ package.json # Node dependencies
βββ prompts/ # AI prompts and configurations
βββ init.sh # Environment setup script
βββ README.md # This file
The application uses PostgreSQL with the pgvector extension. To set up the database:
- Install PostgreSQL 15+
- Install the pgvector extension:
CREATE EXTENSION vector;
- Create a database:
CREATE DATABASE agentic_rag;
- Configure the connection in
backend/.env
cd backend
source venv/bin/activate
uvicorn main:app --reload --port 8000cd frontend
npm run devPOST /api/ingest- Upload and process documentGET /api/documents- List all documentsGET /api/documents/{id}- Get document detailsDELETE /api/documents/{id}- Delete document
POST /api/collections- Create collectionGET /api/collections- List collectionsDELETE /api/collections/{id}- Delete collection
POST /api/chat- Send message and get responseGET /api/conversations- List conversationsGET /api/conversations/{id}- Get conversation
GET /api/settings- Get configurationPATCH /api/settings- Update configuration
MIT License