mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
fix(gemini): prevent duplicate model path generation when api_base includes full route
This commit is contained in:
parent
58120537af
commit
650b78256b
1 changed files with 6 additions and 1 deletions
|
|
@ -393,7 +393,12 @@ class VertexBase:
|
|||
raise ValueError(
|
||||
"Model parameter is required for Gemini custom API base URLs"
|
||||
)
|
||||
url = "{}/models/{}:{}".format(api_base, model, endpoint)
|
||||
if api_base.endswith(f"/models/{model}:{endpoint}"):
|
||||
url = api_base
|
||||
elif api_base.endswith(f"/models/{model}"):
|
||||
url = f"{api_base}:{endpoint}"
|
||||
else:
|
||||
url = "{}/models/{}:{}".format(api_base.rstrip("/"), model, endpoint)
|
||||
if gemini_api_key is None:
|
||||
raise ValueError(
|
||||
"Missing gemini_api_key, please set `GEMINI_API_KEY`"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue