Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Made docs in client_models
  • Loading branch information
jamesbraza committed Aug 7, 2025
commit 7084fbaacf92d74f931cf07aadf99ad4dc92ddb4
10 changes: 6 additions & 4 deletions src/paperqa/clients/client_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,21 @@ class JournalQuery(ClientQuery):


class MetadataProvider(ABC, Generic[ClientQueryType]):
"""Provide metadata from a query by any means necessary."""
"""Provide metadata from a query by any means necessary.

An example is going from a DOI to full paper metadata using Semantic Scholar.
"""

async def query(self, query: dict) -> DocDetails | None:
return await self._query(self.query_transformer(query))

@abstractmethod
async def _query(self, query: ClientQueryType) -> DocDetails | None:
pass
"""Run a query against the provider."""

@abstractmethod
def query_transformer(self, query: dict) -> ClientQueryType:
pass
"""Create a query object from unstructured query data."""


class DOIOrTitleBasedProvider(MetadataProvider[DOIQuery | TitleAuthorQuery]):
Expand Down Expand Up @@ -169,7 +172,6 @@ class MetadataPostProcessor(ABC, Generic[ClientQueryType]):

MetadataPostProcessor should be idempotent and not order-dependent, i.e.
all MetadataPostProcessor instances should be able to run in parallel.

"""

async def process(self, doc_details: DocDetails, **kwargs) -> DocDetails:
Expand Down