Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(common_utils.py): handle $id in response schema when calling vert… (#8991)

Krish Dholakiaf1a44d1fdc31
diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py
index a412a1f0dbd..f7149c349ab 100644
--- a/litellm/llms/vertex_ai/common_utils.py
+++ b/litellm/llms/vertex_ai/common_utils.py
@@ -170,6 +170,9 @@ def _build_vertex_schema(parameters: dict):
strip_field(
parameters, field_name="$schema"
) # 5. Remove $schema - json schema value, not supported by OpenAPI - causes vertex errors.
+ strip_field(
+ parameters, field_name="$id"
+ ) # 6. Remove id - json schema value, not supported by OpenAPI - causes vertex errors.
return parameters
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index 19d0ebe9ea4..28aceb7519b 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -7059,6 +7059,9 @@ async def delete_model(model_info: ModelInfoDelete):
)
except Exception as e:
+ verbose_proxy_logger.exception(
+ f"Failed to delete model. Due to error - {str(e)}"
+ )
if isinstance(e, HTTPException):
raise ProxyException(
message=getattr(e, "detail", f"Authentication Error({str(e)})"),
diff --git a/tests/llm_translation/test_vertex.py b/tests/llm_translation/test_vertex.py
index db867e52029..08ea45cb20f 100644
--- a/tests/llm_translation/test_vertex.py
+++ b/tests/llm_translation/test_vertex.py
@@ -108,6 +108,7 @@ def test_build_vertex_schema():
schema = {
"type": "object",
+ "$id": "my-special-id",
"properties": {
"recipes": {
"type": "array",
@@ -126,6 +127,7 @@ def test_build_vertex_schema():
assert new_schema["type"] == schema["type"]
assert new_schema["properties"] == schema["properties"]
assert "required" in new_schema and new_schema["required"] == schema["required"]
+ assert "$id" not in new_schema
@pytest.mark.parametrize(