A production-grade AI research assistant built with LangChain ecosystem
🚀 Live Demo • 📖 User Guide • 🔌 API Documentation • 🎮 Interactive Playground
A enterprise-grade research assistant that revolutionizes scientific paper analysis using cutting-edge AI technologies. Built with the complete LangChain ecosystem (LangChain, LangGraph, LangServe, LangSmith), this system provides intelligent document processing, advanced query understanding, and comprehensive research workflows.
- ✅ Production-Ready Architecture with microservices design
- ✅ Advanced RAG Pipeline using LangGraph state machines
- ✅ Real-time API Services with LangServe integration
- ✅ Comprehensive Observability via LangSmith tracing
- ✅ Professional UI/UX with Streamlit components
- ✅ Scalable Deployment on cloud infrastructure
graph TB
subgraph "Frontend Layer"
UI[Streamlit UI]
WEB[Web Interface]
end
subgraph "API Gateway"
MAIN[Main FastAPI]
SERVE[LangServe API]
end
subgraph "AI Processing Layer"
RAG[RAG Workflow]
RESEARCH[Research Workflow]
TOOLS[AI Tools Suite]
end
subgraph "Data Layer"
VECTOR[Vector Store]
DB[Database]
CACHE[Redis Cache]
end
subgraph "External Services"
EURI[Euri LLM API]
SMITH[LangSmith Tracing]
end
UI --> MAIN
WEB --> SERVE
MAIN --> RAG
SERVE --> RESEARCH
RAG --> TOOLS
RESEARCH --> TOOLS
TOOLS --> VECTOR
TOOLS --> DB
TOOLS --> CACHE
TOOLS --> EURI
MAIN --> SMITH
SERVE --> SMITH
graph LR
subgraph "RAG Workflow"
A[Query Input] --> B[Query Enhancement]
B --> C[Intent Classification]
C --> D[Document Retrieval]
D --> E[Context Ranking]
E --> F[Response Generation]
F --> G[Citation Extraction]
end
subgraph "Research Workflow"
H[Research Query] --> I[Literature Analysis]
I --> J[Methodology Review]
J --> K[Citation Processing]
K --> L[Summary Generation]
L --> M[Report Compilation]
end
graph TB
subgraph "Client Applications"
BROWSER[Web Browser]
API_CLIENT[API Clients]
end
subgraph "Load Balancer"
LB[Render Load Balancer]
end
subgraph "Backend Services"
BACKEND[Backend Service<br/>Port: 8000]
LANGSERVE[LangServe Service<br/>Port: 8001]
end
subgraph "AI Processing"
QUERY_PROC[Query Processor]
SUMMARIZER[Summarization Tool]
CITATION[Citation Extractor]
EMBEDDING[Embedding Tool]
end
subgraph "External APIs"
EURI_API[Euri LLM API]
LANGSMITH_API[LangSmith API]
end
BROWSER --> LB
API_CLIENT --> LB
LB --> BACKEND
LB --> LANGSERVE
BACKEND --> QUERY_PROC
BACKEND --> SUMMARIZER
LANGSERVE --> CITATION
LANGSERVE --> EMBEDDING
QUERY_PROC --> EURI_API
SUMMARIZER --> EURI_API
BACKEND --> LANGSMITH_API
LANGSERVE --> LANGSMITH_API
- Retrieval-Augmented Generation (RAG) with LangGraph state machines
- Multi-step Research Workflows for comprehensive analysis
- Intelligent Query Enhancement with intent classification
- Context-Aware Response Generation with citation support
- Real-time Document Processing with multiple format support
- FastAPI Backend with async processing and comprehensive error handling
- LangServe Integration with interactive API playgrounds
- RESTful Endpoints with OpenAPI documentation
- Health Monitoring with detailed system diagnostics
- Rate Limiting & Security with CORS and authentication support
- Streamlit Frontend with modern, responsive design
- Real-time Query Processing with progress indicators
- Interactive Document Upload with drag-and-drop support
- Query History & Analytics with performance metrics
- Export Capabilities for research results and citations
- LangSmith Tracing for complete workflow visibility
- Performance Metrics with latency and token usage tracking
- Error Monitoring with detailed logging and alerting
- Health Checks for all system components
- Debug Tools for development and troubleshooting
| Component | Technology | Version | Purpose |
|---|---|---|---|
| Backend | FastAPI | 0.104+ | High-performance async API |
| Frontend | Streamlit | 1.28+ | Interactive web interface |
| AI Framework | LangChain | 0.1+ | AI application orchestration |
| Workflow Engine | LangGraph | 0.0.20+ | Complex AI workflows |
| API Serving | LangServe | 0.0.30+ | Production API deployment |
| Observability | LangSmith | 0.0.69+ | Tracing and monitoring |
| Component | Technology | Purpose |
|---|---|---|
| LLM Provider | Euri API | Primary language model |
| Embeddings | Sentence Transformers | Document vectorization |
| Vector Store | Pinecone (Optional) | Similarity search |
| Document Processing | PyPDF, python-docx | Multi-format support |
| Component | Technology | Purpose |
|---|---|---|
| Database | PostgreSQL | Persistent data storage |
| Caching | Redis | Performance optimization |
| Deployment | Render | Cloud hosting platform |
| Containerization | Docker | Consistent environments |
- Python 3.8+
- Git
- Modern web browser
git clone https://github.com/erickyegon/AI-Powered-Research-Assistant-for-Scientific-Papers.git
cd "AI-Powered Research Assistant for Scientific Papers"
# Create virtual environment
python -m venv research_env
source research_env/bin/activate # Windows: research_env\Scripts\activate
# Install dependencies
pip install -r backend/requirements.txt
pip install -r frontend/requirements.txt# Copy environment template
cp .env.example .env
# Edit .env with your API keys
EURI_API_KEY=your_euri_api_key_here
LANGSMITH_API_KEY=your_langsmith_api_key_here# Terminal 1: Backend API
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
# Terminal 2: LangServe API
uvicorn backend.langserve_app:app --reload --host 0.0.0.0 --port 8001
# Terminal 3: Frontend
streamlit run frontend/app.py- Frontend UI: http://localhost:8501
- Backend API: http://localhost:8000/docs
- LangServe API: http://localhost:8001/docs
- Health Check: http://localhost:8000/health
| Endpoint | Method | Description |
|---|---|---|
/api/query |
POST | Process research queries with RAG |
/api/summarize |
POST | Generate document summaries |
/api/test |
POST | Test API connectivity |
/health |
GET | System health status |
/api/config |
GET | Current configuration |
| Endpoint | Method | Description |
|---|---|---|
/research |
POST | Research workflow execution |
/chat |
POST | Simple chat interface |
/summarize |
POST | Document summarization |
/research/playground |
GET | Interactive research playground |
import requests
# Query processing
response = requests.post("http://localhost:8000/api/query", json={
"query": "What are the latest developments in machine learning?",
"include_enhancement": True,
"max_results": 5
})
# Document summarization
response = requests.post("http://localhost:8000/api/summarize", json={
"text": "Your research paper content here...",
"summary_type": "detailed"
})AI-Powered Research Assistant/
├── 📁 backend/ # Backend services
│ ├── 📄 main.py # Main FastAPI application
│ ├── 📄 langserve_app.py # LangServe API server
│ ├── 📄 production_server.py # Production-optimized server
│ ├── 📁 graphs/ # LangGraph workflows
│ │ ├── 📄 rag_workflow.py # RAG pipeline implementation
│ │ └── 📄 research_workflow.py # Research analysis workflow
│ ├── 📁 tools/ # AI tools and utilities
│ │ ├── 📄 query_processor.py # Query enhancement & classification
│ │ ├── 📄 summarization_tool.py # Document summarization
│ │ ├── 📄 citation_extractor.py # Citation processing
│ │ └── 📄 embedding_tool.py # Document embeddings
│ ├── 📁 utils/ # Core utilities
│ │ └── 📄 eur_client.py # Euri API client
│ └── 📄 requirements.txt # Backend dependencies
├── 📁 frontend/ # Frontend application
│ ├── 📄 app.py # Streamlit interface
│ └── 📄 requirements.txt # Frontend dependencies
├── 📁 deployment/ # Deployment configurations
│ ├── 📄 render.yaml # Render deployment config
│ ├── 📄 Dockerfile.backend # Backend container
│ ├── 📄 Dockerfile.frontend # Frontend container
│ └── 📄 docker-compose.yml # Local development
├── 📄 .env.example # Environment template
├── 📄 .gitignore # Git ignore rules
├── 📄 deploy.md # Deployment guide
└── 📄 README.md # Project documentation
- Access the Application: Visit Live Demo
- Upload Documents: Drag and drop PDF research papers or paste text
- Ask Questions: Enter research queries in natural language
- Get Results: Receive AI-powered answers with citations and sources
- Export Results: Download summaries and citations in various formats
- API Documentation: Interactive API Docs
- Health Monitoring: System Health
- Configuration: Current Config
- Test Endpoint: API Test
import requests
# Process a research query
response = requests.post(
"https://ai-research-assistant-backend.onrender.com/api/query",
json={
"query": "What are the latest developments in transformer architectures?",
"include_enhancement": True,
"max_results": 5
}
)
result = response.json()
print(f"Response: {result['response']}")
print(f"Enhanced Query: {result['enhanced_query']}")# Summarize research content
response = requests.post(
"https://ai-research-assistant-backend.onrender.com/api/summarize",
json={
"text": "Your research paper content here...",
"summary_type": "detailed" # Options: brief, detailed, bullet_points
}
)
summary = response.json()
print(f"Summary: {summary['summary']}")
print(f"Compression Ratio: {summary['original_length']}/{summary['summary_length']}")# Check system health
response = requests.get("https://ai-research-assistant-backend.onrender.com/health")
health = response.json()
print(f"Status: {health['status']}")
print(f"Components: {health['components']}")- URL: https://ai-research-assistant-backend.onrender.com/docs
- Features:
- Try all API endpoints directly in browser
- See request/response schemas
- Test with your own data
- Download OpenAPI specification
- ReDoc: https://ai-research-assistant-backend.onrender.com/redoc
- OpenAPI JSON: https://ai-research-assistant-backend.onrender.com/openapi.json
# Check overall system health
curl https://ai-research-assistant-backend.onrender.com/health
# Expected Response:
{
"status": "healthy",
"version": "production-1.0.0",
"startup_complete": true,
"components": {
"euri_available": true,
"euri_configured": true,
"langsmith_configured": true,
"llm_initialized": true
},
"environment": "production"
}# View current configuration (non-sensitive data only)
curl https://ai-research-assistant-backend.onrender.com/api/config
# Expected Response:
{
"euri": {
"api_key_configured": true,
"model": "gpt-4.1-nano",
"temperature": "0.7",
"max_tokens": "2000"
},
"app": {
"environment": "production",
"debug": "false",
"version": "1.0.0"
}
}import requests
headers = {
"Content-Type": "application/json",
"User-Agent": "Research-Assistant-Client/1.0"
}
# Query with custom headers
response = requests.post(
"https://ai-research-assistant-backend.onrender.com/api/query",
headers=headers,
json={"query": "Explain quantum computing applications"}
)import requests
from requests.exceptions import RequestException
try:
response = requests.post(
"https://ai-research-assistant-backend.onrender.com/api/query",
json={"query": "Your research question"},
timeout=30
)
response.raise_for_status()
result = response.json()
print(result['response'])
except RequestException as e:
print(f"API request failed: {e}")
except KeyError as e:
print(f"Unexpected response format: {e}")const axios = require('axios');
async function queryResearchAssistant(question) {
try {
const response = await axios.post(
'https://ai-research-assistant-backend.onrender.com/api/query',
{
query: question,
include_enhancement: true
}
);
return response.data;
} catch (error) {
console.error('Query failed:', error.message);
throw error;
}
}
// Usage
queryResearchAssistant("What is machine learning?")
.then(result => console.log(result.response))
.catch(error => console.error(error));# Basic query
curl -X POST "https://ai-research-assistant-backend.onrender.com/api/query" \
-H "Content-Type: application/json" \
-d '{"query": "Explain neural networks", "include_enhancement": true}'
# Summarization
curl -X POST "https://ai-research-assistant-backend.onrender.com/api/summarize" \
-H "Content-Type: application/json" \
-d '{"text": "Your text here", "summary_type": "brief"}'
# Health check
curl "https://ai-research-assistant-backend.onrender.com/health"- Limit: 60 requests per minute per IP
- Burst: Up to 10 concurrent requests
- Headers: Check
X-RateLimit-*headers in responses
- Implement retry logic with exponential backoff
- Cache responses when appropriate
- Use appropriate timeouts (30-60 seconds for complex queries)
- Handle errors gracefully with user-friendly messages
- Monitor API health before making requests
| Code | Meaning | Action |
|---|---|---|
| 200 | Success | Process response |
| 400 | Bad Request | Check request format |
| 429 | Rate Limited | Wait and retry |
| 500 | Server Error | Retry with backoff |
| 503 | Service Unavailable | Check system health |
# Backend tests
pytest backend/tests/ -v --cov=backend
# Frontend tests
pytest frontend/tests/ -v
# Integration tests
pytest tests/integration/ -v# Format code
black backend/ frontend/
isort backend/ frontend/
# Type checking
mypy backend/
# Linting
flake8 backend/ frontend/# Debug mode
python debug_imports.py
# System test
python test_complete_system.py
# Health check
curl http://localhost:8000/health-
Backend Service:
- Build Command:
pip install -r backend/requirements.txt - Start Command:
python backend/production_server.py - Environment: Production environment variables
- Build Command:
-
Frontend Service:
- Build Command:
pip install -r frontend/requirements.txt - Start Command:
streamlit run frontend/app.py --server.port $PORT - Environment: Backend URL configuration
- Build Command:
# Build and run with Docker Compose
docker-compose up --build
# Individual services
docker build -t research-backend -f Dockerfile.backend .
docker build -t research-frontend -f Dockerfile.frontend .# Production Configuration
EURI_API_KEY=your_production_euri_key
LANGSMITH_API_KEY=your_langsmith_key
ENVIRONMENT=production
DEBUG=false
LOG_LEVEL=INFO- Complete Tracing: Every LLM call and workflow step
- Performance Metrics: Latency, token usage, cost tracking
- Error Monitoring: Detailed error logs and stack traces
- Evaluation Tools: Query quality and response accuracy
- Response Time: < 2s for typical queries
- Throughput: 100+ concurrent requests
- Availability: 99.9% uptime with health monitoring
- Scalability: Auto-scaling based on demand
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Make changes with tests
- Run quality checks:
black,isort,mypy,pytest - Submit pull request
- Python: PEP 8 compliance with type hints
- Documentation: Comprehensive docstrings
- Testing: 90%+ code coverage
- Security: No hardcoded secrets or credentials
This project is licensed under the MIT License - see the LICENSE file for details.
- LangChain Team for the revolutionary AI framework
- Streamlit for the intuitive UI framework
- FastAPI for high-performance web APIs
- Render for seamless cloud deployment
- Euri for providing advanced LLM capabilities
🚀 Built with cutting-edge AI technologies
LangChain • LangServe • LangGraph • LangSmith
⭐ Star this repository if you found it helpful!
- User Guide - Complete guide for end users
- Getting Started - Quick setup instructions
- Features Overview - Detailed feature descriptions
- API Documentation - Complete API reference
- Interactive API Docs - Live API playground
- OpenAPI Specification - Machine-readable API spec
- Deployment Guide - Step-by-step deployment instructions
- Environment Configuration - Required environment variables
- Docker Setup - Container deployment
- Project Structure - Codebase organization
- Development Setup - Local development guide
- Contributing Guidelines - How to contribute
- System Health - Live system status
- Configuration - Current system config
- GitHub Issues - Bug reports and feature requests