Skip to main content

Research Paper Synthesis Agent - Fetch, process, and query academic papers with AI-powered answers

Project description

๐Ÿง  ReSynth - Research Paper Synthesis Agent

PyPI version Python versions License: MIT Code style: black Tests

ReSynth is an intelligent agent that fetches research papers, processes them through advanced chunking and embedding, and answers queries with proper academic citations. Perfect for researchers, students, and anyone working with academic literature.

โœจ Features

  • ๐Ÿ” Multi-Source Paper Fetching: Retrieve papers from arXiv, PubMed, and more
  • ๐Ÿง  Intelligent Processing: Advanced text chunking with semantic boundaries
  • ๐Ÿ’พ Vector Storage: Efficient storage and retrieval with ChromaDB
  • ๐Ÿค– AI-Powered Answers: Synthesize responses using OpenAI or local models
  • ๐Ÿ“š Citation Management: Automatic citation generation in multiple styles (APA, MLA, numeric)
  • ๐ŸŒ Multiple Interfaces: Web UI, REST API, and command-line interface
  • โšก Quality Metrics: Retrieval quality validation and confidence scoring

๐Ÿš€ Quick Start

Installation

# Install from PyPI
pip install resynth

# Or install with development dependencies
pip install resynth[dev]

Basic Usage

import resynth

# Initialize the agent
agent = resynth.ReSynthAgent()

# Search and process papers
papers = agent.search_and_process(
    query="machine learning interpretability",
    source="arxiv",
    max_papers=5
)

# Query the processed papers
answer = agent.query(
    "What are the main challenges in deep learning interpretability?",
    citation_style="apa"
)

print(answer.answer)
print(answer.bibliography)

Command Line Interface

# Search and process papers
resynth --search "transformer architectures" --max-papers 5

# Query processed papers
resynth --query "How do attention mechanisms work?" --citation-style numeric

# Show system statistics
resynth --stats

Web Interface

# Start the web interface
resynth-web

# Or use streamlit directly
streamlit run resynth.web

API Server

# Start the API server
resynth-api

# Then access the API at http://localhost:8000
# Interactive docs at http://localhost:8000/docs

๐Ÿ“‹ Requirements

  • Python 3.8+
  • Optional: OpenAI API key for enhanced answer synthesis
  • Optional: spaCy model (python -m spacy download en_core_web_sm)

๐Ÿ”ง Configuration

Create a .env file:

cp .env.example .env
# Edit .env with your configuration

Key configuration options:

# OpenAI API Key (optional, for enhanced synthesis)
OPENAI_API_KEY=your_openai_api_key_here

# Vector database settings
CHROMA_PERSIST_DIRECTORY=./chroma_db
CHROMA_COLLECTION_NAME=research_papers

# Retrieval settings
TOP_K_RETRIEVAL=5
SIMILARITY_THRESHOLD=0.7

# Chunking settings
CHUNK_SIZE=1000
CHUNK_OVERLAP=200

๐Ÿ“š Usage Examples

Research Paper Analysis

import resynth

# Initialize agent
agent = resynth.ReSynthAgent()

# Process recent papers on a topic
agent.search_and_process(
    query="large language model alignment",
    source="arxiv",
    max_papers=10,
    fetch_content=True
)

# Get comprehensive analysis
answer = agent.query(
    "What are the main approaches to LLM alignment?",
    citation_style="author_date"
)

print(f"Answer: {answer.answer}")
print(f"Confidence: {answer.confidence_score:.2f}")
print(f"Sources: {len(answer.source_chunks)} papers")

Comparison Study

# Compare different methodologies
answer = agent.query(
    "Compare transformer architectures: BERT vs GPT vs T5",
    citation_style="apa"
)

# The answer will include:
# - Detailed comparison of architectures
# - Proper citations for each model
# - Confidence assessment
# - Source references

Literature Review

# Systematic literature review
agent.search_and_process(
    query="climate change machine learning applications",
    source="both",  # arxiv and pubmed
    max_papers=20
)

# Get overview
overview = agent.query(
    "What are the main applications of ML in climate research?",
    citation_style="numeric"
)

# Get specific methodology info
methods = agent.query(
    "What machine learning methods are most commonly used?",
    citation_style="mla"
)

๐Ÿ—๏ธ Architecture

ReSynth/
โ”œโ”€โ”€ Paper Fetchers     # arXiv, PubMed integration
โ”œโ”€โ”€ Text Processors    # Chunking, cleaning, preprocessing
โ”œโ”€โ”€ Embedding Engine  # Vector generation and storage
โ”œโ”€โ”€ Retrieval System   # Query processing and similarity search
โ”œโ”€โ”€ Answer Synthesizer # AI-powered response generation
โ””โ”€โ”€ Citation Manager   # Automatic citation formatting

๐ŸŽฏ Citation Styles

ReSynth supports multiple citation formats:

  • APA: (Smith, 2023)
  • MLA: Smith, John. "Title." Journal (2023)
  • Numeric: [1], [2], [3]
  • Author-Date: (Smith, 2023)

๐Ÿ“Š Quality Metrics

Every answer includes quality assessment:

  • Confidence Score: 0.0-1.0 based on source quality
  • Retrieval Quality: Validation of search results
  • Source Diversity: Number of unique papers referenced
  • Similarity Metrics: Average and minimum similarity scores

๐ŸŒ API Endpoints

When running the API server:

# Process papers
POST /process
{
  "query": "machine learning interpretability",
  "source": "arxiv",
  "max_papers": 5
}

# Query papers
POST /query
{
  "query": "What are interpretability methods?",
  "citation_style": "apa",
  "top_k": 5
}

# Get statistics
GET /stats

# List papers
GET /papers

๐Ÿงช Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=resynth --cov-report=html

# Run specific test categories
pytest -m unit      # Unit tests only
pytest -m integration  # Integration tests only

๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Setup

# Clone the repository
git clone https://github.com/resynth-ai/resynth.git
cd resynth

# Install development dependencies
pip install -e ".[dev]"

# Set up pre-commit hooks
pre-commit install

# Run tests
make test

๐Ÿ“– Documentation

๐Ÿ—บ๏ธ Roadmap

  • Support for more paper sources (IEEE Xplore, Google Scholar)
  • Advanced query expansion with semantic search
  • Paper summarization and key point extraction
  • Collaborative filtering and recommendation
  • Export to various formats (LaTeX, Word, Markdown)
  • Integration with reference managers (Zotero, Mendeley)

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support


โญ If you find ReSynth useful, please give us a star on GitHub!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

resynth-0.1.0.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

resynth-0.1.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file resynth-0.1.0.tar.gz.

File metadata

  • Download URL: resynth-0.1.0.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for resynth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 61739571b8dd7cc3dadd5d15ca17279d82f1b533a03110888044e3181fabaaf8
MD5 152d09f0811037567182d2298f19cc4f
BLAKE2b-256 5cb9ea3853557f84dafff1f68a15ad1eb6df0cb426af7107b451d3773234730b

See more details on using hashes here.

File details

Details for the file resynth-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: resynth-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for resynth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c747beed1007dd53fb4e59302b162fcb8b1b121c093392bc4f9aa9f08303ba83
MD5 25924c8ae9a4e8813c5eac9221a62436
BLAKE2b-256 8033adf57891af4e71844eb58e89d8f51d2362d3a75e2356c4b1937d46f0edbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page