diff --git a/providers/nvidia_nim/request.py b/providers/nvidia_nim/request.py index 3f41c0b3..7459c9ca 100644 --- a/providers/nvidia_nim/request.py +++ b/providers/nvidia_nim/request.py @@ -63,7 +63,9 @@ def build_request_body(request_data: Any, nim: NimSettings) -> dict: if request_extra: extra_body.update(request_extra) - extra_body.setdefault("chat_template_kwargs", {"enable_thinking": True}) + extra_body.setdefault( + "chat_template_kwargs", {"thinking": True, "enable_thinking": True} + ) _set_extra(extra_body, "reasoning_budget", max_tokens) req_top_k = getattr(request_data, "top_k", None) diff --git a/tests/providers/test_nvidia_nim.py b/tests/providers/test_nvidia_nim.py index 80950c22..1151515f 100644 --- a/tests/providers/test_nvidia_nim.py +++ b/tests/providers/test_nvidia_nim.py @@ -100,6 +100,7 @@ async def test_build_request_body(nim_provider): assert "extra_body" in body ctk = body["extra_body"]["chat_template_kwargs"] + assert ctk["thinking"] is True assert ctk["enable_thinking"] is True assert body["extra_body"]["reasoning_budget"] == body["max_tokens"] diff --git a/tests/providers/test_nvidia_nim_request.py b/tests/providers/test_nvidia_nim_request.py index 6459cda8..caf71b96 100644 --- a/tests/providers/test_nvidia_nim_request.py +++ b/tests/providers/test_nvidia_nim_request.py @@ -101,7 +101,10 @@ class TestBuildRequestBody: nim = NimSettings() body = build_request_body(req, nim) extra = body["extra_body"] - assert extra["chat_template_kwargs"] == {"enable_thinking": True} + assert extra["chat_template_kwargs"] == { + "thinking": True, + "enable_thinking": True, + } assert extra["reasoning_budget"] == body["max_tokens"] def test_no_reasoning_params_in_extra_body(self):