refactor(llm): drop dead tool-doc path from GemmaPromptHelper - #594
Open
alexisjamet wants to merge 1 commit into
Open
refactor(llm): drop dead tool-doc path from GemmaPromptHelper#594alexisjamet wants to merge 1 commit into
alexisjamet wants to merge 1 commit into
Conversation
appendToolsToPrompt built a list of tool docs, discarded it, and only injected an unrelated instruction about nullable argument fields — Gemma receives tool definitions through native function calling, so nothing was ever appended. The name described the Mistral helper this was copied from, not what it does. Rename to injectNullValueInstruction and delete convertToolsToDocs. The "skip when there are no tools" behaviour is preserved but stated directly instead of falling out of an empty tool-docs list. jsonSchemaToArgumentString stays: the MedGemma provider does render tool docs in-prompt and reuses it. Documented so it is not mistaken for dead code next time.
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 #593
What
GemmaPromptHelper.appendToolsToPromptbuilt a list of tool docs viaconvertToolsToDocs, early-returned on it, then never used it. All it actually did was inject an unrelated instruction about nullable tool-argument fields. Gemma receives tool definitions through native function calling on the OpenAI-compatible endpoint, so nothing was ever appended to the prompt — the name was inherited fromMistralPromptHelper, which does genuinely list tools in-prompt.injectNullValueInstruction, which is what it does.GemmaPromptHelper.convertToolsToDocs(it carried aFIXME: not used anymore).Behaviour
Unchanged. The instruction is injected under exactly the same condition as before (tool set non-empty, and the prompt contains the response-language heading).
Not removed
jsonSchemaToArgumentStringlooks dead from within this file but is not —ai-sdk-med-gemma.provider.ts:78reuses it, because MedGemma does render tool docs in-prompt for its JSON tool-call protocol. Added a doc comment so it is not mistaken for dead code again.Notes
The remaining
FIXMEis reworded rather than resolved: the injection still anchors on a substring of the master prompt (## Response language:\nAlways answer in) and is silently dropped if that heading ever changes. Out of scope here, but worth its own issue if it matters.Added a regression test asserting the prompt does not contain tool descriptions, so the Mistral-style listing cannot creep back in.
🤖 Generated with Claude Code