mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-17 16:17:18 +00:00
Merge pull request #22719 from BerriAI/fix/vertex-response-format-test
fix: account for vertex_ai schema diff in response_format test
This commit is contained in:
@@ -1139,20 +1139,25 @@ def test_pre_process_non_default_params(model, custom_llm_provider):
|
||||
provider_config=provider_config,
|
||||
)
|
||||
print(processed_non_default_params)
|
||||
# Vertex AI / Gemini uses Pydantic's model_json_schema() which doesn't
|
||||
# include additionalProperties: False (Gemini rejects it). Other
|
||||
# providers use OpenAI's to_strict_json_schema() which does.
|
||||
expected_schema = {
|
||||
"properties": {
|
||||
"x": {"title": "X", "type": "string"},
|
||||
"y": {"title": "Y", "type": "string"},
|
||||
},
|
||||
"required": ["x", "y"],
|
||||
"title": "ResponseFormat",
|
||||
"type": "object",
|
||||
}
|
||||
if custom_llm_provider not in ("vertex_ai", "vertex_ai_beta", "gemini"):
|
||||
expected_schema["additionalProperties"] = False
|
||||
assert processed_non_default_params == {
|
||||
"response_format": {
|
||||
"type": "json_schema",
|
||||
"json_schema": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"x": {"title": "X", "type": "string"},
|
||||
"y": {"title": "Y", "type": "string"},
|
||||
},
|
||||
"required": ["x", "y"],
|
||||
"title": "ResponseFormat",
|
||||
"type": "object",
|
||||
"additionalProperties": False,
|
||||
},
|
||||
"schema": expected_schema,
|
||||
"name": "ResponseFormat",
|
||||
"strict": True,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user