Hi,
In paper-qa v2026.3.18, pdf file indexing does not work anymore with local models. It tries to query OpenAI API despite being configured to use a local model.
The problem remains either with direct query using paperqa.ask() or with asynchronous agent mode using paperqa.agent module. See minimum working example below.
Here are the articles and manifest files used in the code that I put in a sub-folder named `paperqa_article":
Interesting point, once the indexing has failed, the index directory structure has been created and rerunning the direct query works but paper-qa answers I cannot answer this question due to having no papers. since the index is empty.
import asyncio
import os
from paperqa import Settings, ask
from paperqa.agents import agent_query, get_directory_index
from paperqa.settings import AgentSettings, IndexSettings, ParsingSettings
# setup
model = "ollama/llama3.2"
paper_directory = "paperqa_article" # edit path if necessary
manifest_file = os.path.join(paper_directory, "manifest.csv")
index_directory = os.path.join(paper_directory, "index")
os.makedirs(index_directory, exist_ok=True)
# paper-qa config
local_llm_config = dict(
model_list=[
dict(
model_name=model,
litellm_params=dict(
model=model,
api_base="http://localhost:11434",
timeout=600,
api_type="ollama",
api_key="sk-no-key-required",
temperature=0.1,
),
)
]
)
agent = AgentSettings(
agent_llm=model,
agent_llm_config=local_llm_config,
index=IndexSettings(
paper_directory=paper_directory,
index_directory=index_directory,
manifest_file=manifest_file,
concurrency=1,
),
timeout=3600,
search_count=1
)
settings = Settings(
llm=model,
llm_config=local_llm_config,
summary_llm=model,
summary_llm_config=local_llm_config,
embedding="ollama/mxbai-embed-large",
agent=agent,
parsing=ParsingSettings(
use_doc_details=False,
),
verbosity=3
)
settings.answer.max_concurrent_requests = 1
settings.answer.answer_max_sources = 2 # default is 5
settings.answer.evidence_k = 2 # default is 10
settings.answer.max_answer_attempts = 10
# question
question = "What is PaperQA2?"
# direct query
def main(question: str, settings: Settings):
# query
response = ask(
question,
settings=settings,
)
print(response)
# build index and agent query (adapted from paper-qa repository README)
async def amain(settings: Settings):
# 1. Build the index. Note an index name is autogenerated when unspecified
built_index = await get_directory_index(settings=settings)
print(settings.get_index_name()) # Display the autogenerated index name
print(await built_index.index_files) # Display the index contents
# 2. Use the settings as many times as you want with ask
answer = await agent_query(
query=question,
settings=settings,
)
print(answer)
if __name__ == "__main__":
# switch between one moe or the other by commenting/uncommenting one
# of the two following lines
main(question, settings)
# asyncio.run(amain(settings))
Regarding my environment, I am using Python 3.14.3 and paper-qa v2026.3.18 run by uv 0.10.4 (079e3fd05 2026-02-17).
Hi,
In
paper-qa v2026.3.18, pdf file indexing does not work anymore with local models. It tries to query OpenAI API despite being configured to use a local model.The problem remains either with direct query using
paperqa.ask()or with asynchronous agent mode usingpaperqa.agentmodule. See minimum working example below.Here are the articles and manifest files used in the code that I put in a sub-folder named `paperqa_article":
Interesting point, once the indexing has failed, the index directory structure has been created and rerunning the direct query works but paper-qa answers
I cannot answer this question due to having no papers.since the index is empty.Regarding my environment, I am using
Python 3.14.3andpaper-qa v2026.3.18run byuv 0.10.4 (079e3fd05 2026-02-17).