Use provider ordering in chat model picker#307742
Use provider ordering in chat model picker#307742kevin-m-kent wants to merge 4 commits intomicrosoft:mainfrom
Conversation
Add vendorPriority field to the language model metadata API surface, allowing extensions to specify a numeric priority for vendor-based ordering in the chat model picker. When set, models are sorted by vendorPriority before falling back to the existing alphabetical vendor/name ordering. This applies to the promoted section, other models section, and flat view sort in chatModelPicker.ts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When models have vendorPriority set, they are automatically placed in the promoted section of the picker (above Other Models) and sorted by their priority value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove vendorPriority-based auto-promotion so the picker relies on VS Code's existing models control manifest for featured models, while still using vendorPriority for ordering within promoted and other model lists. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a new vendorPriority metadata field for proposed chat language models and uses it to influence sorting in the chat model picker so providers/models can be ordered more intentionally.
Changes:
- Added optional
vendorPriorityto the proposedLanguageModelChatInformationAPI and to internal model metadata. - Plumbed
vendorPrioritythrough the extension host model metadata mapping. - Updated chat model picker sorting to consider
vendorPriorityin promoted, grouped, and flat list scenarios.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatProvider.d.ts | Adds the proposed vendorPriority field to the public API surface (proposal). |
| src/vs/workbench/contrib/chat/common/languageModels.ts | Adds vendorPriority to internal model metadata interface. |
| src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.ts | Uses vendorPriority in model sorting logic for promoted/other/flat lists. |
| src/vs/workbench/api/common/extHostLanguageModels.ts | Plumbs vendorPriority from extension-provided model info into internal metadata. |
| product.json | Adds an extensionsGallery configuration block (appears unrelated to PR goal). |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.ts:362
- The promoted-items comparator only uses
nameas the final tie-breaker. If two promoted models share the same display name (common across vendors), the comparator can return 0 and leave ordering dependent on input order, which may vary and cause UI jitter. Consider adding vendor (and/or id/identifier) as additional tie-breakers so the sort defines a total, deterministic ordering.
// Use vendorPriority if available
const aVP = a.kind === 'available' ? a.model.metadata.vendorPriority : undefined;
const bVP = b.kind === 'available' ? b.model.metadata.vendorPriority : undefined;
if (aVP !== undefined || bVP !== undefined) {
const aPrio = aVP ?? Number.MAX_SAFE_INTEGER;
const bPrio = bVP ?? Number.MAX_SAFE_INTEGER;
if (aPrio !== bPrio) {
return aPrio - bPrio;
}
}
const aName = a.kind === 'available' ? a.model.metadata.name : a.entry.label;
const bName = b.kind === 'available' ? b.model.metadata.name : b.entry.label;
return aName.localeCompare(bName);
- Files reviewed: 4/5 changed files
- Comments generated: 2
product.json
Outdated
| "extensionsGallery": { | ||
| "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", | ||
| "itemUrl": "https://marketplace.visualstudio.com/items", | ||
| "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index", | ||
| "controlUrl": "" | ||
| } |
There was a problem hiding this comment.
This change adds an extensionsGallery configuration pointing at the public VS Marketplace for Code - OSS. That’s unrelated to the PR’s stated goal (chat model picker ordering) and can significantly change product behavior/distribution expectations. If this wasn’t intentional, please revert this hunk; if it was intentional, it should be split into a dedicated PR with rationale and any required follow-up changes.
| // Render promoted section: available first, then by vendor priority, then alphabetically by name | ||
| if (promotedItems.length > 0) { | ||
| promotedItems.sort((a, b) => { | ||
| const aAvail = a.kind === 'available' ? 0 : 1; | ||
| const bAvail = b.kind === 'available' ? 0 : 1; | ||
| if (aAvail !== bAvail) { | ||
| return aAvail - bAvail; | ||
| } | ||
| // Use vendorPriority if available | ||
| const aVP = a.kind === 'available' ? a.model.metadata.vendorPriority : undefined; | ||
| const bVP = b.kind === 'available' ? b.model.metadata.vendorPriority : undefined; | ||
| if (aVP !== undefined || bVP !== undefined) { | ||
| const aPrio = aVP ?? Number.MAX_SAFE_INTEGER; | ||
| const bPrio = bVP ?? Number.MAX_SAFE_INTEGER; | ||
| if (aPrio !== bPrio) { | ||
| return aPrio - bPrio; | ||
| } | ||
| } |
There was a problem hiding this comment.
vendorPriority introduces new ordering behavior in the picker, but there doesn’t appear to be a test that asserts ordering when priorities are present (only the existing alphabetical behavior when priorities are undefined). Please add/extend model picker tests to cover at least: (1) promoted section ordering by priority, and (2) non-promoted ordering by priority with fallback behavior.
This issue also appears on line 350 of the same file.
Drop the accidental product.json change from the branch so the PR only contains the model picker ordering work. The product.json override was only needed for local OSS testing and should not ship in the PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
vendorPriorityto the proposed chat provider model metadata and plumb it through the extension hostvendorPrioritywhen sorting promoted and other models in the chat model pickerTesting