A comprehensive academic research pipeline system that automates literature review, thematic analysis, and report generation using multi-agent AI orchestration.
This project consists of two main components:
- Backend (
api/): FastAPI-based REST API with multi-agent research pipeline - Frontend (
client/): React + TypeScript + Vite web application
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Local Development
- Docker Deployment
- API Documentation
- Configuration
- Environment Variables
- Usage
- Multi-Agent Pipeline: Orchestrates multiple AI agents for research tasks
- Document Retrieval Agent
- Literature Review Agent
- Initial Coding Agent
- Thematic Grouping Agent
- Theme Refinement Agent
- Report Generator Agent
- Supervisor Agent (quality control)
- Smart Retrieval System: Advanced RAG (Retrieval-Augmented Generation)
- Cross-encoder reranking for accuracy
- Adaptive threshold filtering
- Paper-level diversification
- Quality metrics (quantity, certainty, recency)
- Format Transformation: LLM-powered report format conversion
- PPTX (PowerPoint) with customizable themes
- HTML, PDF, DOCX, Markdown, Text, JSON
- Vector Database Integration: Weaviate/Chroma for document storage
- Multi-Source Data Extraction: Supports arXiv, CORE, Europe PMC, and more
- Interactive Pipeline Interface: Start and monitor research pipelines
- Report Preview & Export: Real-time preview with multiple format options
- Template System: Multiple report templates (Academic, Executive Summary, Slide Deck)
- Theme Customization: 8+ PowerPoint themes for presentations
- Tabbed Interface: Organized view of Preview, JSON Output, and Export options
- Responsive Design: Modern, dark-themed UI
- Framework: FastAPI 0.128.0
- Python: 3.12+
- AI/ML:
- OpenAI GPT (via LangChain)
- Sentence Transformers (cross-encoder reranking)
- LangChain Core
- Vector Database: Weaviate Client 4.19.0
- PDF Processing: PyMuPDF, pdfplumber, pdf2image
- Server: Uvicorn with ASGI
- Framework: React 18.3.1
- Language: TypeScript 5.4.0
- Build Tool: Vite 5.0.0
- Export Libraries:
- jsPDF (PDF generation)
- docx (Word documents)
- pptxgenjs (PowerPoint presentations)
- Routing: React Router DOM 6.30.3
ai_researcher/
βββ api/ # Backend FastAPI application
β βββ agents/ # AI agent implementations
β β βββ data_extractor_agent.py
β β βββ literature_review_agent.py
β β βββ initial_coding_agent.py
β β βββ thematic_grouping_agent.py
β β βββ theme_refiner_agent.py
β β βββ report_generator_agent.py
β β βββ format_transformation_agent.py
β β βββ supervisor_agent.py
β βββ routes/ # API route handlers
β β βββ pipeline_routes.py # Pipeline management
β β βββ agent_routes.py # Individual agent execution
β β βββ data_routes.py # Data management
β β βββ report_routes.py # Report generation & export
β βββ services/ # Business logic services
β β βββ pipeline_service.py
β β βββ smart_retrieval_service.py
β β βββ retrieval_quality.py
β β βββ report_service.py
β βββ models/ # Pydantic models
β β βββ requests.py
β β βββ responses.py
β β βββ format_models.py
β βββ utils/ # Utility modules
β β βββ llm_backends.py
β β βββ vector_store_manager.py
β β βββ reranking.py
β βββ app.py # FastAPI application entry point
β βββ requirements.txt # Python dependencies
β
βββ client/ # Frontend React application
β βββ src/
β β βββ components/ # React components
β β β βββ PipelineForm.tsx
β β β βββ ResponsePanel.tsx
β β β βββ ReportExportPanel.tsx
β β β βββ ...
β β βββ api/ # API client
β β β βββ client.ts
β β βββ utils/ # Utility functions
β β β βββ report.ts
β β β βββ reportExporters.ts
β β βββ config/ # Configuration
β β β βββ reportTemplates.ts
β β β βββ pptxThemes.ts
β β βββ App.tsx # Main app component
β β βββ main.tsx # Entry point
β βββ package.json
β βββ vite.config.ts
β
βββ doc/ # Documentation
β βββ BACKEND_DOCUMENTATION.md
β
βββ Dockerfile # Docker build configuration
βββ README.md # This file
- Python: 3.12 or higher
- Node.js: 20.x or higher
- npm: Comes with Node.js
- Vector Database: Weaviate instance (local or cloud)
- OpenAI API Key: For LLM operations
- Docker: 20.10+
- Docker Compose: (optional, for multi-container setups)
-
Navigate to the API directory:
cd ai_researcher/api -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in theapi/directory:OPENAI_API_KEY=your_openai_api_key_here WEAVIATE_URL=http://localhost:8080 WEAVIATE_API_KEY=your_weaviate_key_if_needed
-
Run the backend server:
# From api/ directory uvicorn app:app --reload --host 0.0.0.0 --port 8000 # Or from project root uvicorn api.app:app --reload --host 0.0.0.0 --port 8000
The API will be available at
http://localhost:8000- API Docs:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
- API Docs:
-
Navigate to the client directory:
cd ai_researcher/client -
Install dependencies:
npm install
-
Run the development server:
npm run dev
The frontend will be available at
http://localhost:5173The Vite dev server is configured to proxy
/apirequests tohttp://localhost:8000
In separate terminals:
Terminal 1 - Backend:
cd ai_researcher/api
source venv/bin/activate
uvicorn app:app --reload --port 8000Terminal 2 - Frontend:
cd ai_researcher/client
npm run devFrom the ai_researcher/ directory:
docker build -t ai-researcher:latest .docker run -p 8000:8000 \
-e OPENAI_API_KEY=your_key_here \
-e WEAVIATE_URL=http://your-weaviate:8080 \
-e VITE_API_BASE_URL=/api/v1 \
ai-researcher:latestThe application will be available at http://localhost:8000
Create a docker-compose.yml:
version: '3.8'
services:
ai-researcher:
build: .
ports:
- "8000:8000"
environment:
- OPENAI_API_KEY=${OPENAI_API_KEY}
- WEAVIATE_URL=${WEAVIATE_URL}
- VITE_API_BASE_URL=/api/v1
volumes:
- ./reports:/app/api/reportsRun with:
docker-compose up -dPOST /api/v1/pipelines/full- Start full thematic pipelinePOST /api/v1/pipelines/lite- Start lite pipeline (faster)GET /api/v1/pipelines/{pipeline_id}- Get pipeline resultsDELETE /api/v1/pipelines/{pipeline_id}- Delete pipeline
POST /api/v1/reports/transform- Transform report to different formatGET /api/v1/reports/{report_id}- Get report detailsGET /api/v1/reports/{report_id}/download- Download report
POST /api/v1/data/retrieve- Retrieve documents from vector storePOST /api/v1/data/store- Store documents in vector store
GET /health- Health check endpoint
When running the backend, visit:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Key configuration files:
api/app.py- Main FastAPI applicationapi/services/pipeline_service.py- Pipeline orchestrationapi/services/smart_retrieval_service.py- RAG retrieval logic
client/vite.config.ts- Vite build configurationclient/src/api/client.ts- API client configurationclient/src/config/reportTemplates.ts- Report template definitionsclient/src/config/pptxThemes.ts- PowerPoint theme definitions
# OpenAI API
OPENAI_API_KEY=sk-...
# Vector Database
WEAVIATE_URL=http://localhost:8080
WEAVIATE_API_KEY=optional_api_key
# Optional: Custom API base URL for frontend
VITE_API_BASE_URL=/api/v1Set during Docker build or in .env:
VITE_API_BASE_URL=/api/v1-
Via Frontend UI:
- Navigate to
http://localhost:5173 - Fill in the research query and domain
- Choose between Lite or Full pipeline
- Click "Start Pipeline"
- Monitor progress and view results
- Navigate to
-
Via API:
curl -X POST "http://localhost:8000/api/v1/pipelines/lite" \ -H "Content-Type: application/json" \ -d '{ "query": "blockchain technology applications", "research_domain": "blockchain", "max_results": 20, "sources": ["arxiv", "core"] }'
-
Via Frontend:
- After pipeline completes, navigate to Export tab
- Choose template and format (PDF, PPTX, HTML, DOCX, etc.)
- Select PowerPoint theme if exporting PPTX
- Click "Export" to download
-
Via API:
curl -X POST "http://localhost:8000/api/v1/reports/transform" \ -H "Content-Type: application/json" \ -d '{ "report": {...}, "targetFormat": "pptx" }'
- Steps: Document Retrieval β Literature Review β Report Generation
- Use Case: Quick research summaries
- Duration: ~30-60 seconds
- Steps: Document Retrieval β Literature Review β Initial Coding β Thematic Grouping β Theme Refinement β Report Generation
- Use Case: In-depth thematic analysis
- Duration: ~2-5 minutes
cd ai_researcher/api
pytest tests/cd ai_researcher/client
npm test- Backend Documentation: See
doc/BACKEND_DOCUMENTATION.mdfor detailed API and RAG implementation docs - API Specifications: See
specs/directory for detailed specifications
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - see LICENSE file for details
For issues and questions:
- Check the documentation in
doc/directory - Review API docs at
/docsendpoint - Open an issue on GitHub
- Enhanced report templates
- Additional export formats
- Real-time collaboration features
- Advanced analytics dashboard
- Multi-language support
Built with β€οΈ for academic researchers