Skip to content

Add per-model configuration support for language models#302771

Merged
sandy081 merged 165 commits intomainfrom
copilot/mild-rodent
Mar 18, 2026
Merged

Add per-model configuration support for language models#302771
sandy081 merged 165 commits intomainfrom
copilot/mild-rodent

Conversation

@sandy081
Copy link
Member

Summary

Adds per-model configuration support, allowing extensions to declare configurable properties per model (e.g., thinking effort for Anthropic models) via a configurationSchema, and users can customize values through the model management editor and chatLanguageModels.json.

What's included

Extension API (vscode.proposed.chatProvider.d.ts)

  • configurationSchema on LanguageModelChatInformation — extensions declare per-model config properties
  • modelConfiguration on ProvideLanguageModelChatResponseOptions — resolved config passed to providers at request time
  • modelConfiguration on ChatRequest — resolved config available to chat participants

Core service (languageModels.ts)

  • getModelConfiguration(modelId) — returns resolved config (schema defaults + user overrides)
  • setModelConfiguration(modelId, values) — persists per-model config, auto-removes default values
  • getModelConfigurationActions(modelId) — returns SubmenuAction[] for enum-based config properties
  • configureModel(modelId) — opens chatLanguageModels.json with snippet for the model
  • Config stored under settings property in chatLanguageModels.json groups

Model management editor (chatModelsWidget.ts)

  • Gear menu and context menu with per-model config actions

Config delivery

  • sendChatRequest merges stored config into options (caller overrides take precedence)
  • IChatAgentRequest.modelConfiguration carries config to chat participants
  • Subagent tool forwards model configuration

JSON schema (languageModelsConfigurationService.ts)

  • IntelliSense support for per-model settings in chatLanguageModels.json via if/then conditional schemas

Tests

  • Unit tests for getModelConfiguration, default merging, unknown models
  • Mock service updates for test compatibility

sandy081 added 30 commits March 11, 2026 15:28
… interface and revert chatProvider version to 4
sandy081 and others added 14 commits March 17, 2026 15:24
…ify navigation properties handling and remove unused language models service references
…d support for enum icons in model configuration
…eplace enumIcons with a single icon property for configuration
…emove icon property from configuration schema
…er is opened by the ModelConfigPickerActionItem view item on click
…move OpenModelConfigPickerAction and chatModelHasNavigationConfig context key

The config picker dropdown button in the chat input has been removed while keeping the underlying per-model configuration API, settings support, and model management editor intact.

Also fix ILanguageModelConfigurationSchema to not include boolean in properties type (incompatible with IJSONSchema), and add showUnavailableFeatured/showFeatured to IModelPickerDelegate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Make showUnavailableFeatured/showFeatured optional on IModelPickerDelegate
  (defaults to true), removing the need to change newChatViewPane.ts
- Fix sendChatRequest merge order: caller's configuration takes precedence
  over stored model config
- Remove dead typeof propSchema !== 'boolean' checks after type cleanup

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These files were modified to add showUnavailableFeatured/showFeatured
which already landed on main separately. Revert to merge-base versions
to keep the diff clean.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Revert to merge-base version — the diff was from main changes
(delegation picker, showUnavailableFeatured/showFeatured) that
will come in on merge.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 18, 2026 11:13
@sandy081 sandy081 self-assigned this Mar 18, 2026
@sandy081 sandy081 enabled auto-merge (squash) March 18, 2026 11:15
@vs-code-engineering vs-code-engineering bot added this to the 1.113.0 milestone Mar 18, 2026
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

Adds per-model configuration support for language models, allowing model providers to declare configurable per-model settings (via a schema) and having resolved configuration flow through core, UI, and the extension host into providers/participants.

Changes:

  • Extend proposed API to allow models to declare a configurationSchema and to expose resolved modelConfiguration on requests.
  • Implement per-model configuration resolution/storage in LanguageModelsService and surface enum-based config actions in the model management UI.
  • Propagate resolved configuration through chat requests (including subagent invocations) and add unit tests for config merging/defaults.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vscode-dts/vscode.proposed.chatProvider.d.ts Adds proposed API surface for per-model config schema + resolved config on requests.
