fix(gemini): propagate model to check_cache/async_check_cache for custom api_base

check_and_create_cache calls check_cache first (to avoid duplicates),
which also needs model for the URL when api_base is set. Without this,
the full flow still raises ValueError before reaching the create step.
This commit is contained in:
Chesars
2026-03-18 00:38:35 -03:00
parent 8828f002be
commit ff536e664a
@@ -110,6 +110,7 @@ class ContextCachingEndpoints(VertexBase):
vertex_project: Optional[str],
vertex_location: Optional[str],
vertex_auth_header: Optional[str],
model: Optional[str] = None,
) -> Optional[str]:
"""
Checks if content already cached.
@@ -129,6 +130,7 @@ class ContextCachingEndpoints(VertexBase):
vertex_project=vertex_project,
vertex_location=vertex_location,
vertex_auth_header=vertex_auth_header,
model=model,
)
page_token: Optional[str] = None
@@ -202,6 +204,7 @@ class ContextCachingEndpoints(VertexBase):
vertex_project: Optional[str],
vertex_location: Optional[str],
vertex_auth_header: Optional[str],
model: Optional[str] = None,
) -> Optional[str]:
"""
Checks if content already cached.
@@ -221,6 +224,7 @@ class ContextCachingEndpoints(VertexBase):
vertex_project=vertex_project,
vertex_location=vertex_location,
vertex_auth_header=vertex_auth_header,
model=model,
)
page_token: Optional[str] = None
@@ -379,6 +383,7 @@ class ContextCachingEndpoints(VertexBase):
vertex_project=vertex_project,
vertex_location=vertex_location,
vertex_auth_header=vertex_auth_header,
model=model,
)
if google_cache_name:
return non_cached_messages, optional_params, google_cache_name
@@ -523,6 +528,7 @@ class ContextCachingEndpoints(VertexBase):
vertex_project=vertex_project,
vertex_location=vertex_location,
vertex_auth_header=vertex_auth_header,
model=model,
)
if google_cache_name: