An AI-powered research paper generation and analysis tool that autonomously searches academic papers, synthesizes research findings, and generates new research papers with LaTeX formatting.
ScholarSynth is an intelligent research assistant built with LangChain and LangGraph that leverages state-of-the-art LLMs to:
- Search arXiv for recent papers on any academic topic
- Extract and analyze PDF content from research papers
- Synthesize research findings and identify new research directions
- Generate original research papers with mathematical equations
- Render papers as professional LaTeX PDFs
This tool is designed for researchers, academics, and anyone interested in exploring cutting-edge research in physics, mathematics, computer science, quantitative biology, quantitative finance, statistics, electrical engineering, systems science, and economics.
- 🔍 Intelligent Paper Search: Search arXiv.org for recent papers with configurable result limits
- 📄 PDF Analysis: Automatically extract and process text from research paper PDFs
- 🤖 AI-Powered Research Agent: Uses ReAct (Reasoning + Acting) agent pattern with multi-step reasoning
- 📝 LaTeX Paper Generation: Generate mathematically rigorous papers with equations and proper formatting
- 📊 PDF Rendering: Compile LaTeX to professional PDF documents using Tectonic
- 💬 Interactive UI: Streamlit-based web interface for seamless interaction
- 🔄 Multi-LLM Support: Works with OpenRouter (preferred) or Google Gemini
- 💾 Conversation History: Maintains context across interactions with message memory
- LLM Framework: LangChain & LangGraph
- Frontend: Streamlit
- PDF Processing: PyPDF2
- PDF Rendering: Tectonic (LaTeX compiler)
- API Integration: arXiv API, Google Gemini API, OpenRouter API
- Python: 3.12+
Before you begin, ensure you have the following installed:
-
Python 3.12 or higher
-
Tectonic (for LaTeX PDF rendering)
- Windows:
choco install tectonicor download from tectonic-typesetting.github.io - macOS:
brew install tectonic - Linux: See installation guide
- Windows:
-
API Keys (at least one):
- Google Gemini (free tier available): Get API key
- OpenRouter (recommended): Get API key
git clone <repository-url>
cd ScholarSynth# Windows
python -m venv .venv
.venv\Scripts\activate
# macOS/Linux
python3 -m venv .venv
source .venv/bin/activatepip install -e .This installs all dependencies specified in pyproject.toml:
- langchain
- langchain-core
- langchain-google-genai
- langchain-openai
- langgraph
- pypdf2
- python-dotenv
- requests
- streamlit
Create a .env file in the project root with the following configuration:
# LLM Configuration (choose one or both)
# Option 1: OpenRouter (Preferred - free models available)
OPENROUTER_API_KEY=your_openrouter_api_key_here
OPENROUTER_MODEL=openrouter/free # or specify a model
# Option 2: Google Gemini
GOOGLE_API_KEY=your_google_api_key_here
GEMINI_MODEL=gemini-2.5-pro
# Optional: Performance Tuning
MAX_MODEL_CONTEXT_MESSAGES=10
MAX_TOOL_MESSAGE_CHARS=4000
MAX_TEXT_MESSAGE_CHARS=6000Priority: If both OpenRouter and Gemini keys are set, OpenRouter will be used.
# Make sure your virtual environment is activated
streamlit run frontend.pyThe application will open at http://localhost:8501
Interactive Workflow:
- Describe your research topic to the AI
- Review recent papers from arXiv
- Select papers of interest
- The AI reads and analyzes selected papers
- Discuss research findings and future directions
- Request paper generation
- Download the rendered PDF
For programmatic use or testing:
python ai_researcher_2.pyScholarSynth/
├── ai_researcher.py # Basic ReAct agent implementation
├── ai_researcher_2.py # Advanced agent with optimizations & web support
├── arxiv_tool.py # arXiv paper search functionality
├── read_pdf.py # PDF extraction tool
├── write_pdf.py # LaTeX to PDF rendering tool
├── frontend.py # Streamlit web interface
├── pyproject.toml # Project dependencies
├── README.md # This file
├── output/ # Generated papers directory
│ └── paper_YYYYMMDD_HHMMSS.pdf
│ └── paper_YYYYMMDD_HHMMSS.tex
└── .env # Environment variables (not in repo)
Searches arXiv API for academic papers by topic. Returns paper metadata including titles, authors, abstracts, publication dates, and download links.
Extracts text content from PDF files using PyPDF2. Used to analyze paper content for research synthesis.
Converts LaTeX content to PDF using the Tectonic compiler. Handles file management and output organization.
Main agent implementation using LangGraph with:
- State management for conversation history
- Tool integration (search, read, write)
- Message compaction for token optimization
- Multi-LLM support
Streamlit web interface providing:
- Chat-like interaction with the research agent
- Real-time message streaming
- Paper management and downloads
- Custom styling and theme
- Start the app:
streamlit run frontend.py - Ask a research question:
"I'm interested in recent advances in quantum machine learning"
- Review papers: The AI searches arXiv and presents recent papers
- Select papers: Choose which papers to analyze in depth
- Analyze: AI reads and synthesizes the papers
- Generate: Ask the AI to write a new research paper
- Download: Get the PDF from the output folder
For better performance and lower costs, adjust these environment variables:
MAX_MODEL_CONTEXT_MESSAGES: Number of recent messages to keep (default: 10)MAX_TOOL_MESSAGE_CHARS: Max characters per tool response (default: 4000)MAX_TEXT_MESSAGE_CHARS: Max characters per text message (default: 6000)
Lower values = faster/cheaper but less context.
Ensure Tectonic is installed and in PATH:
tectonic --version- Verify
.envfile exists and is in the project root - Check API key validity and billing status
- Ensure no extra spaces around API key values
- Check LaTeX content for syntax errors
- Ensure Tectonic has write permissions to
output/directory - Check available disk space
- Support for additional academic databases (IEEE, PubMed, etc.)
- Paper recommendation engine
- Multi-language support
- Collaborative research sessions
- Citation management and bibliography generation
- Paper visualization and timeline generation
- Local LLM support (Ollama, LLaMA, etc.)
[Add your license here]
Contributions are welcome! Please feel free to submit issues and pull requests.
For issues and questions, please open an issue on the repository.