summaryrefslogtreecommitdiff
path: root/libpanto/src/config.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-10 16:46:30 -0600
committert <t@tjp.lol>2026-06-10 16:46:48 -0600
commitb435cf06b78853bec87bf238f526bc60679d7712 (patch)
tree0c4191f24730f9a0336accb701d627450483c9cf /libpanto/src/config.zig
parentcee08918509689adbdbd26b6384d5ef3a47e91a2 (diff)
fix anthropic thinking effort json placement
Diffstat (limited to 'libpanto/src/config.zig')
-rw-r--r--libpanto/src/config.zig12
1 files changed, 9 insertions, 3 deletions
diff --git a/libpanto/src/config.zig b/libpanto/src/config.zig
index 587f00a..4aae81f 100644
--- a/libpanto/src/config.zig
+++ b/libpanto/src/config.zig
@@ -46,7 +46,8 @@ pub const Thinking = enum {
/// Do not request extended thinking.
disabled,
/// Manual extended thinking with an explicit token budget (`thinking_budget_tokens`).
- /// Supported on all current models including Haiku 4.5. Default.
+ /// Supported on Haiku 4.5 and older models, but NOT on Opus 4.8+ (which
+ /// only accepts adaptive). Not safe as a cross-model default.
enabled,
/// Adaptive thinking: Claude decides when and how much to think.
/// Requires Opus 4.6 / Sonnet 4.6 or newer; automatic on Opus 4.7+.
@@ -82,7 +83,12 @@ pub const AnthropicMessagesConfig = struct {
/// Extended-thinking mode. `.enabled` sends a manual thinking block with
/// `thinking_budget_tokens`; `.adaptive` lets Claude decide and uses
/// `effort` instead. `.disabled` omits thinking entirely.
- thinking: Thinking = .enabled,
+ ///
+ /// Defaults to `.disabled`: it is the only mode accepted by every current
+ /// model. `.enabled` fails on Opus 4.8+ (adaptive-only) and `.adaptive`
+ /// fails on Haiku 4.5 (no adaptive support), so neither is a safe default
+ /// without parsing model strings.
+ thinking: Thinking = .disabled,
/// Effort level for adaptive thinking. Only emitted on the wire when
/// `thinking == .adaptive`; ignored otherwise.
effort: Effort = .medium,
@@ -274,7 +280,7 @@ test "ProviderConfig - anthropic_messages variant" {
try t.expectEqual(APIStyle.anthropic_messages, cfg.style());
try t.expectEqualStrings("2023-06-01", cfg.anthropic_messages.api_version);
try t.expectEqual(@as(u32, 64_000), cfg.anthropic_messages.max_tokens);
- try t.expectEqual(Thinking.enabled, cfg.anthropic_messages.thinking);
+ try t.expectEqual(Thinking.disabled, cfg.anthropic_messages.thinking);
try t.expectEqual(Effort.medium, cfg.anthropic_messages.effort);
try t.expectEqual(@as(?u32, 32_000), cfg.anthropic_messages.thinking_budget_tokens);
try t.expectEqual(false, cfg.anthropic_messages.thinking_interleaved);