Skip to content

Conversation

@sharon-wang
Copy link
Member

@sharon-wang sharon-wang commented Nov 17, 2025

Summary

image

Approach

  • each provider's resolveModels() method now calls retrieveModelsFromConfig() to check for statically defined models via positron.assistant.configuredModels or hardcoded models, then retrieveModelsFromApi() to dynamically retrieve the model listing if applicable for the provider
  • move some duplicated code to shared util files modelDefinitions.ts and modelResolutionHelpers.ts
  • continues some refactoring to incrementally work towards Assistant: reorg/refactor provider handling #10532

Release Notes

New Features

QA Notes

- add positron.assistant.configuredModels setting to allow users to statically configure model settings per provider, which overrides dynamic model resolution
- update and add tests around model resolution
@github-actions
Copy link

github-actions bot commented Nov 17, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical

readme  valid tags

Comment on lines -1049 to -1077
// Update a stale model configuration to the latest defaults
const models = availableModels.get('amazon-bedrock')?.map(m => m.identifier) || [];
if (!(_config.model in models)) {
_config.name = AWSLanguageModel.source.defaults.name;
_config.model = AWSLanguageModel.source.defaults.model;
}
Copy link
Member Author

@sharon-wang sharon-wang Nov 17, 2025

Choose a reason for hiding this comment

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

I've removed this as we no longer use the hardcoded model listing, as we've switched to using the Bedrock SDK to dynamically retrieve the models.

Copy link
Contributor

@melissa-barca melissa-barca left a comment

Choose a reason for hiding this comment

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

Nice work! Thanks for including thorough test coverage

Copy link
Contributor

@melissa-barca melissa-barca left a comment

Choose a reason for hiding this comment

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

Overall this is looking great. Thinking about this as a Workbench feature, it's possible an admin will misconfigure the setting and then need to play a back and forth game of telephone with the user and possibly our support/dev teams to debug the misconfiguration. We can try to make this process easier by adding in some validation that runs when the assistant extension activates. I think we have everything we need to verify the provider and surface any errors (probably as a notification and to the output pane?) The current experience isn't ideal if the configured model doesn't actually exist, but I'm not sure if there's a great way to improve this as we already log an error that includes the model we attempted to use.

@sharon-wang
Copy link
Member Author

What do you think about adding a command like Check configured models, which iterates through the configured models setting and tries a connection check against each one? Note that this will require the user to already be authenticated to the providers, so I think this would work best for autoconfigured credentials like (via #10537), but individual users could log into a provider in the modal, then run this command.

I'm leaning towards a command as checking all the models on each extension activation would cause a delay, with how the code is currently structured (each provider is connected to in sequence). I can open an issue for this separately if that sounds like a decent approach to try!

positron.assistant.maxConnectionAttempts sets that we try up to 3 models by default, but could be increased if the user is having trouble with configured models, and as you mentioned we log each one that failed. This would be a hacky workaround in the meantime to check the models 😆

@melissa-barca
Copy link
Contributor

I like that idea! I think it will be helpful for Admins and support if there are model issues. How do you feel about adding provider verification as part of this PR?

@sharon-wang sharon-wang force-pushed the assistant/configure-models branch from 47bba03 to 1dbf111 Compare November 20, 2025 23:17
@sharon-wang
Copy link
Member Author

I like that idea! I think it will be helpful for Admins and support if there are model issues. How do you feel about adding provider verification as part of this PR?

Added provider verification and a couple basic tests in 1dbf111!

settings.json

  "positron.assistant.configuredModels": {
    "bad provider":[]
  }

Here's what the warning looks like looks like -- runs during extension activation:

image

There's also a message in the output log:

[warning] Configured models contain unsupported providers: 'bad provider'. Please review your configuration for 'positron.assistant.configuredModels'

@sharon-wang
Copy link
Member Author

What do you think about adding a command like Check configured models, which iterates through the configured models setting and tries a connection check against each one? Note that this will require the user to already be authenticated to the providers, so I think this would work best for autoconfigured credentials like (via #10537), but individual users could log into a provider in the modal, then run this command.

I'm leaning towards a command as checking all the models on each extension activation would cause a delay, with how the code is currently structured (each provider is connected to in sequence). I can open an issue for this separately if that sounds like a decent approach to try!

logged #10702 to capture this idea!

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