mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-17 09:34:48 +00:00
Merge a57055325d into 252c71c0b2
This commit is contained in:
commit
3b4ec93653
2 changed files with 6 additions and 9 deletions
|
|
@ -76,6 +76,9 @@ class ContextCachingEndpoints(VertexBase):
|
|||
base_url = get_vertex_base_url(vertex_location)
|
||||
url = f"{base_url}/v1beta1/projects/{vertex_project}/locations/{vertex_location}/{endpoint}"
|
||||
|
||||
if custom_llm_provider == "gemini" and api_base:
|
||||
return auth_header, f"{api_base.rstrip('/')}/{endpoint}"
|
||||
|
||||
return self._check_custom_proxy(
|
||||
api_base=api_base,
|
||||
custom_llm_provider=custom_llm_provider,
|
||||
|
|
|
|||
|
|
@ -2027,12 +2027,7 @@ class TestVertexAIGlobalLocation:
|
|||
"global-aiplatform" not in url
|
||||
), "URL should not contain 'global-aiplatform' prefix"
|
||||
|
||||
def test_gemini_context_caching_with_custom_api_base_passes_model(self):
|
||||
"""Gemini context caching with custom api_base must pass model to _check_custom_proxy.
|
||||
|
||||
Regression test for https://github.com/BerriAI/litellm/issues/23846
|
||||
Previously model was hardcoded to None, causing ValueError when api_base was set.
|
||||
"""
|
||||
def test_gemini_custom_cache_uses_collection_endpoint_without_model(self):
|
||||
caching = ContextCachingEndpoints()
|
||||
|
||||
auth_header, url = caching._get_token_and_url_context_caching(
|
||||
|
|
@ -2042,11 +2037,10 @@ class TestVertexAIGlobalLocation:
|
|||
vertex_project=None,
|
||||
vertex_location=None,
|
||||
vertex_auth_header=None,
|
||||
model="gemini-1.5-pro",
|
||||
)
|
||||
|
||||
assert "models/gemini-1.5-pro" in url
|
||||
assert url.startswith("https://my-proxy.example.com/")
|
||||
assert auth_header == {"x-goog-api-key": "test-key"}
|
||||
assert url == "https://my-proxy.example.com/cachedContents"
|
||||
|
||||
def test_gemini_context_caching_without_api_base_ignores_model(self):
|
||||
"""Without custom api_base, model param is not needed (default URL is used)."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue