Assistant: Refactor Model Providers#11089
Merged
samclark2015 merged 19 commits intomainfrom Jan 12, 2026
Merged
Conversation
|
E2E Tests 🚀 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the model provider architecture in the Positron Assistant extension to improve code organization and maintainability. The changes move from a monolithic models.ts file to a structured provider-based architecture with better separation of concerns.
Key changes:
- Introduced an abstract
ModelProviderbase class that all providers extend - Moved provider implementations to individual files under
src/providers/ - Renamed classes from
*LanguageModelto*ModelProviderfor consistency - Standardized provider lifecycle methods and error handling
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/tokens.ts |
Updated imports and references to use new AnthropicModelProvider |
src/test/snowflake.test.ts |
Updated import path for Snowflake authentication utilities |
src/test/openai.test.ts |
Renamed OpenAILanguageModel to OpenAIModelProvider and updated imports |
src/test/anthropic.test.ts |
Renamed AnthropicLanguageModel to AnthropicModelProvider and added mock model info |
src/pwb.ts |
Changed autoconfigure result property from signedIn to configured |
src/providers/test/errorProvider.ts |
New test provider that always throws errors for testing error handling |
src/providers/test/echoProvider.ts |
New test provider that echoes back user input for testing |
src/providers/snowflake/snowflakeProvider.ts |
New Snowflake Cortex provider with credential refresh support |
src/providers/snowflake/snowflakeAuth.ts |
Updated import path for extension utilities |
src/providers/posit/positProvider.ts |
Moved and refactored Posit AI provider with OAuth support |
src/providers/openrouter/openrouterProvider.ts |
New OpenRouter provider implementation |
src/providers/openai/openaiProvider.ts |
Refactored OpenAI provider with comprehensive documentation |
src/providers/openai/openaiCompatibleProvider.ts |
New provider for OpenAI-compatible endpoints |
src/providers/ollama/ollamaProvider.ts |
New Ollama provider for local model execution |
src/providers/mistral/mistralProvider.ts |
New Mistral AI provider implementation |
src/providers/index.ts |
Central export file for all providers with factory functions |
src/providers/google/vertexProvider.ts |
New Google Vertex AI provider |
src/providers/google/googleProvider.ts |
New Google Gemini provider implementation |
src/providers/base/vercelModelProvider.ts |
Base class for Vercel AI SDK-based providers |
src/providers/base/modelProviderTypes.ts |
Type definitions for model provider interfaces |
src/providers/base/modelProviderLogger.ts |
Standardized logging utility for providers |
src/providers/base/modelProviderErrors.ts |
Error type hierarchy for provider operations |
src/providers/base/modelProvider.ts |
Abstract base class defining provider interface |
src/providers/azure/azureProvider.ts |
New Azure OpenAI Service provider |
src/providers/aws/awsBedrockProvider.ts |
AWS Bedrock provider with SSO support |
src/providers/anthropic/anthropicVercelProvider.ts |
Anthropic provider using Vercel AI SDK |
src/providers/anthropic/anthropicProvider.ts |
Anthropic provider using native SDK with detailed refactoring |
src/participants.ts |
Updated comment reference from EchoLanguageModel to EchoModelProvider |
src/models.ts |
Deleted monolithic file - functionality distributed to provider modules |
src/extension.ts |
Updated imports and references to use new provider structure |
src/diagnostics.ts |
Updated import for getLanguageModels function |
src/copilot.ts |
Changed autoconfigure property from signedIn to configured |
src/constants.ts |
Moved ModelCapabilities interface to modelProviderTypes.ts |
src/config.ts |
Updated imports and autoconfigure result handling |
… consistency across model providers
…getModelProviders` for improved clarity and consistency
…Provider to return undefined when no models are available, improving clarity and consistency.
…ovider registration in index.ts for improved integration.
…urpose and usage in provider registration.
…r language model chat responses, enhancing flexibility for Anthropic and Bedrock models.
melissa-barca
approved these changes
Jan 12, 2026
Contributor
melissa-barca
left a comment
There was a problem hiding this comment.
I built the branch and did some light testing of different providers and everything is looking good. Let's get this merged! 💃
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #10532.
Summary
This PR refactors the Assistant extension's model provider architecture to improve code organization, maintainability, and developer experience. The changes address multiple items from the cleanup checklist in #10532.
Major architectural changes:
models.tsfile into a clean directory structure underproviders/ModelProviderabstract base class andVercelModelProviderfor shared functionality across providersmodelProviderErrors.tswith structured error classes for better debuggingmodelProviderLogger.tswith consistent logging patterns across all providersmodelProviderTypes.tsNaming consistency improvements:
getLanguageModels()→getModelProviders()for accurate terminologyproviderproperty →providerIdfor consistency across model providersnameproperty →displayNameto better reflect its purposeProvider organization:
What's been accomplished from #10532:
providerNameabstract (nowproviderId)Release Notes
New Features
Bug Fixes
QA Notes
@:assistant
This is a refactoring PR with no user-facing changes. All Assistant functionality should work exactly as before, just with better code organization.
Verification steps:
Example test conversation:
Then ask the Assistant: "What is in the df variable?"
All provider configurations should continue to work without any behavioral changes, regressions, or errors.