Skip to content

Commit 81d0c98

Browse files
georgestaggsharon-wangtimtmok
authored
Assistant: Improve managing language models (#9799)
This PR makes a few changes in an attempt to improve managing LLM provider models. The manage models quickpick menu has been improved: * Copilot's BYOK providers, particularly ones that Assistant does not currently support (e.g. Grok) are no longer shown. * Only providers that the user has signed in with are shown * The `managementCommand` property has been added to Assistant providers, so that the cog icon works. * These changes address #9283. A new configuration setting `positron.assistant.filterModels` has been added. With this users (and in the future admins) can set glob filters. Models will only be shown if they match one of the given globs. * This addresses #9788. A `positron.assistant.preferredModel` setting has been added. With this, when the Positron window first loads it should default to loading the model given in that setting. Here we use partial matching on the ID or model names. * This partially addresses #9388, in that IIUC it matches the behaviour requested in the [final comment](#9388 (comment)) of that thread. A `positron.assistant.defaultModels` settings has been added. With this, users can specify the default model for a particular provider, which we will pre-select in the model selector if the user hasn't specified a preferred model instead. * This addresses the remaining parts of #9388 based on #9799 (comment). * We have set the default model for Anthropic to `Claude Sonnet 4` and Bedrock to `Claude 4 Sonnet Bedrock` --- ### Release Notes #### New Features - Assistant: added setting `positron.assistant.filterModels` to configure available models (#9788) - Assistant: added setting `positron.assistant.preferredModel` to set the preferred model to pre-select in the model selector (#9388) - Assistant: added setting `positron.assistant.defaultModels` to set the default model per provider (#9388) #### Bug Fixes - Assistant: non-functional providers removed from "Manage models..." quickpick (#9283) ### QA Notes #### Manage models quickpick 1. First, ensure you have multiple providers configured and signed in. I used Anthropic, AWS Bedrock, and GitHub Copilot Chat. 2. In the Assistant panel, invoke the model picker: <img width="403" height="173" alt="Screenshot 2025-10-06 at 15 42 22" src="https://github.com/user-attachments/assets/2cc33831-37c3-4f46-a1fc-887f32d93311" /> 3. Ensure only useful entries are shown: <img width="620" height="196" alt="Screenshot 2025-10-06 at 15 42 27" src="https://github.com/user-attachments/assets/d644d1ea-f198-4bdb-bc3c-752c0fe8e20a" /> 4. Select a _signed in_ model, ensure a model list appears: <img width="617" height="297" alt="Screenshot 2025-10-06 at 15 42 39" src="https://github.com/user-attachments/assets/9fcef6a6-f623-4349-8529-27f1e6713bb3" /> 5. Do the same but select a signed out model, ensure the model configuration modal appears. 6. Do the same thing with a _signed in_ model but click the cog on the far right, the model configuration modal should again appear. #### Model filtering 1. In your user settings, set the following two filters: ``` "positron.assistant.filterModels": ["Claude*", "GPT-5"], ``` 2. Restart Positron or Reload the window. 3. Ensure that only Claude family models or GPT-5 can be used: <img width="366" height="238" alt="Screenshot 2025-10-06 at 15 49 04" src="https://github.com/user-attachments/assets/3e7ac3ed-b9bd-41a8-b8a4-ca7b2bf0aca3" /> 4. This should also work with IDs, useful for e.g. OpenRouter: ``` "positron.assistant.filterModels": ["**/google/gemini-*"], ``` <img width="431" height="389" alt="Screenshot 2025-10-06 at 16 07 43" src="https://github.com/user-attachments/assets/c54e9720-ab3b-429b-a33d-4485dbc454fd" /> 5. Finally, this should also restrict the manage models quickpick: <img width="604" height="476" alt="Screenshot 2025-10-06 at 16 08 20" src="https://github.com/user-attachments/assets/e1c45c9e-ca16-46c6-9f51-0ca3140dd954" /> #### Setting preferred model 1. In your user settings, remove the `positron.assistant.filterModels` setting and set the following: ``` "positron.assistant.preferredModel": "GPT-5", ``` 2. In the Assistant chat panel, switch to another provider and model, e.g. AWS Bedrock and Claude 4 Sonnet. 3. Create a new chat, ensure selected model does not change. 4. Reload the window, ensure that on reload the preferred model set in the configuration is first selected. In this case, it should switch to GPT-5 from the Copilot provider on reload. #### Setting default model per provider 1. Sign into multiple providers, at least Anthropic and AWS Bedrock. 2. Try switching between them, confirm that the defaults we want by default are selected. 3. Set the following settings, ``` "positron.assistant.defaultModels": { "anthropic-api": "Opus", "amazon-bedrock": "Opus" }, ``` 4. Reload the window, confirm that switching between the models now selects Opus models by default. Note 1: Upstream has code to remember your last selection, so after the reload window you have to change providers to see the default kick in. Note 2: Sometimes Assistant gets stuck in a state showing "Pick Model..." in the selector. Switching providers does nothing to clear that, but selecting a model first, and then switching providers, gets things working again. I don't know if this is related to this commit, or the changes in #9799. --------- Co-authored-by: sharon wang <[email protected]> Co-authored-by: Tim Mok <[email protected]>
1 parent 839c705 commit 81d0c98

File tree

11 files changed

+327
-42
lines changed

11 files changed

+327
-42
lines changed

extensions/positron-assistant/package.json

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,31 +287,77 @@
287287
"default": 60,
288288
"description": "%configuration.providerTimeout.description%",
289289
"minimum": 1
290+
},
291+
"positron.assistant.filterModels": {
292+
"type": "array",
293+
"default": [
294+
"**/*"
295+
],
296+
"markdownDescription": "%configuration.filterModels.description%",
297+
"items": {
298+
"type": "string"
299+
},
300+
"examples": [
301+
[
302+
"Claude*",
303+
"GPT-5"
304+
],
305+
[
306+
"**/google/gemini*"
307+
]
308+
]
309+
},
310+
"positron.assistant.preferredModel": {
311+
"type": "string",
312+
"default": "",
313+
"markdownDescription": "%configuration.preferredModel.description%",
314+
"examples": [
315+
"Claude Sonnet 4.5",
316+
"GPT-5"
317+
]
318+
},
319+
"positron.assistant.defaultModels": {
320+
"type": "object",
321+
"default": {},
322+
"additionalProperties": {
323+
"type": "string"
324+
},
325+
"markdownDescription": "%configuration.defaultModels.description%",
326+
"examples": [
327+
{
328+
"anthropic-api": "Claude Sonnet 4.5"
329+
}
330+
]
290331
}
291332
}
292333
}
293334
],
294335
"languageModels": [
295336
{
296337
"vendor": "echo",
297-
"displayName": "Echo"
338+
"displayName": "Echo",
339+
"managementCommand": "positron-assistant.configureModels"
298340
},
299341
{
300342
"vendor": "amazon-bedrock",
301-
"displayName": "Amazon Bedrock"
343+
"displayName": "Amazon Bedrock",
344+
"managementCommand": "positron-assistant.configureModels"
302345
},
303346
{
304347
"vendor": "anthropic-api",
305-
"displayName": "Anthropic"
348+
"displayName": "Anthropic",
349+
"managementCommand": "positron-assistant.configureModels"
306350
},
307351
{
308352
"vendor": "openai",
309-
"displayName": "OpenAI"
353+
"displayName": "OpenAI",
354+
"managementCommand": "positron-assistant.configureModels"
310355
},
311-
{
312-
"vendor": "openai-compatible",
313-
"displayName": "Custom Provider"
314-
}
356+
{
357+
"vendor": "openai-compatible",
358+
"displayName": "Custom Provider",
359+
"managementCommand": "positron-assistant.configureModels"
360+
}
315361
],
316362
"languageModelTools": [
317363
{

extensions/positron-assistant/package.nls.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,8 @@
3434
"configuration.followups.enable.description": "Enable suggested followup prompts after chat responses.",
3535
"configuration.consoleActions.enable.description": "Enable Positron Assistant console actions, such as Fix and Explain.",
3636
"configuration.providerTimeout.description": "Specifies the timeout in seconds when signing in to a provider.",
37-
"configuration.alwaysIncludeCopilotTools.description": "Allow any model in Positron Assistant to use tools provided by GitHub Copilot.\n\nThis requires that you are signed into Copilot, and **may send data to Copilot models regardless of the selected provider**.\n\nSee also: `#chat.useCopilotParticipantsWithOtherProviders#`"
37+
"configuration.alwaysIncludeCopilotTools.description": "Allow any model in Positron Assistant to use tools provided by GitHub Copilot.\n\nThis requires that you are signed into Copilot, and **may send data to Copilot models regardless of the selected provider**.\n\nSee also: `#chat.useCopilotParticipantsWithOtherProviders#`",
38+
"configuration.filterModels.description": "A list of [glob patterns](https://aka.ms/vscode-glob-patterns) to filter available LLM models in Positron Assistant.\n\nAllows only language models with ID or name matching at least one of the patterns to be used. Defaults to allowing all models.\n\nRequires a restart to take effect.\n\nExamples:\n- `Claude*` allows all models starting with 'Claude'\n- `GPT-5` allows models named 'GPT-5'\n- `**/google/gemini-*` allows all models with '/google/gemini-' in the ID",
39+
"configuration.preferredModel.description": "A preferred model ID or name (partial match supported) to use if available in Positron Assistant for the current provider.\n\nTakes precedence over `#positron.assistant.defaultModels#`.\n\nRequires a restart to take effect.\n\nExamples:\n- `Claude Sonnet 4.5` prefers the model named 'Claude Sonnet 4.5'\n- `GPT-5` prefers the model named 'GPT-5'",
40+
"configuration.defaultModels.description": "A mapping of provider IDs to default model IDs or names (partial match supported) to use for that provider in Positron Assistant.\n\n`#positron.assistant.preferredModel#` takes precedence over this setting.\n\nRequires a restart to take effect.\n\nExample: Item `anthropic-api` and Value `Claude Sonnet 4.5` sets the default model for Anthropic to 'Claude Sonnet 4.5'"
3841
}

extensions/positron-assistant/src/anthropic.ts

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { DEFAULT_MAX_TOKEN_INPUT, DEFAULT_MAX_TOKEN_OUTPUT } from './constants.j
1212
import { log, recordTokenUsage, recordRequestTokenUsage } from './extension.js';
1313
import { TokenUsage } from './tokens.js';
1414
import { availableModels } from './models.js';
15+
import { LanguageModelDataPartMimeType } from './types.js';
16+
17+
export const DEFAULT_ANTHROPIC_MODEL_NAME = 'Claude Sonnet 4';
18+
export const DEFAULT_ANTHROPIC_MODEL_MATCH = 'claude-sonnet-4';
1519

1620
/**
1721
* Options for controlling cache behavior in the Anthropic language model.
@@ -59,8 +63,8 @@ export class AnthropicLanguageModel implements positron.ai.LanguageModelChatProv
5963
},
6064
supportedOptions: ['apiKey', 'apiKeyEnvVar'],
6165
defaults: {
62-
name: 'Claude 3.5 Sonnet v2',
63-
model: 'claude-3-5-sonnet-latest',
66+
name: DEFAULT_ANTHROPIC_MODEL_NAME,
67+
model: DEFAULT_ANTHROPIC_MODEL_MATCH + '-latest',
6468
toolCalls: true,
6569
apiKeyEnvVar: { key: 'ANTHROPIC_API_KEY', signedIn: false },
6670
},
@@ -239,6 +243,17 @@ export class AnthropicLanguageModel implements positron.ai.LanguageModelChatProv
239243
return AnthropicLanguageModel.source.provider.displayName;
240244
}
241245

246+
private isDefaultUserModel(id: string, name?: string): boolean {
247+
const config = vscode.workspace.getConfiguration('positron.assistant');
248+
const defaultModels = config.get<Record<string, string>>('defaultModels') || {};
249+
if ('anthropic-api' in defaultModels) {
250+
if (id.includes(defaultModels['anthropic-api']) || name?.includes(defaultModels['anthropic-api'])) {
251+
return true;
252+
}
253+
}
254+
return id.includes(DEFAULT_ANTHROPIC_MODEL_MATCH);
255+
}
256+
242257
private onContentBlock(block: Anthropic.ContentBlock, progress: vscode.Progress<vscode.ChatResponseFragment2>): void {
243258
switch (block.type) {
244259
case 'tool_use':
@@ -308,7 +323,6 @@ export class AnthropicLanguageModel implements positron.ai.LanguageModelChatProv
308323
const userSetMaxOutputTokens: Record<string, number> = vscode.workspace.getConfiguration('positron.assistant').get('maxOutputTokens', {});
309324
let hasMore = true;
310325
let nextPageToken: string | undefined;
311-
let isFirst = true;
312326

313327
log.trace(`Fetching models from Anthropic API for provider ${this.provider}`);
314328

@@ -334,10 +348,9 @@ export class AnthropicLanguageModel implements positron.ai.LanguageModelChatProv
334348
maxInputTokens: maxInputTokens,
335349
maxOutputTokens: maxOutputTokens,
336350
capabilities: this.capabilities,
337-
isDefault: isFirst,
351+
isDefault: this.isDefaultUserModel(model.id, model.display_name),
338352
isUserSelectable: true,
339353
});
340-
isFirst = false;
341354
});
342355

343356
hasMore = modelsPage.has_more;
@@ -346,6 +359,26 @@ export class AnthropicLanguageModel implements positron.ai.LanguageModelChatProv
346359
}
347360
}
348361

362+
// Mark models as default, ensuring only one default per provider
363+
let hasDefault = false;
364+
for (let i = 0; i < modelListing.length; i++) {
365+
const model = modelListing[i];
366+
if (!hasDefault && this.isDefaultUserModel(model.id, model.name)) {
367+
modelListing[i] = { ...model, isDefault: true };
368+
hasDefault = true;
369+
} else {
370+
modelListing[i] = { ...model, isDefault: false };
371+
}
372+
}
373+
374+
// If no models match the default ID, make the first model the default.
375+
if (modelListing.length > 0 && !hasDefault) {
376+
modelListing[0] = {
377+
...modelListing[0],
378+
isDefault: true,
379+
};
380+
}
381+
349382
this.modelListing = modelListing;
350383

351384
return modelListing;
@@ -429,10 +462,12 @@ function toAnthropicUserMessage(message: vscode.LanguageModelChatMessage2, sourc
429462
content.push(chatImagePartToAnthropicImageBlock(part, source, dataPart));
430463
} else {
431464
// Skip other data parts.
432-
log.debug(`[anthropic] Skipping unsupported part in user message: ${JSON.stringify(part, null, 2)}`);
465+
if (part.mimeType !== LanguageModelDataPartMimeType.CacheControl) {
466+
log.debug(`[anthropic] Skipping unsupported part in user message: ${JSON.stringify(part, null, 2)}`);
467+
}
433468
}
434469
} else {
435-
throw new Error('Unsupported part type on user message');
470+
throw new Error(`Unsupported part type on user message: ${JSON.stringify(part, null, 2)}`);
436471
}
437472
}
438473
return {

extensions/positron-assistant/src/completion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ class AWSCompletion extends FimPromptCompletion {
531531
type: positron.PositronLanguageModelType.Completion,
532532
provider: {
533533
id: 'amazon-bedrock',
534-
displayName: 'AWS Bedrock'
534+
displayName: 'Amazon Bedrock'
535535
},
536536
supportedOptions: [],
537537
defaults: {

extensions/positron-assistant/src/models.ts

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { createOpenRouter, OpenRouterProvider } from '@openrouter/ai-sdk-provide
1818
import { markBedrockCacheBreakpoint, processMessages, toAIMessage } from './utils';
1919
import { AmazonBedrockProvider, createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
2020
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
21-
import { AnthropicLanguageModel } from './anthropic';
21+
import { AnthropicLanguageModel, DEFAULT_ANTHROPIC_MODEL_MATCH, DEFAULT_ANTHROPIC_MODEL_NAME } from './anthropic';
2222
import { DEFAULT_MAX_TOKEN_INPUT, DEFAULT_MAX_TOKEN_OUTPUT } from './constants.js';
2323
import { log, recordRequestTokenUsage, recordTokenUsage } from './extension.js';
2424
import { TokenUsage } from './tokens.js';
@@ -347,7 +347,6 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
347347
}
348348

349349
// Return the available models for this provider
350-
// The first model is the default model
351350
const languageModels: vscode.LanguageModelChatInformation[] = models.map((m, index) => {
352351
const modelId = 'identifier' in m ? m.identifier : m.id;
353352
const aiModel = this.aiProvider(modelId);
@@ -359,12 +358,19 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
359358
maxInputTokens: this.getMaxTokens(aiModel.modelId, 'input'),
360359
maxOutputTokens: this.getMaxTokens(aiModel.modelId, 'output'),
361360
capabilities: this.capabilities,
362-
// is default if it's the first model out of models
363-
isDefault: index === 0,
361+
isDefault: this.isDefaultUserModel(modelId, m.name),
364362
isUserSelectable: true,
365363
};
366364
});
367365

366+
// If no models match the default ID, make the first model the default.
367+
if (languageModels.length > 0 && !languageModels.some(m => m.isDefault)) {
368+
languageModels[0] = {
369+
...languageModels[0],
370+
isDefault: true,
371+
};
372+
}
373+
368374
return languageModels;
369375
}
370376

@@ -429,8 +435,8 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
429435
const modelTools = this._config.toolCalls ? tools : undefined;
430436
const requestId = (options.modelOptions as any)?.requestId;
431437

432-
log.info(`[vercel] Start request ${requestId} to ${this._config.name} [${aiModel.modelId}]: ${aiMessages.length} messages`);
433-
log.debug(`[${this._config.name}] SEND ${aiMessages.length} messages, ${modelTools ? Object.keys(modelTools).length : 0} tools`);
438+
log.info(`[vercel] Start request ${requestId} to ${model.name} [${aiModel.modelId}]: ${aiMessages.length} messages`);
439+
log.debug(`[${model.name}] SEND ${aiMessages.length} messages, ${modelTools ? Object.keys(modelTools).length : 0} tools`);
434440
if (modelTools) {
435441
log.trace(`tools: ${modelTools ? Object.keys(modelTools).join(', ') : '(none)'}`);
436442
}
@@ -456,7 +462,7 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
456462
const flushAccumulatedTextDeltas = () => {
457463
if (accumulatedTextDeltas.length > 0) {
458464
const combinedText = accumulatedTextDeltas.join('');
459-
log.trace(`[${this._config.name}] RECV text-delta (${accumulatedTextDeltas.length} parts): ${combinedText}`);
465+
log.trace(`[${model.name}] RECV text-delta (${accumulatedTextDeltas.length} parts): ${combinedText}`);
460466
accumulatedTextDeltas = [];
461467
}
462468
};
@@ -468,7 +474,7 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
468474

469475
if (part.type === 'reasoning') {
470476
flushAccumulatedTextDeltas();
471-
log.trace(`[${this._config.name}] RECV reasoning: ${part.textDelta}`);
477+
log.trace(`[${model.name}] RECV reasoning: ${part.textDelta}`);
472478
progress.report({
473479
index: 0,
474480
part: new vscode.LanguageModelTextPart(part.textDelta)
@@ -485,7 +491,7 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
485491

486492
if (part.type === 'tool-call') {
487493
flushAccumulatedTextDeltas();
488-
log.trace(`[${this._config.name}] RECV tool-call: ${part.toolCallId} (${part.toolName}) with args: ${JSON.stringify(part.args)}`);
494+
log.trace(`[${model.name}] RECV tool-call: ${part.toolCallId} (${part.toolName}) with args: ${JSON.stringify(part.args)}`);
489495
progress.report({
490496
index: 0,
491497
part: new vscode.LanguageModelToolCallPart(part.toolCallId, part.toolName, part.args)
@@ -494,7 +500,7 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
494500

495501
if (part.type === 'error') {
496502
flushAccumulatedTextDeltas();
497-
log.warn(`[${this._config.name}] RECV error: ${JSON.stringify(part.error)}`);
503+
log.warn(`[${model.name}] RECV error: ${JSON.stringify(part.error)}`);
498504

499505
const providerErrorMessage = this.parseProviderError(part.error);
500506
if (providerErrorMessage) {
@@ -515,7 +521,7 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
515521
result.warnings.then((warnings) => {
516522
if (warnings) {
517523
for (const warning of warnings) {
518-
log.warn(`[${aiModel.modelId}] (${this.id}) warn: ${warning}`);
524+
log.warn(`[${aiModel.modelId}] (${this.provider}) warn: ${warning}`);
519525
}
520526
}
521527
});
@@ -545,7 +551,7 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
545551
progress.report({ index: 0, part: part });
546552

547553
// Log the Bedrock usage
548-
log.debug(`[${this._config.name}]: Bedrock usage: ${JSON.stringify(usage, null, 2)}`);
554+
log.debug(`[${model.name}]: Bedrock usage: ${JSON.stringify(usage, null, 2)}`);
549555
}
550556

551557
if (requestId) {
@@ -605,14 +611,25 @@ abstract class AILanguageModel implements positron.ai.LanguageModelChatProvider2
605611
maxInputTokens: 0,
606612
maxOutputTokens: model.maxOutputTokens ?? DEFAULT_MAX_TOKEN_OUTPUT,
607613
capabilities: this.capabilities,
608-
isDefault: false,
614+
isDefault: this.isDefaultUserModel(model.identifier, model.name),
609615
isUserSelectable: true,
610616
} satisfies vscode.LanguageModelChatInformation)));
611617
} else {
612618
resolve(undefined);
613619
}
614620
});
615621
}
622+
623+
protected isDefaultUserModel(id: string, name?: string): boolean {
624+
const config = vscode.workspace.getConfiguration('positron.assistant');
625+
const defaultModels = config.get<Record<string, string>>('defaultModels') || {};
626+
if (this.provider in defaultModels) {
627+
if (id.includes(defaultModels[this.provider]) || name?.includes(defaultModels[this.provider])) {
628+
return true;
629+
}
630+
}
631+
return this._config.model === id;
632+
}
616633
}
617634

618635
class AnthropicAILanguageModel extends AILanguageModel implements positron.ai.LanguageModelChatProvider2 {
@@ -629,8 +646,8 @@ class AnthropicAILanguageModel extends AILanguageModel implements positron.ai.La
629646
},
630647
supportedOptions: ['apiKey', 'apiKeyEnvVar'],
631648
defaults: {
632-
name: 'Claude 3.5 Sonnet v2',
633-
model: 'claude-3-5-sonnet-latest',
649+
name: DEFAULT_ANTHROPIC_MODEL_NAME,
650+
model: DEFAULT_ANTHROPIC_MODEL_MATCH + '-latest',
634651
toolCalls: true,
635652
apiKeyEnvVar: { key: 'ANTHROPIC_API_KEY', signedIn: false },
636653
},
@@ -960,17 +977,23 @@ export class AWSLanguageModel extends AILanguageModel implements positron.ai.Lan
960977
type: positron.PositronLanguageModelType.Chat,
961978
provider: {
962979
id: 'amazon-bedrock',
963-
displayName: 'AWS Bedrock'
980+
displayName: 'Amazon Bedrock'
964981
},
965982
supportedOptions: ['toolCalls'],
966983
defaults: {
967-
name: 'Claude 3.5 Sonnet v2 Bedrock',
968-
model: 'us.anthropic.claude-3-5-sonnet-20241022-v2:0',
984+
name: 'Claude 4 Sonnet Bedrock',
985+
model: 'us.anthropic.claude-sonnet-4-20250514-v1:0',
969986
toolCalls: true,
970987
},
971988
};
972989

973990
constructor(_config: ModelConfig, _context?: vscode.ExtensionContext) {
991+
// Update a stale model configuration to the latest defaults
992+
const models = availableModels.get('amazon-bedrock')?.map(m => m.identifier) || [];
993+
if (!(_config.model in models)) {
994+
_config.name = AWSLanguageModel.source.defaults.name;
995+
_config.model = AWSLanguageModel.source.defaults.model;
996+
}
974997
super(_config, _context);
975998

976999
this.aiProvider = createAmazonBedrock({
@@ -1011,7 +1034,7 @@ export class AWSLanguageModel extends AILanguageModel implements positron.ai.Lan
10111034
return vscode.l10n.t(`Invalid AWS credentials. {0}`, message);
10121035
}
10131036

1014-
return vscode.l10n.t(`AWS Bedrock error: {0}`, message);
1037+
return vscode.l10n.t(`Amazon Bedrock error: {0}`, message);
10151038
}
10161039
}
10171040

0 commit comments

Comments
 (0)