picoclaw/pkg/providers
Larry Koo 204038ec60
feat: add extended thinking support for Anthropic models (#1076)
* feat: add extended thinking support for Anthropic models

Support configurable thinking levels (off/low/medium/high/xhigh/adaptive)
via `agents.defaults.thinking_level` config field.

- "adaptive": uses Anthropic's adaptive thinking API (Claude 4.6+)
- "low/medium/high/xhigh": uses budget_tokens (all thinking-capable models)
- "off": disables thinking (default)

API constraints handled:
- Temperature cleared when thinking is enabled
- budget_tokens clamped to max_tokens-1
- Thinking response blocks parsed into Reasoning field

Relates to #645, #966

* fix: address PR review feedback for thinking support

- Add ThinkingCapable interface for provider capability detection
- Warn when thinking_level is set but provider doesn't support it
- Warn when temperature is cleared due to thinking enabled
- Adjust budget values per Anthropic best practices (medium=16K, xhigh=64K)
- Add budget clamp warning and 80% threshold warning
- Add parseResponse thinking block tests
- Add thinking_level field to config.example.json

* refactor: move ThinkingLevel from AgentDefaults to ModelConfig

Thinking is a model-level capability, not a global agent property.
Per-model config avoids silent ignoring on non-Anthropic providers
and eliminates spurious warning logs in multi-provider setups.

Addresses PR #1076 review feedback from @yinwm.
2026-03-05 09:51:18 +08:00
..
anthropic feat: add extended thinking support for Anthropic models (#1076) 2026-03-05 09:51:18 +08:00
openai_compat fix: resolve linter issues (gci import grouping, gofumpt, govet shadow) 2026-03-03 17:04:54 +08:00
protocoltypes feat(providers): add Media field to Message struct for vision support 2026-03-03 16:27:29 +08:00
antigravity_provider.go refactor: cleanup dead code and turn on dead code detection in CI (#515) 2026-02-24 21:52:25 +08:00
antigravity_provider_test.go fix(antigravity): normalize tool calls to avoid empty function names 2026-02-17 20:05:35 +05:30
claude_cli_provider.go remove wrapper methods 2026-03-01 18:24:11 +11:00
claude_cli_provider_integration_test.go feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
claude_cli_provider_test.go remove wrapper methods 2026-03-01 18:24:11 +11:00
claude_provider.go feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
claude_provider_test.go feat(fmt): Fix formatting 2026-02-20 20:03:11 +02:00
codex_cli_credentials.go feat(linter): Fix govet linter 2026-02-20 22:35:16 +02:00
codex_cli_credentials_test.go enable dogsled 2026-02-25 21:14:19 +11:00
codex_cli_provider.go remove wrapper methods 2026-03-01 18:24:11 +11:00
codex_cli_provider_integration_test.go feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
codex_cli_provider_test.go feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
codex_provider.go refactor(modernize): apply safe modernize fixes 2026-02-27 16:35:07 +08:00
codex_provider_test.go feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
cooldown.go style: fix gofmt formatting in cooldown files 2026-02-13 12:26:44 -03:00
cooldown_test.go refactor(modernize): apply safe modernize fixes 2026-02-27 16:35:07 +08:00
error_classifier.go fix(pkg):do regex precompile insteadd on the fly (#911) 2026-03-01 23:06:31 +11:00
error_classifier_test.go fix(pkg):do regex precompile insteadd on the fly (#911) 2026-03-01 23:06:31 +11:00
factory.go feat: add Avian as a named LLM provider 2026-03-03 19:36:46 +00:00
factory_provider.go feat: add Avian as a named LLM provider 2026-03-03 19:36:46 +00:00
factory_provider_test.go feat: add LiteLLM provider alias support (#930) 2026-03-03 08:23:55 +11:00
factory_test.go feat: add LiteLLM provider alias support (#930) 2026-03-03 08:23:55 +11:00
fallback.go fix(providers): support lookup-based fallback candidate resolution 2026-02-26 23:50:33 +08:00
fallback_test.go fix(providers): support lookup-based fallback candidate resolution 2026-02-26 23:50:33 +08:00
github_copilot_provider.go fix: improve error handling in GitHub Copilot provider (#919) 2026-03-01 22:58:41 +11:00
http_provider.go fix(providers): support per-model request_timeout in model_list (#733) 2026-02-26 19:08:19 +11:00
legacy_provider.go fix:Openrouter in providers and modellist 2026-02-25 14:44:49 +08:00
model_ref.go feat: add model fallback chain with error classification 2026-02-13 12:12:12 -03:00
model_ref_test.go feat: add model fallback chain with error classification 2026-02-13 12:12:12 -03:00
tool_call_extract.go feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
toolcall_utils.go enable dupl check 2026-03-01 18:17:32 +11:00
types.go feat: add extended thinking support for Anthropic models (#1076) 2026-03-05 09:51:18 +08:00