Skip to content

Conversation

@johan-j
Copy link
Contributor

@johan-j johan-j commented Sep 23, 2025

@johan-j johan-j changed the title used https://github.com/microsoft/vscode-copilot-chat/commit/87451aab… Grouping of BYOK custom models in model picker Sep 23, 2025
@johan-j
Copy link
Contributor Author

johan-j commented Sep 23, 2025

@microsoft-github-policy-service agree company="GitHub"

// Let's cache the results across extension activations
const baseCount = await this._promptBaseCountCache.getBaseCount(endpoint);
let multiplierString = endpoint.multiplier !== undefined ? `${endpoint.multiplier}x` : undefined;
let modelDetail = endpoint.multiplier !== undefined ? `${endpoint.multiplier}x` : undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was renamed to make it easier to follow the code. Its assigned to field details below.

modelDescription = endpoint.customModel.keyName;
modelCategory = { label: localize('languageModelHeader.custom_models', "Custom Models"), order: 1 };

modelName = endpoint.name.replace(` · ${endpoint.customModel.keyName}`, '');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In Copilot API, the name is added as:
Name: fmt.Sprintf("%s · %s", m.DisplayName, m.Key.Name),
So in here, if keyName is part of the string we remove it, since we add it already to the modelDescription.

We can clean this away in a future release if we update the API to only send the modelName.

@johan-j johan-j marked this pull request as ready for review September 25, 2025 18:05
Copilot AI review requested due to automatic review settings September 25, 2025 18:05
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 implements grouping and structured data handling for Bring Your Own Key (BYOK) custom models in the model picker interface. The changes enhance the user experience by properly categorizing and displaying custom models with appropriate metadata.

Key Changes

  • Added structured data support for custom models with ICustomModel interface containing key name and owner name
  • Implemented special UI treatment for custom models with dedicated category grouping and modified display names
  • Extended existing model metadata interfaces to accommodate custom model information

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/platform/networking/common/networking.ts Defines new ICustomModel interface and adds optional customModel field to IChatEndpoint
src/platform/endpoint/node/chatEndpoint.ts Implements custom model property assignment from API response metadata
src/platform/endpoint/common/endpointProvider.ts Extends API response interface to include optional custom model metadata
src/extension/conversation/vscode-node/languageModelAccess.ts Implements UI logic for custom model grouping and display formatting

modelDescription = customModel.keyName;
modelCategory = { label: localize('languageModelHeader.custom_models', "Custom Models"), order: 1 };

modelName = endpoint.name.replace(` · ${customModel.keyName}`, '');
Copy link
Member

Choose a reason for hiding this comment

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

Can we convince CAPI to not append key names like this? If they're worried about older clients than an API version would make sense here. I really dislike arbitrary string manipulation

Copy link
Contributor Author

@johan-j johan-j Sep 25, 2025

Choose a reason for hiding this comment

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

yeah I will do the change in CAPI as soon as this update goes out instead! good call, keep this clean!
only a select few preview user got BYOK yet. We can ask them to update the plugin, rather than maintain the old style.

@Yoyokrazy Yoyokrazy assigned lramos15 and unassigned Yoyokrazy Sep 25, 2025
@johan-j johan-j requested a review from lramos15 September 25, 2025 19:27
@lramos15 lramos15 enabled auto-merge September 25, 2025 19:42
@vs-code-engineering vs-code-engineering bot added this to the September 2025 milestone Sep 25, 2025
@lramos15 lramos15 added this pull request to the merge queue Sep 25, 2025
auto-merge was automatically disabled September 25, 2025 20:01

Pull Request is not mergeable

Merged via the queue into microsoft:main with commit a5c4ecf Sep 25, 2025
6 checks passed
@johan-j johan-j deleted the byok-better-model-grouping branch September 29, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants