fix(cli): add google/ publisher prefix normalization for Vertex AI - #56805
fix(cli): add google/ publisher prefix normalization for Vertex AI#56805liuhao1024 wants to merge 1 commit into
Conversation
Vertex AI endpoints require model IDs in the format 'google/<model>' but normalize_model_for_provider() had no handler for the 'vertex' provider, causing bare names like 'gemini-3.1-flash-lite' to be sent as-is and rejected with HTTP 400 INVALID_ARGUMENT. Add a dedicated vertex block that: - Prepends 'google/' to bare model names - Preserves names already carrying the 'google/' prefix - Strips a matching 'vertex/' prefix before adding 'google/' Fixes NousResearch#56778
|
Heads-up from working the same issue (overlap disclosed in #56809): |
|
Closing in favor of #56809 which handles this correctly. The current implementation has a bug: when the model name carries an explicit non-Google publisher prefix (e.g. @tangtaizong666's #56809 fixes this with |
What does this PR do?
Adds a dedicated normalization handler for the
vertexprovider innormalize_model_for_provider(). Vertex AI endpoints require model IDs in thegoogle/MODEL_NAMEformat (e.g.google/gemini-3.1-flash-lite), but bare names likegemini-3.1-flash-litewere passed through unchanged, causing HTTP 400INVALID_ARGUMENTerrors from the Vertex API.Related Issue
Fixes #56778
Type of Change
Changes Made
hermes_cli/model_normalize.py: Added avertexprovider block that prependsgoogle/to bare model names, preserves names already carrying thegoogle/prefix, and strips a matchingvertex/prefix before addinggoogle/. Added two docstring examples.tests/hermes_cli/test_vertex_provider.py: AddedTestVertexModelNormalizationclass with 4 test methods covering bare names, already-prefixed names,vertex/prefix stripping, and empty input.How to Test
Run the new normalization tests:
python -m pytest tests/hermes_cli/test_vertex_provider.py -q -k "TestVertexModelNormalization"All 7 parametrized cases should pass.
Run the full vertex provider test suite to check for regressions:
All 29 tests should pass.
Verify normalization behavior interactively:
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — docstring examples addedcli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A