Future-House / paper-qa

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

Increasing answer length #573

Open Litreviewing opened 1 month ago

Litreviewing commented 1 month ago

How can I increase the answer length of the response?

dosubot[bot] commented 1 month ago

To increase the answer length, modify the "answer_length" parameter in the configuration file to a higher range, such as "about 200 words, but can be longer" [1][2].

To continue talking to Dosu, mention @dosu.

Litreviewing commented 1 month ago

How Do i modify that?

@Dosu

Litreviewing commented 1 month ago

How can I modify the answer length? @dosu.

dosubot[bot] commented 1 month ago

To modify the answer length, update the answer_length field in the AnswerSettings class within the settings.py file. For example:

answer_length: str = Field(
    "about 150 words", description="Length of final answer"
)

Adjust the value as needed to increase or decrease the length [1].

To continue talking to Dosu, mention @dosu.

Litreviewing commented 1 month ago

@dosu.

I changed the length in the settings file to answer_length: str = Field( "about 800 words", description="Length of final answer" )

yet when I ask it a question I still get only about 200 words response

dosubot[bot] commented 1 month ago

Make sure there are no other configuration files or settings that might override your change. For example, check paperqa/configs/debug.json and paperqa/configs/tier1_limits.json, as they might specify different answer lengths [1][2].

To continue talking to Dosu, mention @dosu.

tirksam commented 1 month ago

I have the same problem. I was wondering if this is a limit of OpenAI API and if it is possible to adjust maximum lenght in API query.

whitead commented 1 month ago

Hi @tirksam and @Litreviewing - the models are actually not so great at intuiting the number of words in the response. You can try more complex length specifications such as "a comprehensive length, covering all aspects considered, and at least 5 pages"

Also - the system prompt by default asks the responses to be concise and technical. You can override the system prompt to have something like "answer comprehensively, considering multiple viewpoints, and add narrative about the significance."

Litreviewing commented 1 month ago

Hi @whitead , I'll give this a try. Also do you know how to modify the in text citation? Ive found that I often get errors and due to the amount of documents I'm referencing it's hard to figure out where the reference is from.

Thanks