From 7dcff21dc91cb78faedb562a177133b51349f6de Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 5 Feb 2026 14:55:42 -0500 Subject: [PATCH] anthropic: Update types for adaptive thinking (#48517) This PR updates the Anthropic types with support for [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking). We're not actually using adaptive thinking yet. Release Notes: - N/A --- crates/anthropic/src/anthropic.rs | 17 +++++++++++++++++ .../edit_prediction_cli/src/anthropic_client.rs | 3 +++ .../language_models/src/provider/anthropic.rs | 1 + 3 files changed, 21 insertions(+) diff --git a/crates/anthropic/src/anthropic.rs b/crates/anthropic/src/anthropic.rs index 3f87acaf56d77a62ff8fba83295201b33572a872..fabf07d433c77aa53d77c9c298f3c53558c39260 100644 --- a/crates/anthropic/src/anthropic.rs +++ b/crates/anthropic/src/anthropic.rs @@ -958,6 +958,21 @@ pub enum ToolChoice { #[serde(tag = "type", rename_all = "lowercase")] pub enum Thinking { Enabled { budget_tokens: Option }, + Adaptive, +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Effort { + Low, + Medium, + High, + Max, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct OutputConfig { + pub effort: Option, } #[derive(Debug, Serialize, Deserialize)] @@ -982,6 +997,8 @@ pub struct Request { pub system: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub metadata: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub output_config: Option, #[serde(default, skip_serializing_if = "Vec::is_empty")] pub stop_sequences: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/crates/edit_prediction_cli/src/anthropic_client.rs b/crates/edit_prediction_cli/src/anthropic_client.rs index 653fddd58b3567697ca5c9024ea4944e3005016f..20f40a240e819885179d7175d6c7e4d9e266130d 100644 --- a/crates/edit_prediction_cli/src/anthropic_client.rs +++ b/crates/edit_prediction_cli/src/anthropic_client.rs @@ -47,6 +47,7 @@ impl PlainLlmClient { tool_choice: None, system: None, metadata: None, + output_config: None, stop_sequences: Vec::new(), temperature: None, top_k: None, @@ -85,6 +86,7 @@ impl PlainLlmClient { tool_choice: None, system: None, metadata: None, + output_config: None, stop_sequences: Vec::new(), temperature: None, top_k: None, @@ -560,6 +562,7 @@ impl BatchingLlmClient { tool_choice: None, system: None, metadata: None, + output_config: None, stop_sequences: Vec::new(), temperature: None, top_k: None, diff --git a/crates/language_models/src/provider/anthropic.rs b/crates/language_models/src/provider/anthropic.rs index 3ea4a8ee37d76474714d6a4b875982e11f5c691b..7f8f7a1efb3aadcfe913c112103b63c3674bc581 100644 --- a/crates/language_models/src/provider/anthropic.rs +++ b/crates/language_models/src/provider/anthropic.rs @@ -779,6 +779,7 @@ pub fn into_anthropic( LanguageModelToolChoice::None => anthropic::ToolChoice::None, }), metadata: None, + output_config: None, stop_sequences: Vec::new(), temperature: request.temperature.or(Some(default_temperature)), top_k: None,