-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve prompt for question decomposition + show more docs #3960
Improve prompt for question decomposition + show more docs #3960
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor nits
question=question, | ||
history=history, | ||
entity_term_extraction_str=entity_term_extraction_str, | ||
base_answer=base_answer, | ||
answered_sub_questions="\n - ".join(addressed_question_list), | ||
# answered_sub_questions="\n - ".join(addressed_question_list), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete commented code
question=question, | ||
history=history, | ||
entity_term_extraction_str=entity_term_extraction_str, | ||
base_answer=base_answer, | ||
answered_sub_questions="\n - ".join(addressed_question_list), | ||
# answered_sub_questions="\n - ".join(addressed_question_list), | ||
answered_subquestions_with_answers="\n\n---\n\n".join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably want a string constant here so it's easy to change across the board later
""" | ||
# Start with relevant docs or fallback to original question docs | ||
streaming_documents = ( | ||
relevant_docs if relevant_docs else original_question_docs[:15] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 15 should be a constant defined somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relevant_docs or ...
- getting docs directly from subquestion results vs relying on langgraph aggregation - simplify subquestion citation lists for answer generation - deduping of individual Inference lists
a55b95f
to
7fa453a
Compare
@@ -72,8 +72,14 @@ def create_refined_sub_questions( | |||
|
|||
initial_question_answers = state.sub_question_results | |||
|
|||
addressed_question_list = [ | |||
x.question for x in initial_question_answers if x.verified_high_quality | |||
# addressed_question_list = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
rolled into #3994 |
Description
The goal is A) to change the prompts to create better sub-questions, and B) to show also some of the context docs even if they were not cited.
For A) At the core, two main changes were made:
The decomposition prompt is explicitly instructed not to generate follow-up questions to the user. All
sub-questions need to be search-type questions
The refinement sub-questions should have the ability to see the initial sub-answers to possibly refer to the
results. Foe this, the prompts for both the initial and the refinement a sub-question generation need to be
changed. (The initial prompt needs to know that it could be valuable to generate for example a question that gives us the competitors to a company A, so that then the refined subquestion could reference the competitors by name for
searches.)
Also, the node generating the LLM request to create the refined sub-questions had to change.
For B)
How Has This Been Tested?
Locally, for some individual questions. No examples yet for sub-questions whose answers are used in refinement questions.
(More testing will follow.)
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.