Skip to content

Conversation

@HANJionghao
Copy link

@HANJionghao HANJionghao commented Nov 14, 2025

Corresponds to #700, #446

Note

Add optional response_schema to Docs.aquery and pass it to llm_model.call_single as response_format for answer generation.

Written by Cursor Bugbot for commit de6751f. Configure here.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Nov 14, 2025
@dosubot
Copy link

dosubot bot commented Nov 14, 2025

Related Documentation

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

How did I do? Any feedback?  Join Discord

@dosubot dosubot bot added the enhancement New feature or request label Nov 14, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bug: Synchronous method lacks schema feature parity.

The synchronous query method lacks the new response_schema parameter that was added to aquery, breaking the wrapper pattern where both methods should accept identical parameters. This prevents users of the synchronous method from using structured response schemas and causes a parameter mismatch between the wrapper and the underlying async implementation.

src/paperqa/docs.py#L744-L769

def query(
self,
query: PQASession | str,
settings: MaybeSettings = None,
callbacks: Sequence[Callable] | None = None,
llm_model: LLMModel | None = None,
summary_llm_model: LLMModel | None = None,
embedding_model: EmbeddingModel | None = None,
partitioning_fn: Callable[[Embeddable], int] | None = None,
) -> PQASession:
warnings.warn(
"The synchronous `query` method is being deprecated in favor of the"
" asynchronous `aquery` method, this deprecation will conclude in"
" version 6.",
category=DeprecationWarning,
stacklevel=2,
)
return get_loop().run_until_complete(
self.aquery(
query,
settings=settings,
callbacks=callbacks,
llm_model=llm_model,
summary_llm_model=summary_llm_model,
embedding_model=embedding_model,

Fix in Cursor Fix in Web


Comment @cursor review or bugbot run to trigger another review on this PR

summary_llm_model: LLMModel | None = None,
embedding_model: EmbeddingModel | None = None,
partitioning_fn: Callable[[Embeddable], int] | None = None,
response_schema: BaseModel | None = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be output_type: type[BaseModel] | TypeAdapter | JSONSchema | None = None, are you sure it works?

Can you add or expand a unit test in tests/test_paperqa.py confirming this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants