Skip to content

feat: thinking level validation and clamping - #12

Merged
xfgong merged 2 commits into
mainfrom
feat/thinking-level-validation
May 9, 2026
Merged

feat: thinking level validation and clamping#12
xfgong merged 2 commits into
mainfrom
feat/thinking-level-validation

Conversation

@xfgong

@xfgong xfgong commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Closes #4

Summary

  • Add thinking_level_map field to Model for per-model thinking level support
  • Implement get_supported_thinking_levels() and clamp_thinking_level() utilities mirroring pi-agent-core
  • Add models_are_equal() comparison utility
  • Apply clamping in both AnthropicProvider and OpenAIProvider before API calls
  • Export new functions from cubepi.providers

Test plan

  • Existing 117 tests pass unchanged
  • 24 new tests verify level validation, clamping, and model comparison
  • Ruff check and format pass clean

🤖 Generated with Claude Code

@xfgong
xfgong force-pushed the feat/thinking-level-validation branch from b0952cb to 75e8c11 Compare May 9, 2026 17:22
xfgong and others added 2 commits May 10, 2026 01:59
Add per-model thinking level support via thinking_level_map on Model,
and implement get_supported_thinking_levels() / clamp_thinking_level() /
models_are_equal() utilities mirroring pi-agent-core. Both Anthropic and
OpenAI providers now clamp the requested thinking level before making
API calls, preventing unsupported levels from reaching the provider.

Closes #4

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prefer cheaper/lower intensity when clamping unsupported thinking levels.
Return True when both models are None in models_are_equal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@xfgong
xfgong force-pushed the feat/thinking-level-validation branch from b6ca34a to 7409173 Compare May 9, 2026 17:59
@xfgong
xfgong merged commit 619dc8b into main May 9, 2026
4 checks passed
@xfgong
xfgong deleted the feat/thinking-level-validation branch May 9, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: thinking level validation and clamping

1 participant