Skip to content

Support effort parameter for extended thinking, graduate thinking budget setting, and clean up CAPI path#4670

Open
bhavyaus wants to merge 1 commit intomainfrom
dev/bhavyau/effort-extended-thinking
Open

Support effort parameter for extended thinking, graduate thinking budget setting, and clean up CAPI path#4670
bhavyaus wants to merge 1 commit intomainfrom
dev/bhavyau/effort-extended-thinking

Conversation

@bhavyaus
Copy link
Contributor

Summary

Three related changes to Anthropic thinking/effort configuration:

1. Support effort parameter for extended thinking

Previously, the effort parameter in output_config was only set when adaptive thinking was enabled (thinkingConfig.type === "adaptive"). The Anthropic docs confirm that effort works with both adaptive and extended thinking. This change broadens the condition to set effort whenever any thinkingConfig is present.

File: src/platform/endpoint/node/messagesApi.ts

2. Graduate AnthropicThinkingBudget from experimental to stable

  • Changed from ConfigType.ExperimentBased to ConfigType.Simple with a default of 16,000 tokens
  • Moved the setting out of the "preview" section in package.json to the main configuration section
  • Removed "preview" and "onExp" tags
  • Updated all callers from getExperimentBasedConfig() to getConfig()

Files: configurationService.ts, package.json, anthropicProvider.ts, messagesApi.ts, chatEndpoint.ts

3. Clean up CAPI thinking budget path

The thinking_budget logic in customizeCapiBody (Chat Completions API path) was already removed from production code. This PR removes the corresponding 17 tests in copilotChatEndpoint.spec.ts that were testing that defunct code path, along with unused imports and helper functions (createAnthropicModelMetadata, createUserMessage, ConfigKey, ChatLocation).

File: src/platform/endpoint/node/test/copilotChatEndpoint.spec.ts

Copilot AI review requested due to automatic review settings March 24, 2026 23:25
…get setting, and clean up CAPI thinking budget path
@bhavyaus bhavyaus force-pushed the dev/bhavyau/effort-extended-thinking branch from 18c0345 to 3ed6a9f Compare March 24, 2026 23:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Anthropic “thinking” configuration and request shaping to align with current Anthropic API semantics, promotes the thinking budget setting to a stable configuration, and removes now-unneeded Chat Completions (CAPI) thinking-budget handling and its associated tests.

Changes:

  • Send output_config.effort whenever Anthropic thinking is enabled (not only for adaptive thinking) on the Messages API path.
  • Graduate AnthropicThinkingBudget to a stable ConfigType.Simple setting and expose it outside of preview configuration.
  • Remove legacy thinking_budget handling on the Chat Completions (CAPI) path and delete the tests that covered that path.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/platform/endpoint/node/messagesApi.ts Broadens when effort is included and switches thinking budget read to getConfig().
src/platform/configuration/common/configurationService.ts Changes AnthropicThinkingBudget from experiment-based to simple config.
src/extension/byok/vscode-node/anthropicProvider.ts Updates thinking budget retrieval to getConfig().
src/platform/endpoint/node/chatEndpoint.ts Removes Anthropic thinking_budget mutation from the CAPI request body path.
src/platform/endpoint/node/test/copilotChatEndpoint.spec.ts Deletes tests and helpers for the removed CAPI thinking-budget behavior.
package.json Moves github.copilot.chat.anthropic.thinking.budgetTokens out of preview and makes it stable.
Comments suppressed due to low confidence (1)

src/platform/endpoint/node/chatEndpoint.ts:349

  • Removing the thinking_budget mutation from customizeCapiBody means Anthropic extended-thinking budget is no longer applied when a Claude/Anthropic model is routed through the Chat Completions (CAPI) path (e.g., when UseAnthropicMessagesApi is off or when supported_endpoints doesn’t include Messages). If that routing can still happen, enableThinking + AnthropicThinkingBudget becomes a silent no-op for those requests. Consider either (1) guaranteeing Anthropic models never use the CAPI path (and/or adding an explicit assertion/telemetry when they do), or (2) preserving equivalent thinking-budget behavior for the CAPI body so the setting continues to work under fallback routing.
	protected customizeCapiBody(body: IEndpointBody, options: ICreateEndpointBodyOptions): IEndpointBody {

		// Apply Gemini function calling mode if configured
		const hasTools = !!options.requestOptions?.tools?.length;
		if (hasTools && this.family.toLowerCase().includes('gemini-3')) {
			const geminiFunctionCallingMode = this._configurationService.getExperimentBasedConfig(
				ConfigKey.TeamInternal.GeminiFunctionCallingMode,

@bhavyaus bhavyaus added this pull request to the merge queue Mar 25, 2026
github-merge-queue bot pushed a commit that referenced this pull request Mar 25, 2026
…get setting, and clean up CAPI thinking budget path (#4670)
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 25, 2026
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.

3 participants