From ff2b270e2f2c24d7f379bda1819e6fd915758acc Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Thu, 30 Oct 2025 23:55:23 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20relax=20structured=20output=20test=20ass?= =?UTF-8?q?ertions=20to=20handle=20whitespace=20and=E2=80=A6=20(#3997)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … case variations The ollama/llama3.2:3b-instruct-fp16 model returns string values with trailing whitespace in structured JSON output. Updated test assertions to use case-insensitive substring matching instead of exact equality. Use .lower() for case-insensitive comparison Check if expected value is contained in actual value (handles whitespace) Closes: #3996 Signed-off-by: Derek Higgins --- tests/integration/inference/test_openai_completion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/inference/test_openai_completion.py b/tests/integration/inference/test_openai_completion.py index 964d19c1d..18406610f 100644 --- a/tests/integration/inference/test_openai_completion.py +++ b/tests/integration/inference/test_openai_completion.py @@ -721,6 +721,6 @@ def test_openai_chat_completion_structured_output(openai_client, text_model_id, print(response.choices[0].message.content) answer = AnswerFormat.model_validate_json(response.choices[0].message.content) expected = tc["expected"] - assert answer.first_name == expected["first_name"] - assert answer.last_name == expected["last_name"] + assert expected["first_name"].lower() in answer.first_name.lower() + assert expected["last_name"].lower() in answer.last_name.lower() assert answer.year_of_birth == expected["year_of_birth"]