Skip to content

Commit f93a6e0

Browse files
gaiadilorenzoGaia Di Lorenzo
andauthored
chore: remove hardcoded parameters from nooa client (#1249)
* chore: remove hardcoded parameters Signed-off-by: Gaia Di Lorenzo <gdilorenzo@ethz.ch> * chore: fix ruff Signed-off-by: Gaia Di Lorenzo <gdilorenzo@ethz.ch> * chore: revert useless changes Signed-off-by: Gaia Di Lorenzo <gdilorenzo@ethz.ch> * docs: add reasoning effort troubleshooting guidance Signed-off-by: Gaia Di Lorenzo <gdilorenzo@ethz.ch> * docs: clarify reasoning effort overrides Signed-off-by: Gaia Di Lorenzo <gdilorenzo@ethz.ch> --------- Signed-off-by: Gaia Di Lorenzo <gdilorenzo@ethz.ch> Co-authored-by: Gaia Di Lorenzo <gdilorenzo@ethz.ch>
1 parent 58edff5 commit f93a6e0

3 files changed

Lines changed: 30 additions & 53 deletions

File tree

docs/run-inference/about.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,36 @@ working as designed — use `/health/ready` instead.
292292

293293
---
294294

295+
## Troubleshooting
296+
297+
### Function tools require disabled reasoning
298+
299+
If an OpenAI-compatible Chat Completions request using function tools fails
300+
with an error like this:
301+
302+
```text
303+
Function tools with reasoning_effort are not supported for <model> in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.
304+
```
305+
306+
set `reasoning_effort` in the affected provider's default request body. Replace
307+
`<provider_name>` and `<workspace>` with the provider and workspace used for
308+
the request:
309+
310+
```bash
311+
nemo inference providers update <provider_name> \
312+
--workspace <workspace> \
313+
--default-extra-body '{"reasoning_effort":"none"}'
314+
```
315+
316+
Provider requirements differ. Configure only the parameters required by the
317+
provider and model you use; `--default-extra-body` applies them to requests
318+
routed through that provider and can be overridden by an individual request.
319+
For function-tool requests to Chat Completions, any per-request
320+
`reasoning_effort` override must remain `"none"`; another value causes the
321+
error described above.
322+
323+
---
324+
295325
## API Reference
296326

297327
For complete API details, refer to the [Inference Gateway API Reference](/documentation/reference/api-reference) and [SDK Reference](/documentation/reference/python-sdk).

packages/nemo_platform_plugin/src/nemo_platform_plugin/nooa_model_client.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from contextvars import ContextVar
1515
from dataclasses import dataclass
1616

17-
from litellm import get_model_info
1817
from nemo_platform import AsyncNeMoPlatform
1918
from nemo_platform.config import get_context
2019
from nemo_platform.types.inference import ModelProvider
@@ -24,26 +23,10 @@
2423
_PLACEHOLDER_API_KEY = "not-needed"
2524
_OPENAI_FORMAT = "OPENAI_CHAT"
2625
_ANTHROPIC_FORMAT = "ANTHROPIC_MESSAGES"
27-
_OPENAI_CHAT_REASONING_EFFORT = "none"
2826
_ACCEPT_ENCODING_HEADER = "accept-encoding"
2927
_IDENTITY_ENCODING = "identity"
3028

3129

32-
def _openai_chat_reasoning_effort(model: str) -> str | None:
33-
"""Disable reasoning unless LiteLLM explicitly says this value is unsupported."""
34-
try:
35-
model_info = get_model_info(model)
36-
except Exception as exc:
37-
# Custom provider registrations need not appear in LiteLLM's model map.
38-
# Preserve the value that makes frontier Chat Completions tool calls work.
39-
if "This model isn't mapped yet" not in str(exc):
40-
raise
41-
return _OPENAI_CHAT_REASONING_EFFORT
42-
if model_info.get("supports_none_reasoning_effort") is False:
43-
return None
44-
return _OPENAI_CHAT_REASONING_EFFORT
45-
46-
4730
@dataclass(frozen=True)
4831
class ConfiguredModelRefs:
4932
"""Workspace-qualified Model Entity IDs for default and fast agent work."""
@@ -131,10 +114,6 @@ def _completion_client(
131114
# LiteLLM versions otherwise bridge GPT-5.4+ tool calls with any
132115
# reasoning_effort value (including "none") to /responses.
133116
_skip_responses_api_bridge=True,
134-
# Chat Completions tool calls on current OpenAI frontier models
135-
# require reasoning to be disabled. Use LiteLLM's capability map to
136-
# omit that value only when the served model explicitly rejects it.
137-
reasoning_effort=_openai_chat_reasoning_effort(litellm_model),
138117
)
139118
elif model_entity.backend_format == _ANTHROPIC_FORMAT:
140119
api_base = api_base.removesuffix("/v1")

packages/nemo_platform_plugin/tests/test_nooa_model_client.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from nemo_platform_plugin.nooa_model_client import (
1010
ConfiguredModelClients,
1111
ConfiguredModelRefs,
12-
_openai_chat_reasoning_effort,
1312
activate_model_clients,
1413
configured_model_refs,
1514
get_configured_model_refs,
@@ -76,7 +75,6 @@ async def test_resolve_model_clients_deduplicates_same_model(monkeypatch):
7675
extra_headers={"x-test": "value", "accept-encoding": "identity"},
7776
drop_params=True,
7877
_skip_responses_api_bridge=True,
79-
reasoning_effort="none",
8078
)
8179
assert default_headers == {"x-test": "value"}
8280

@@ -177,7 +175,6 @@ async def test_resolve_model_clients_uses_provider_served_name(monkeypatch):
177175
extra_headers={"accept-encoding": "identity"},
178176
drop_params=True,
179177
_skip_responses_api_bridge=True,
180-
reasoning_effort="none",
181178
)
182179

183180

@@ -251,32 +248,3 @@ async def test_resolve_model_clients_closes_constructed_client_after_failure(mon
251248
)
252249

253250
constructed.aclose.assert_awaited_once()
254-
255-
256-
def test_openai_chat_reasoning_effort_uses_litellm_capability(monkeypatch):
257-
monkeypatch.setattr(
258-
nooa_model_client,
259-
"get_model_info",
260-
lambda model: {"supports_none_reasoning_effort": False},
261-
)
262-
263-
assert _openai_chat_reasoning_effort("openai/gpt-5-mini") is None
264-
265-
266-
def test_openai_chat_reasoning_effort_preserves_none_for_unmapped_models(monkeypatch):
267-
def unmapped(model: str):
268-
raise Exception("This model isn't mapped yet")
269-
270-
monkeypatch.setattr(nooa_model_client, "get_model_info", unmapped)
271-
272-
assert _openai_chat_reasoning_effort("openai/custom-model") == "none"
273-
274-
275-
def test_openai_chat_reasoning_effort_does_not_hide_lookup_failures(monkeypatch):
276-
def failed(model: str):
277-
raise RuntimeError("model registry failed")
278-
279-
monkeypatch.setattr(nooa_model_client, "get_model_info", failed)
280-
281-
with pytest.raises(RuntimeError, match="model registry failed"):
282-
_openai_chat_reasoning_effort("openai/gpt-5-mini")

0 commit comments

Comments
 (0)