Skip to content

The agent engineering platform.

test(openai): clarify expected strict schema error (#38338)

Mason Daughertycc6b125f0220
diff --git a/libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py b/libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py
index 261dfe981a..b17b0ba6db 100644
--- a/libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py
+++ b/libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py
@@ -511,7 +511,9 @@ def test_parsed_strict() -> None:
schema = _convert_to_openai_response_format(Joke)
invalid_schema = cast(dict, _convert_to_openai_response_format(Joke, strict=True))
- invalid_schema["json_schema"]["schema"]["required"] = ["setup"] # make invalid
+ # Intentionally make the strict schema invalid. OpenAI requires every property
+ # to appear in `required`; omitting `punchline` should produce a BadRequestError.
+ invalid_schema["json_schema"]["schema"]["required"] = ["setup"]
# Test not strict
response = llm.invoke("Tell me a joke", response_format=schema)