PaperQA2
A high-accuracy retrieval-augmented-generation package for answering questions from scientific PDFs, text, Office documents and source code, with citations back to the source passages.
PaperQA2 is a package for high-accuracy retrieval-augmented generation (RAG) over PDFs, text files, Microsoft Office documents and source-code files, with a focus on scientific literature. Given a folder of paper PDFs, it fetches their metadata, including citation counts with a retraction check, parses and caches them into a full-text search index, and answers a question with an LLM agent, citing the source passages it used.
It can be used from the command line or as a Python library, with either an agentic mode that adds and queries documents autonomously or a manual mode without an agent. It supports asynchronous operation, a choice of hosted or locally hosted models, a configurable embedding model including local sentence-transformer models, code and HTML as input, multimodal documents, and an external or vector database for the index and for caching, with settings for adjusting the number of sources used and customizing prompts.
It installs as a Python package and is released under the Apache-2.0 license.