PaperQA2 is a Python package for retrieval-augmented generation on PDFs, office files, code, and plain text, focused on scientific literature with in-text citations.
Overview
PaperQA2 (version 5 onward) performs high-accuracy retrieval augmented generation on local document collections, with emphasis on scientific papers. Answers are grounded in sources and include in-text citations rather than unsupported summaries.
The default agent workflow searches for candidate papers, chunks and embeds them, ranks evidence with embedding search and LLM re-ranking, summarizes chunks in query context, and generates a final cited answer. Tools can be invoked in flexible order by a language agent. Metadata enrichment pulls citation and journal information from providers such as Crossref and Semantic Scholar, with optional API keys to raise rate limits on large libraries.
Documents support multiple modalities including tables, figures, non-English text, and equations, with several PDF readers and an Microsoft Office reader. Embeddings and models route through LiteLLM, so many hosted or self-hosted LLM backends can be configured. A CLI command indexes folders of PDFs, reuses on-disk indexes, and exposes bundled quality presets.
Library usage covers manual document management without an agent, async APIs, custom prompts, external vector databases, multimodal contextual summarization, and saving or reloading indexes. Default storage lives under a configurable home directory for answers and indices.
Key features
- Agentic search, evidence, and answer tools
- Metadata-aware embeddings and reranking
- Automatic paper metadata fetching
- CLI for indexing and questioning folders
- LiteLLM-compatible models and embeddings
- Multimodal PDF and Office readers
- Bundled high-quality and fast settings
- Local full-text index with reuse
Use cases
- Question answering over a paper library
- Literature review with citations
- Contradiction checking across studies
- Summarizing scientific PDF collections