feat(provider): forward reasoning effort across OpenAI and Anthropic providers#285
feat(provider): forward reasoning effort across OpenAI and Anthropic providers#285rodboev wants to merge 2 commits into
Conversation
…VIDIA#283) Signed-off-by: Rod Boev <rod.boev@gmail.com>
|
Could you please expand this PR to support the native Anthropic provider paths as part of this PR, rather than leaving them out of scope?
Could we translate the common SkillSpector setting into the native Anthropic request format in this PR?
Otherwise, the same environment variable silently has no effect when users switch from an OpenAI-compatible provider to a native Anthropic provider. References: |
|
FYI, I edited the comment: Let's remove Bedrock from scope for this PR since it seems Bedrock has a wide range of such parameter names including We can come back to this support in a followup PR or future work based on community feedback. @rodboev Do you agree with that approach? |
keshprad
left a comment
There was a problem hiding this comment.
Requesting changes to include native Anthropic support in this PR. Please map SKILLSPECTOR_REASONING_EFFORT for both AnthropicProvider and AnthropicProxyProvider, validate the Anthropic-specific accepted values at the provider boundary, and add coverage confirming that the proxy rewrite preserves output_config.effort. See the linked conversation comment for the detailed rationale and references.
…hs (NVIDIA#283) Signed-off-by: Rod Boev <rod.boev@gmail.com>
|
Agreed on keeping Bedrock out of this PR. I limited the expansion to the two native Anthropic paths covered by the formal review.
I left Bedrock parsing, translation, tests, and documentation out of this PR. Its provider-specific reasoning controls can be handled separately if that support is requested later. CLI provider behavior also stays outside this change. |
|
[P1] Could we remove the Anthropic-specific validation and keep The behavior should be consistent across providers:
Maintaining an Anthropic-specific allowlist in SkillSpector creates an unnecessary capability matrix that can become stale as models and supported effort levels evolve. It is also inconsistent with the OpenAI-compatible path, which already passes non-empty values through. Please remove the local Anthropic enum validation and its invalid-value tests. Retain coverage for trimming, pass-through, omission when unset or blank, and preservation of |
|
[P2] Add the new variable to the
Add the variable to that fixture’s cleanup tuple. |
|
Two small changes and this looks good to me. Thanks @rodboev! |
Summary
SkillSpector now applies
SKILLSPECTOR_REASONING_EFFORTacross its OpenAI-compatible and native Anthropic provider paths instead of silently dropping the setting when users switch fromChatOpenAI-based providers to nativeChatAnthropic.Closes #283
Implements the maintainer-requested Anthropic expansion from the July 20 review.
Root cause
The shared OpenAI-compatible constructor already forwarded
SKILLSPECTOR_REASONING_EFFORT, but both native Anthropic providers builtChatAnthropicdirectly and bypassed that seam. The proxy rewrite also lacked a regression test for nestedoutput_config.effort, so the PR had no proof that the Anthropic request body preserved the setting after URL and auth rewriting.Diff Notes
low,medium,high,xhigh, andmaxAnthropicProviderandAnthropicProxyProvideroutput_config.effortScope
This change covers the shared OpenAI-compatible path plus the two native Anthropic providers. OpenAI-compatible providers still pass non-empty literals through unchanged. Native Anthropic providers accept
low,medium,high,xhigh, andmaxand reject other non-empty values at the provider boundary. Bedrock and CLI-provider behavior stay out of scope for this PR.Verification
uv sync --all-extraspassed; checked 151 packages.python -m pytest tests/unit/test_providers.py tests/unit/test_anthropic_proxy_provider.py; pytest reported106 passed, 9 skipped.uv run ruff check src/skillspector/providers/chat_models.py src/skillspector/providers/anthropic/provider.py src/skillspector/providers/anthropic_proxy/provider.py tests/unit/test_providers.py tests/unit/test_anthropic_proxy_provider.pypassed withAll checks passed!.uv run ruff format --check src/skillspector/providers/chat_models.py src/skillspector/providers/anthropic/provider.py src/skillspector/providers/anthropic_proxy/provider.py tests/unit/test_providers.py tests/unit/test_anthropic_proxy_provider.pypassed with5 files already formatted.