fix(utils.py): fix fix pydantic obj to schema creation for vertex en… (#6071)

* fix(utils.py): fix  fix pydantic obj to schema creation for vertex endpoints

Fixes https://github.com/BerriAI/litellm/issues/6027

* test(test_completion.pyu): skip test - avoid hitting gemini rate limits

* fix(common_utils.py): fix ruff linting error
This commit is contained in:
Krish Dholakia 2024-10-06 00:25:55 -04:00 committed by GitHub
parent 29da2d49d6
commit 49d8b2be46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 143 additions and 1 deletions

View file

@ -2996,12 +2996,16 @@ def get_optional_params(
"vertex_ai_beta",
]
):
from litellm.llms.vertex_ai_and_google_ai_studio.common_utils import (
_build_vertex_schema,
)
old_schema = copy.deepcopy(
non_default_params["response_format"]
.get("json_schema", {})
.get("schema")
)
new_schema = _remove_additional_properties(schema=old_schema)
new_schema = _build_vertex_schema(parameters=new_schema)
non_default_params["response_format"]["json_schema"]["schema"] = new_schema
if "tools" in non_default_params and isinstance(
non_default_params, list