Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors AI providers to simplify provider APIs #4130

Merged
merged 1 commit into from
Mar 6, 2025
Merged

Conversation

eamodio
Copy link
Member

@eamodio eamodio commented Mar 6, 2025

  • Splits code into separate folders, e.g. models, utils
  • Adds structured prompt template handling
  • Simplifies provider APIs and request handling

- Splits code into separate folders, e.g. models, utils
- Adds structured prompt template handling
- Simplifies provider APIs and request handling
@eamodio eamodio requested review from Copilot and d13 March 6, 2025 20:37
Copy link

@Copilot 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.

PR Overview

This PR restructures the AI provider code to simplify provider APIs and improve prompt template handling. Key changes include splitting code into specific folders (e.g. models and utils), introducing structured prompt template support, and updating various provider implementations to use updated generic signatures and refined request handling.

Reviewed Changes

File Description
src/plus/ai/models/provider.ts Introduces a new interface for AI providers.
src/plus/ai/openAICompatibleProvider.ts Updates request handling and prompt template retrieval logic.
src/plus/ai/utils/-webview/ai.utils.ts Adds a new prompt truncation warning and refactors API key prompting.
src/plus/ai/vscodeProvider.ts Implements VS Code–specific AI provider functions with updated signals.
src/plus/ai/models/model.ts Defines a new AIModel interface used across providers.
src/plus/ai/models/promptTemplates.ts Implements structured prompt templates for various actions.
src/plus/ai/utils/-webview/prompt.utils.ts Provides local template resolution and truncation logic.
Other Files Updates import paths and generic usage across provider implementations.

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Copy link
Member

@d13 d13 left a comment

Choose a reason for hiding this comment

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

LGTM

@d13 d13 changed the title Reactors AI providers to simplify provider APIs Refactors AI providers to simplify provider APIs Mar 6, 2025
@eamodio eamodio merged commit fa3bd63 into main Mar 6, 2025
3 checks passed
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.

2 participants