paper-qa icon indicating copy to clipboard operation
paper-qa copied to clipboard

DIfference between 'ask' function and 'doc.query' ?

Open Snikch63200 opened this issue 1 year ago • 2 comments

Hello,

What is the difference between 'ask' function and 'doc.query' function from behavior point of view?

Best regards. @dosa.

Snikch63200 avatar Oct 09 '24 11:10 Snikch63200

The 'ask' function and the 'doc.query' function differ in their behavior:

  • 'ask' Function: This is a convenience wrapper that uses the SearchPapers tool to query a local index of files. It's designed for quick and straightforward queries with configurable settings like temperature and paper directory.

  • 'doc.query' Function: Part of the Docs object interface, this function allows for more control. You can manually add documents and query them, offering flexibility with settings like the maximum number of sources for answers.

In summary, 'ask' is for quick queries, while 'doc.query' provides more control over document management and querying [1].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Oct 09 '24 11:10 dosubot[bot]

Hi @Snikch63200 the docs.query method will query based on the current papers/objects that have been added into the docs object. All docs you'd like to use need to be added with docs.add. ask is an agentic workflow which first finds relevant papers via keyword searches, parses and adds them into an underlying docs object, then calls docs.query for you, without you needing to manually add each paper.

mskarlin avatar Oct 09 '24 16:10 mskarlin