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

PaperQA for clinical trials Query does not give right results

Open lk4ml opened this issue 7 months ago • 3 comments

Paper QA2 for clinical trials does not revert any answers for questions like this : What are the major adverse events observed in case of wegovy drug?

Image

lk4ml avatar Apr 24 '25 02:04 lk4ml

Hey @lk4ml! 👋 I'm here to help you tackle any bugs, answer your questions, and guide you on your journey as a contributor. While you wait for a human maintainer, feel free to share more details, and let's figure this out together! 😄

If PaperQA is not returning results for queries about adverse events related to the Wegovy drug, there could be several reasons for this:

  1. Data Availability: The clinicaltrials.gov API, which PaperQA uses, might not have relevant data for Wegovy's adverse events. Ensure that the clinical trials data for Wegovy is available and accessible through the API.

  2. Query Configuration: Verify that the clinical_trials_search tool is correctly configured in your settings. You can use Settings.from_name("search_only_clinical_trials") to ensure that the query is focused solely on clinical trials [1].

  3. Parsing Settings: Check if the parsing settings are configured to interpret clinical trial data correctly. The ParsingSettings class provides options like use_human_readable_clinical_trials, which can be set to True to parse clinical trial JSONs into human-readable text [2].

  4. Specificity of Query: Ensure that the query is specific enough to match the data available. Sometimes, rephrasing the query or using different keywords can yield better results.

  5. Error Handling: If no results are returned, check for any error messages or logs that might indicate issues with the query or data retrieval process. This can help troubleshoot and refine the query [3].

If these steps do not resolve the issue, consider reviewing the configuration and settings in your script to ensure they align with the requirements for querying clinical trial data.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Apr 24 '25 02:04 dosubot[bot]

Can you tell me how your search is done when someone asks a questions like this. I can clearly see some trials with Wegovy drug on Clinical.gov Infact i see around 54 trials with wegovy drug mentioned in the trials. See the curl below : curl -X GET "https://clinicaltrials.gov/api/v2/studies?query.term=wegovy"
-H "accept: application/json"
Also, see the snapshot. I think we are not handling the questions properly and not parsing the user query accurately. There is some scope to improve that as we can breakdwon the query better to retrieve these results. See below the snapshot :

Image

lk4ml avatar Apr 24 '25 02:04 lk4ml

Hi @lk4ml, thanks for the issue! Happy to see you using our clinical trials code.

For how it works:

  • Here is the tool the agent LLM uses: https://github.com/Future-House/paper-qa/blob/v5.20.0/paperqa/agents/tools.py#L448
  • Here is the function we use to call clinicaltrials.gov: https://github.com/Future-House/paper-qa/blob/v5.20.0/paperqa/sources/clinical_trials.py#L90

To better help you based on your original post, can you paste the full text output printed (not just a screenshot that truncates the output)?

jamesbraza avatar Apr 25 '25 19:04 jamesbraza