src/vs/workbench/contrib/chat/common/languageModels.ts Core implementation: config caching, merging defaults, persistence, and UI actions.
src/vs/workbench/contrib/chat/common/languageModelsConfiguration.ts Extends provider group model to include settings for per-model config.
src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.ts Adds JSON schema/intellisense support for settings in chatLanguageModels.json.
src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.ts Adds model gear/context menu entries for per-model configuration actions.
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts Carries model configuration into chat agent request construction.
src/vs/workbench/contrib/chat/common/participants/chatAgents.ts Extends IChatAgentRequest to include modelConfiguration.
src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.ts Forwards model configuration into subagent invocations.
src/vs/workbench/api/common/extHostTypeConverters.ts Exposes model configuration on vscode.ChatRequest objects.
src/vs/workbench/api/common/extHostLanguageModels.ts Passes resolved per-model config into provider options (modelConfiguration).
src/vs/workbench/api/common/extHostChatSessions.ts Threads modelConfiguration through session request handling.
src/vs/workbench/api/common/extHostChatAgents2.ts Threads modelConfiguration through agent/detector request conversion.
src/vs/workbench/api/common/extHost.protocol.ts Updates protocol types for request options plumbing.
src/vs/workbench/contrib/chat/test/common/languageModels.ts Updates mock service surface to match new ILanguageModelsService API.
src/vs/workbench/contrib/chat/test/common/languageModels.test.ts Adds unit tests for resolved per-model config and default merging.
src/vs/workbench/contrib/chat/test/browser/chatManagement/chatModelsViewModel.test.ts Updates mock service to satisfy new interface requirements.
Comments suppressed due to low confidence (2)

src/vs/workbench/contrib/chat/common/languageModels.ts:1098

  • Default-value pruning uses propSchema.default === value, which will fail for non-primitive defaults (objects/arrays) and can leave default values persisted. Consider using the existing equals(...) helper (already imported) for JSON-schema defaults, or otherwise ensuring deep equality when comparing defaults.
		if (schema?.properties) {
			for (const [key, value] of Object.entries(updatedConfig)) {
				const propSchema = schema.properties[key];
				if (propSchema?.default !== undefined && propSchema.default === value) {
					delete updatedConfig[key];
				}
			}

src/vs/workbench/contrib/chat/common/languageModels.ts:1074

  • New behavior in setModelConfiguration (merging values, pruning defaults, and updating/removing groups) isn’t covered by tests. Adding unit tests for default-pruning and group removal/creation would help prevent regressions as the per-model settings format evolves.
	async setModelConfiguration(modelId: string, values: IStringDictionary<unknown>): Promise<void> {
		const metadata = this._modelCache.get(modelId);
		if (!metadata) {
			return;
		}

You can also share your feedback on Copilot code review. Take the survey.

sandy081 and others added 6 commits March 18, 2026 12:36
The property was renamed from 'models' to 'settings' in the
ILanguageModelsProviderGroup interface but the test still used
the old name, causing configs to not be found.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Previously, _resolveModelConfiguration was called when collecting
per-model configs, which resolved secret references into plaintext.
The resolved values were then cached in _modelConfigurations, and
setModelConfiguration could inadvertently persist plaintext secrets
back into chatLanguageModels.json.

Now store raw config (with secret references intact) and remove the
unused _resolveModelConfiguration method. Per-model config properties
don't use secrets in practice (they're for temperature, reasoning
effort, etc.), but this prevents any future secret leakage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081 sandy081 force-pushed the copilot/mild-rodent branch from 7f2c61e to a42f842 Compare March 18, 2026 12:56
@sandy081 sandy081 merged commit e8df039 into main Mar 18, 2026
21 checks passed
@sandy081 sandy081 deleted the copilot/mild-rodent branch March 18, 2026 13:35
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