mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
fix: relax structured output test assertions to handle whitespace and… (#3997)
… 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 <derekh@redhat.com>
This commit is contained in:
parent
0e384a55a1
commit
ff2b270e2f
1 changed files with 2 additions and 2 deletions
|
|
@ -721,6 +721,6 @@ def test_openai_chat_completion_structured_output(openai_client, text_model_id,
|
||||||
print(response.choices[0].message.content)
|
print(response.choices[0].message.content)
|
||||||
answer = AnswerFormat.model_validate_json(response.choices[0].message.content)
|
answer = AnswerFormat.model_validate_json(response.choices[0].message.content)
|
||||||
expected = tc["expected"]
|
expected = tc["expected"]
|
||||||
assert answer.first_name == expected["first_name"]
|
assert expected["first_name"].lower() in answer.first_name.lower()
|
||||||
assert answer.last_name == expected["last_name"]
|
assert expected["last_name"].lower() in answer.last_name.lower()
|
||||||
assert answer.year_of_birth == expected["year_of_birth"]
|
assert answer.year_of_birth == expected["year_of_birth"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue