mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-10 16:22:17 +00:00
fix(types): resolve MyPy assignment type errors in logging_utils and vertex transformation
logging_utils.py: annotate `copy` as `Union[dict, list]` so the list-branch reassignment is compatible with the dict-branch assignment in the same scope. transformation.py: pre-declare `project_id: Optional[str]` before the if/else block so both branches (str from _ensure_access_token, Optional[str] from vertex_ai_project) are compatible; use `project_id or ""` when passing to get_complete_vertex_url which requires str. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
048f734168
commit
8e4c92a8a3
@@ -101,7 +101,7 @@ def _truncate_base64_in_value(value: Any) -> Any:
|
||||
if isinstance(v, str):
|
||||
container[k] = _truncate_base64_in_string(v)
|
||||
elif isinstance(v, dict):
|
||||
copy = {ck: cv for ck, cv in v.items()}
|
||||
copy: Union[dict, list] = {ck: cv for ck, cv in v.items()}
|
||||
container[k] = copy
|
||||
stack.append((copy, depth + 1))
|
||||
elif isinstance(v, list):
|
||||
|
||||
+2
-1
@@ -34,6 +34,7 @@ class VertexAIPartnerModelsAnthropicMessagesConfig(AnthropicMessagesConfig, Vert
|
||||
vertex_ai_project = VertexBase.safe_get_vertex_ai_project(litellm_params)
|
||||
vertex_ai_location = VertexBase.safe_get_vertex_ai_location(litellm_params)
|
||||
|
||||
project_id: Optional[str] = None
|
||||
if "Authorization" not in headers:
|
||||
vertex_credentials = VertexBase.safe_get_vertex_ai_credentials(litellm_params)
|
||||
|
||||
@@ -54,7 +55,7 @@ class VertexAIPartnerModelsAnthropicMessagesConfig(AnthropicMessagesConfig, Vert
|
||||
custom_api_base=api_base,
|
||||
vertex_location=vertex_ai_location,
|
||||
vertex_project=vertex_ai_project,
|
||||
project_id=project_id,
|
||||
project_id=project_id or "",
|
||||
partner=VertexPartnerProvider.claude,
|
||||
stream=optional_params.get("stream", False),
|
||||
model=model,
|
||||
|
||||
Reference in New Issue
Block a user