From c48fed139620ea85511b5a7b1c10ab0b3270460e Mon Sep 17 00:00:00 2001 From: Matthew Printz Date: Mon, 29 Dec 2025 15:29:53 -0700 Subject: [PATCH] Delay import of paperqa libraries until use as the import takes over 1 second to import --- src/biome/literature_review.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biome/literature_review.py b/src/biome/literature_review.py index fa20b40..8189b57 100644 --- a/src/biome/literature_review.py +++ b/src/biome/literature_review.py @@ -3,8 +3,6 @@ import os import logging import aiohttp -from paperqa.clients.unpaywall import UnpaywallProvider -from paperqa import Docs, Settings from pathlib import Path from typing import cast import traceback @@ -48,6 +46,7 @@ async def paperQA(self, query: str, slug: str) -> str: """ run paperQA over the downloaded corpus and returns the response """ + from paperqa import Docs, Settings docs = Docs() llm_model = os.environ.get("PAPERQA_LLM_MODEL", "gpt-4.1-mini") settings = Settings( @@ -123,6 +122,7 @@ async def fetch_from_unpaywall(self, doi: str) -> str: """ return the pdf link to a paper from unpaywall as a fallback method """ + from paperqa.clients.unpaywall import UnpaywallProvider try: async with aiohttp.ClientSession() as session: provider = UnpaywallProvider()