genie: return full answer text from all text attachments#432
Open
yinxi-db wants to merge 1 commit into
Open
Conversation
poll_for_result previously kept only the first text attachment following the final query, silently dropping a leading summary or trailing follow-up. _parse_attachments now returns all text attachments belonging to the final answer (dropping only text superseded by self-correction, i.e. text strictly between the first and last query), and the contents are joined in order. Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Genie.poll_for_resultpreviously kept only the first text attachment following the final query, silently dropping a leading summary or a trailing follow-up. When Genie returns an answer split across multiple text attachments (e.g. a bulleted summary plus a follow-up prompt), part of the response text was lost.This change makes
_parse_attachmentsreturn all text attachments that belong to the final answer, and joins their contents in order:_extract_text_attachment_content_from_attachments(renamed from the singular form) joins the kept text contents with a blank line.No public API changes;
GenieResponse.text_attachment_contentnow contains the complete answer text.Tests
_parse_attachmentsparametrized unit tests to assert the list of kept text attachments, including a case with a summary before the query plus a trailing text after it._extract_text_contenttests to cover joining multiple text attachments and skipping empty ones.This pull request and its description were written by Isaac.