Skip to content

Conversation

@whitead
Copy link
Collaborator

@whitead whitead commented Nov 2, 2025

More specificity to reduce response sizes


Note

Adds fields support to OpenAlex queries and forwards them to the API select parameter; updates tests and cassette accordingly.

  • OpenAlex client/provider:
    • Add fields parameter to get_doc_details_from_openalex, OpenAlexProvider.get_doc_details, search_by_title, and _query.
    • Forward fields to OpenAlex via params["select"] to limit returned fields.
  • Tests:
    • Update test_does_openalex_work to request open_access and assert non-requested fields like year are None.
    • Add/refresh VCR cassette to reflect select=open_access,doi on the request URI.

Written by Cursor Bugbot for commit f6189b1. Configure here.

Copilot AI review requested due to automatic review settings November 2, 2025 04:37
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Nov 2, 2025
@whitead whitead requested review from jamesbraza and removed request for Copilot November 2, 2025 04:37
@dosubot
Copy link

dosubot bot commented Nov 2, 2025

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

Copilot AI review requested due to automatic review settings November 2, 2025 04:37
@dosubot dosubot bot added the enhancement New feature or request label Nov 2, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for selective field retrieval from the OpenAlex API by introducing a fields parameter throughout the OpenAlexProvider implementation. When specific fields are requested, only those fields are fetched from the API, reducing response size and improving efficiency.

  • Added fields parameter to get_doc_details and search_by_title methods
  • Updated _query method to propagate the fields parameter to underlying API calls
  • Added test coverage to verify that unrequested fields remain unpopulated

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/paperqa/clients/openalex.py Added fields parameter to OpenAlexProvider methods and included debug print statement
tests/test_clients.py Added assertion to verify that unrequested fields are not populated
tests/cassettes/test_does_openalex_work[10.1021-acs.jctc.5b00178-True].yaml Updated cassette to reflect new API request URL with query parameters
Comments suppressed due to low confidence (1)

src/paperqa/clients/openalex.py:93

  • Debug print statement should be removed from production code. Use the existing logger instead, e.g., logger.debug('OpenAlex request URL: %s with params: %s', url, params) if debugging is needed.
    response = await client.get(

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 2, 2025
@whitead whitead merged commit ccbc962 into main Nov 2, 2025
11 of 13 checks passed
@whitead whitead deleted the alex-fields branch November 2, 2025 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants