Skip to content

Commit e827f35

Browse files
committed
feat: add model description to dropdown
1 parent 1f6b7f7 commit e827f35

File tree

10 files changed

+42
-31
lines changed

10 files changed

+42
-31
lines changed

chat-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"package": "webpack"
2525
},
2626
"dependencies": {
27-
"@aws/chat-client-ui-types": "^0.1.56",
27+
"@aws/chat-client-ui-types": "^0.1.57",
2828
"@aws/language-server-runtimes": "^0.2.129",
2929
"@aws/language-server-runtimes-types": "^0.1.50",
3030
"@aws/mynah-ui": "^4.36.6"

chat-client/src/client/mynahUi.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ describe('MynahUI', () => {
571571
// Simulate the response from the server
572572
const models = [
573573
{ id: 'CLAUDE_3_7_SONNET_20250219_V1_0', name: 'Claude Sonnet 3.7' },
574-
{ id: 'CLAUDE_SONNET_4_20250514_V1_0', name: 'Claude Sonnet 4' },
574+
{ id: 'CLAUDE_SONNET_4_20250514_V1_0', name: 'Claude Sonnet 4', description: 'Test description' },
575575
]
576576

577577
const result: ListAvailableModelsResult = {
@@ -589,8 +589,12 @@ describe('MynahUI', () => {
589589
{
590590
id: 'model-selection',
591591
options: [
592-
{ value: 'CLAUDE_3_7_SONNET_20250219_V1_0', label: 'Claude Sonnet 3.7' },
593-
{ value: 'CLAUDE_SONNET_4_20250514_V1_0', label: 'Claude Sonnet 4' },
592+
{ value: 'CLAUDE_3_7_SONNET_20250219_V1_0', label: 'Claude Sonnet 3.7', description: '' },
593+
{
594+
value: 'CLAUDE_SONNET_4_20250514_V1_0',
595+
label: 'Claude Sonnet 4',
596+
description: 'Test description',
597+
},
594598
],
595599
type: 'select',
596600
value: 'CLAUDE_3_7_SONNET_20250219_V1_0',

chat-client/src/client/mynahUi.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,11 @@ ${params.message}`,
17371737
? {
17381738
...option,
17391739
type: 'select',
1740-
options: params.models.map(model => ({ value: model.id, label: model.name })),
1740+
options: params.models.map(model => ({
1741+
value: model.id,
1742+
label: model.name,
1743+
description: model.description ?? '',
1744+
})),
17411745
value: params.selectedModelId,
17421746
}
17431747
: option

chat-client/src/client/texts/modelSelection.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@ import { ChatItem, ChatItemFormItem, ChatItemType } from '@aws/mynah-ui'
55
*/
66
export enum BedrockModel {
77
CLAUDE_SONNET_4_20250514_V1_0 = 'CLAUDE_SONNET_4_20250514_V1_0',
8-
CLAUDE_3_7_SONNET_20250219_V1_0 = 'CLAUDE_3_7_SONNET_20250219_V1_0',
98
}
109

1110
type ModelDetails = {
1211
label: string
12+
description: string
1313
}
1414

1515
const modelRecord: Record<BedrockModel, ModelDetails> = {
16-
[BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: { label: 'Claude 3.7 Sonnet' },
17-
[BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: { label: 'Claude Sonnet 4' },
16+
[BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: {
17+
label: 'Claude Sonnet 4',
18+
description: 'Hybrid reasoning and coding for regular use',
19+
},
1820
}
1921

20-
const modelOptions = Object.entries(modelRecord).map(([value, { label }]) => ({
22+
const modelOptions = Object.entries(modelRecord).map(([value, { label, description }]) => ({
2123
value,
2224
label,
25+
description,
2326
}))
2427

2528
export const modelSelection: ChatItemFormItem = {

client/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@
351351
"devDependencies": {
352352
"@aws-sdk/credential-providers": "^3.731.1",
353353
"@aws-sdk/types": "^3.734.0",
354-
"@aws/chat-client-ui-types": "^0.1.56",
354+
"@aws/chat-client-ui-types": "^0.1.57",
355355
"@aws/language-server-runtimes": "^0.2.129",
356356
"@types/uuid": "^9.0.8",
357357
"@types/vscode": "^1.98.0",

package-lock.json

Lines changed: 10 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/aws-lsp-codewhisperer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@amzn/codewhisperer-streaming": "file:../../core/codewhisperer-streaming/amzn-codewhisperer-streaming-1.0.0.tgz",
3636
"@aws-sdk/util-arn-parser": "^3.723.0",
3737
"@aws-sdk/util-retry": "^3.374.0",
38-
"@aws/chat-client-ui-types": "^0.1.56",
38+
"@aws/chat-client-ui-types": "^0.1.57",
3939
"@aws/language-server-runtimes": "^0.2.129",
4040
"@aws/lsp-core": "^0.0.15",
4141
"@modelcontextprotocol/sdk": "^1.15.0",

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3157,7 +3157,7 @@ ${' '.repeat(8)}}
31573157

31583158
// Verify fallback to FALLBACK_MODEL_OPTIONS
31593159
assert.strictEqual(result.tabId, mockTabId)
3160-
assert.strictEqual(result.models.length, 2) // FALLBACK_MODEL_OPTIONS length
3160+
assert.strictEqual(result.models.length, 1) // FALLBACK_MODEL_OPTIONS length
31613161

31623162
// Verify cache was not updated due to error
31633163
sinon.assert.notCalled(setCachedModelsStub)
@@ -3224,7 +3224,7 @@ ${' '.repeat(8)}}
32243224

32253225
it('should fall back to default model when session has no modelId and no defaultModelId in cache', async () => {
32263226
getCachedModelsStub.returns({
3227-
models: [{ id: 'model1', name: 'Model 1' }],
3227+
models: [{ id: 'model1', name: 'Model 1', description: 'Test model' }],
32283228
defaultModelId: undefined, // No default model
32293229
timestamp: Date.now(),
32303230
})

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ export class AgenticChatController implements ChatHandlers {
761761
const { models, defaultModelId, errorFromAPI } = await this.#fetchModelsWithCache()
762762

763763
// Get the first fallback model option as default
764-
const defaultModelOption = FALLBACK_MODEL_OPTIONS[1]
764+
const defaultModelOption = FALLBACK_MODEL_OPTIONS[0]
765765
const DEFAULT_MODEL_ID = defaultModelId || defaultModelOption?.id
766766

767767
const sessionResult = this.#chatSessionManagementService.getSession(params.tabId)

server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,28 @@ import { ListAvailableModelsResult } from '@aws/language-server-runtimes/protoco
55
*/
66
export enum BedrockModel {
77
CLAUDE_SONNET_4_20250514_V1_0 = 'CLAUDE_SONNET_4_20250514_V1_0',
8-
CLAUDE_3_7_SONNET_20250219_V1_0 = 'CLAUDE_3_7_SONNET_20250219_V1_0',
98
}
109

1110
type ModelDetails = {
1211
label: string
12+
description: string
1313
}
1414

1515
export const FALLBACK_MODEL_RECORD: Record<BedrockModel, ModelDetails> = {
16-
[BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: { label: 'Claude 3.7 Sonnet' },
17-
[BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: { label: 'Claude Sonnet 4' },
16+
[BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: {
17+
label: 'Claude Sonnet 4',
18+
description: 'Hybrid reasoning and coding for regular use',
19+
},
1820
}
1921

2022
export const BEDROCK_MODEL_TO_MODEL_ID: Record<BedrockModel, string> = {
21-
[BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: 'claude-3.7-sonnet',
2223
[BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: 'claude-sonnet-4',
2324
}
2425

2526
export const FALLBACK_MODEL_OPTIONS: ListAvailableModelsResult['models'] = Object.entries(FALLBACK_MODEL_RECORD).map(
26-
([value, { label }]) => ({
27+
([value, { label, description }]) => ({
2728
id: value,
2829
name: label,
30+
description: description,
2931
})
3032
)

0 commit comments

Comments
 (0)