Fix: Allow -latest model aliases in GoogleSearchTool#1208
Open
hemasekhar-p wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
@anFatum, Please have a look into it. |
5d9180b to
24a64f0
Compare
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
-latestmodel aliases (e.g., gemini-flash-latest) #12032. Or, if no issue exists, describe the change:
If applicable, please follow the issue templates to provide as much detail as
possible.
Problem:
The GoogleSearchTool checks model.startsWith("gemini-2") || model.startsWith("gemini-3"), which rejects all -latest model aliases (gemini-flash-latest, gemini-pro-latest, gemini-flash-lite-latest).
Solution:
Introduced the
isSupportedModelhelper method to allow model names ending with-latestin addition to existing models.Testing Plan
Added unit tests to ensure missing models return the expected
IllegalArgumentExceptionand that-latestaliases are correctly accepted.Unit Tests:
The following test cases were added to BaseToolTest:
processLlmRequestWithLatestAliasAddsToolToConfig: Verifies that models ending in -latest are accepted and configured correctly.processLlmRequestWithUnsupportedModelReturnsError: Verifies rejection of invalid model strings.processLlmRequest_WithNullModel_ReturnsError: Verifies that a null model input does not crash and throws an IllegalArgumentException as expected.Checklist