Future-House / paper-qa

High accuracy RAG for answering questions from scientific documents with citations
Apache License 2.0
6.44k stars 618 forks source link

No difference between Docs.query and Docs.aquery in request execution time. #631

Open Snikch63200 opened 1 month ago

Snikch63200 commented 1 month ago

Hello,

I tried to execute the same query with sync and async methods :

See here : https://github.com/Future-House/paper-qa?tab=readme-ov-file#adding-documents-manually

But both methods takes the same amount of time...

Is it something to set to allow async processing ?

Best regards.

PS : I saw my LLM 'stream' parameter is set to 'False'.

@Dosu.

dosubot[bot] commented 1 month ago

The synchronous method Docs.query and the asynchronous method Docs.aquery in the PaperQA2 framework are designed to perform the same operations, but in different execution contexts. The synchronous Docs.query internally calls the asynchronous Docs.aquery using get_loop().run_until_complete(), which can result in similar execution times if the environment does not fully leverage asynchronous capabilities [1].

To ensure effective asynchronous processing, make sure your environment supports async operations natively. For example, using an environment like Jupyter notebooks can help. Additionally, the 'stream' parameter being set to 'False' might affect how results are returned, which could impact the perceived performance. Unfortunately, specific details about the 'stream' parameter's impact on performance are not available in the current documentation [1].

To continue talking to Dosu, mention @dosu.