fix(attempt): fall back to original outputs when reverse translation is missing - #2081
Open
alireza-aminzadeh wants to merge 1 commit into
Open
Conversation
…is missing Detectors that call outputs_for() for a language other than the prompt language received an empty reverse_translation_outputs value and silently scored no hits. Mirror prompt_for() by returning the original outputs and logging a warning when reverse translation is unpopulated. Signed-off-by: Alireza Aminzadeh <6909432+alireza-aminzadeh@users.noreply.github.com>
Contributor
|
As the issue reporter: this matches option (a) from #2078. The populated-guard ( |
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.
outputs_for(lang)returnedreverse_translation_outputswhenever the requested language did not match the prompt language, with no fallback. When reverse translation was never populated (default empty dict, empty list, or None placeholders only), detectors that calloutputs_for(self.lang_spec)received nothing and reported no hits.prompt_for()already falls back to the original prompt in the same situation, so the attempt looked complete while its outputs were silently empty.Fix
If a different language is requested and reverse translation is unpopulated, return the original
outputsand log a warning. Populated reverse translations, including partial None alignment slots, are still returned as-is.This is complementary to #2041 (list default / type contract). That PR keeps returning an empty list for an unpopulated translated language; this change is the remaining half described in #2078.
Not a duplicate
I searched open PRs for 2078 and for an outputs_for / reverse-translation fallback. #2041 is the type-default fix only. #2067 is the mitigation.Prefixes start-anchor change and is unrelated.
Verification
Fixes #2078