From eefe40a6bf75b8a6a4ac94fc2335efba445ed126 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 22 May 2026 20:34:10 +0000 Subject: [PATCH] Studio: assert promoted fields on attribute path in test_extra_fields_accepted This PR promoted frequency_penalty and seed from undeclared chat-completion extras into explicit ChatCompletionRequest fields, so they ride the attribute path now, not model_extra. The test still asserted both via model_extra and failed on Linux Python 3.10-3.13 with 'assert None == 0.5'. response_format stays in model_extra (still undeclared) so the extra='allow' contract is covered by that branch. --- .../backend/tests/test_openai_tool_passthrough.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/studio/backend/tests/test_openai_tool_passthrough.py b/studio/backend/tests/test_openai_tool_passthrough.py index 84f3e41998..331605b998 100644 --- a/studio/backend/tests/test_openai_tool_passthrough.py +++ b/studio/backend/tests/test_openai_tool_passthrough.py @@ -275,18 +275,19 @@ class TestChatCompletionRequestToolFields: assert req.stop is None def test_extra_fields_accepted(self): - # `frequency_penalty`, `seed`, `response_format` are not yet - # explicitly declared but must survive Pydantic parsing now that - # extra="allow" is set. + # ``response_format`` is still an undeclared OpenAI-side field; + # it must survive Pydantic parsing because extra="allow" is set. + # ``frequency_penalty`` and ``seed`` were promoted to explicit + # ChatCompletionRequest fields in the sampling-params PR, so + # they now ride the attribute path, not model_extra. req = self._make( frequency_penalty = 0.5, seed = 42, response_format = {"type": "json_object"}, ) - # Extras land in model_extra + assert req.frequency_penalty == 0.5 + assert req.seed == 42 assert req.model_extra is not None - assert req.model_extra.get("frequency_penalty") == 0.5 - assert req.model_extra.get("seed") == 42 assert req.model_extra.get("response_format") == {"type": "json_object"} def test_unsloth_extensions_still_work(self):