From cc6b125f02209b6ed816c58401b6c53f44a55c35 Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Sat, 20 Jun 2026 19:57:11 -0400 Subject: [PATCH] test(openai): clarify expected strict schema error (#38338) This clarifies that the strict Responses API schema in `test_parsed_strict` is intentionally made invalid before asserting OpenAI raises `BadRequestError`. The scheduled integration traces for this test can otherwise look like real product regressions because OpenAI reports that `punchline` is missing from `required`. The comment now makes the test intent explicit for future readers and issue triage tooling. --- .../tests/integration_tests/chat_models/test_responses_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 261dfe981ac..b17b0ba6db8 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)