Repository navigation
FIX: include template kwargs in LLMGenericTextConverter identifier - #3397
Open
Pushpak Siva Sai (Pushpak731) wants to merge 1 commit into
Open
Pushpak Siva Sai (Pushpak731) wants to merge 1 commit into
Pushpak Siva Sai (Pushpak731) wants to merge 1 commit into
Conversation
The converter forwards its extra keyword arguments to both templates when rendering, but the identifier recorded only the unrendered template hashes, so converters sharing templates with different parameters (the documented language=... pattern) shared one identifier: the second registry registration raised a duplicate-name error and analytics could not tell the configurations apart (microsoft#3385). The resolved parameters now ride the identifier under a nested prompt_template_kwargs key (empty collapsed to None, mirroring the AzureMLChatTarget extra_parameters fix in microsoft#3332), nested so a template parameter can never collide with the hash params. Subclasses keep their own promoted parameter next to it. Closes microsoft#3385
This branch has not been deployed
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.
Closes #3385
Problem
LLMGenericTextConverterforwards**kwargs(_prompt_kwargs) to both templates when rendering, but_build_identifier()hashed only the unrendered templates. Two converters built from the same template with different parameters — the docstring's ownlanguage=...example — shared one identifier: the secondConverterRegistryregistration raisedValueError: Instance 'LLMGenericTextConverter::<hash>' already exists, and memory/analytics could not tell the configurations apart. Subclasses (ToneConverter,TranslationConverter, …) already promote their own parameter, so this hit the documented direct-use path.Fix
The resolved template parameters are included in the identifier under a nested
prompt_template_kwargskey:system_prompt_template_hash/user_prompt_template_hash;self._prompt_kwargs or Nonecollapses the empty case to None, mirroring theextra_parametersfix forAzureMLChatTarget(BUG: AzureMLChatTarget identifier ignores the extra model parameters it sends #3331 / FIX Include the extra model parameters in the AzureMLChatTarget identifier #3332);Tests (8 new)
unique_nameand hash (the issue's scenario)prompt_template_kwargs == {"language": "French"}params.get("prompt_template_kwargs") is NoneToneConverterkeeps its promotedtoneparam and distinct hashesVerification
tests/unit/converter/— 2776 passed, 74 skippedtests/unit/registry/+tests/unit/models/identifiers/+ identifier filters — 1114 passedI used AI to assist me with this change.