BeautiRAG is a multimodal Agentic Retrieval-Augmented Generation (RAG) application built with Next.js for the frontend, LangChain framework and FastAPI for the backend. It allows to upload various document types (text, PDF, images, audio), processes them, stores embeddings locally using FAISS, and provides a chat interface to query the documents using large language models (LLMs).
- Frontend: Built with
Next.jsandTailwind CSS- Drag-and-drop document upload (TXT, PDF, DOCX, PNG, JPG, MP3, WAV)
- Chat interface
- Selection and API key input of different LLMs OpenAI, Anthropic, DeepSeek, Ollama (to be integrated)
- Backend: Built with
FastAPIandLangChainframework- Document processing using LangChain loaders.
- OCR for images using
Tesseract. - Transcription for audio using
OpenAI Whisper. - Embedding generation using Sentence Transformers
all-MiniLM-L6-v2(planning to extend to other models). - Vector storage using FAISS (local).
- RAG pipeline implementation using LangChain Expression Language (LCEL).
- API endpoints for file upload, processing, and querying.
- Containerization: Dockerized using
Docker Composefor easy setup and deployment.
rag-app/
├── beautirag-app/
│ ├── public/
│ ├── src/
│ │ ├── app/ # Next.js frontend pages/routing
│ │ ├── components/ # React components
│ │ └── backend/ # FastAPI backend application
│ │ ├── core/ # Core components (config)
│ │ ├── services/ # RAG, processor, vector store
│ │ ├── data/ # Local data storage
│ │ ├── .dockerignore
│ │ ├── Dockerfile # Backend Dockerfile
│ │ └── requirements.txt
│ ├── .dockerignore
│ ├── .env # Will be used for default API key set up
│ ├── Dockerfile # Frontend Dockerfile
│ ├── next.config.ts
│ ├── package.json
│ └── ... # Other frontend config files
├── .gitignore
├── docker-compose.yml
└── README.md
- Docker and Docker Compose (if using Linux)
- An
.envfile in thebeautirag-appdirectory (will be necessary in the future). - System dependencies for backend features:
- Tesseract: For image OCR. Installation varies by OS (Tesseract Wiki).
- FFmpeg: For audio processing by Whisper. Installation varies by OS (FFmpeg Download).
- Note: These are installed automatically within the Docker container. For local development/testing outside Docker, need to install them on the host machine.
git clone <repository-url>
cd rag-appCreate a file named .env inside the beautirag-app directory:
cd beautirag-app
touch .envAdd your API keys and any necessary configurations to this .env file. Example:
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
DEEPSEEK_API_KEY=sk-...
# WHISPER_MODEL_SIZE=small
# EMBEDDING_MODEL_NAME=...
# If Tesseract is not in system PATH for local dev (not needed for Docker)
# TESSERACT_CMD="C:/Program Files/Tesseract-OCR/tesseract.exe"This is the easiest way to run the application with all dependencies included.
From the project root directory (rag-app):
docker compose up --build- The
--buildflag is needed the first time or after code changes. - Wait for both
backendandfrontendservices to start and the backend healthcheck to pass. - Navigate to
http://localhost:3000in the browser
To stop the application:
docker compose downIt is possible to run the frontend and backend separately without Docker:
Backend Setup:
- Navigate to the backend directory:
cd beautirag-app/src/backend - Create a Python virtual environment:
python -m venv .venv .\.venv\Scripts\activate # Windows
- Install dependencies:
pip install -r requirements.txt
- Ensure Tesseract and FFmpeg are installed on your system and accessible
- Ensure the
.envfile exists in thebeautirag-appdirectory - Run the FastAPI server (from the
beautirag-app/srcdirectory):cd .. # Go up to src directory uvicorn backend.main:app --reload --port 8000
Frontend Setup:
- Navigate to the frontend directory:
cd beautirag-app - Install dependencies:
npm install
- Run the Next.js development server:
npm run dev
- Navigate to
http://localhost:3000in the browser
- Upload Documents: Use the "Upload Documents" section to drag and drop or select files.
- Configure Model: Select the desired LLM and enter the API key if required. Click "Validate".
- Chat: Use the chat interface to ask questions about the content of the uploaded documents.
