Skip to content

Conversation

@ShashankSaga
Copy link
Contributor

Summary

This PR introduces provider-aware model routing on top of the existing AI provider abstraction, enabling explicit provider + model execution while preserving health checks and non-breaking behavior.

The goal is to make model selection a first-class concept without coupling it to individual provider implementations.


What’s included

  • Added a lightweight AIModelRegistry to centrally define:
    • available models
    • owning provider
    • model-level metadata
  • Extended AIProviderRegistry with generateTextWithModel to:
    • resolve provider + model explicitly
    • validate provider availability
    • reuse existing health tracking
    • preserve original provider errors on failure
  • No changes to existing provider implementations (e.g., GeminiProvider), keeping the system extensible and backward-compatible.

Why this matters

  • Enables future UI / API flows where users explicitly choose:
    provider → model
  • Avoids hardcoding models inside providers
  • Keeps routing logic centralized and testable
  • Aligns with the long-term multi-provider, multi-model architecture

Safety & compatibility

  • Fully backward-compatible
  • No existing flows modified
  • No provider behavior changed
  • Designed for incremental extension

Please let me know if you’d like:

  • fallback between models
  • per-model capability checks
  • or provider preference rules added next

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ShashankSaga, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the AI core by introducing a provider-aware model routing system. It establishes a dedicated registry for AI models, allowing for their centralized definition and explicit selection, independent of the underlying provider. The AIProviderRegistry is augmented with a new method that routes requests to specific models while incorporating health checks to ensure reliability and graceful degradation. This foundational change aims to make model selection a first-class concept, preparing the system for advanced user-facing model choices and improving overall architectural clarity and testability.

Highlights

  • Centralized Model Registry: Introduced a new AIModelRegistry to centrally define available AI models, their owning providers, and associated capabilities, decoupling model definitions from provider implementations.
  • Provider-Aware Model Routing: Extended the AIProviderRegistry with a generateTextWithModel method, enabling explicit routing of text generation requests to a specific provider and model.
  • Health-Safe Execution: Integrated a health tracking mechanism within AIProviderRegistry to monitor provider failures and prevent routing requests to degraded providers, ensuring robust operation.
  • Backward Compatibility: Ensured that all changes are fully backward-compatible, with no modifications to existing provider implementations or disruption to current functionalities.
  • Future Extensibility: Laid the groundwork for future UI/API flows where users can explicitly choose providers and models, aligning with a multi-provider, multi-model architecture.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ShashankSaga
Copy link
Contributor Author

Hi @abhishek-nexgen-dev 👋

As discussed, I’ve consolidated the work into a single final PR on top of dev.

This adds provider-aware model routing while keeping provider implementations untouched and preserving existing health checks.

Please let me know if this direction looks good or if you’d like any adjustments before merge. Thanks!

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a valuable provider-aware model routing mechanism, including a new AIModelRegistry and health-checking for providers. The overall architecture is a good step towards a more robust multi-model system. My review identifies a few key areas for improvement: a critical fix for the health-checking logic to prevent permanent provider failure, a high-priority correction to the new routing method's signature to avoid unexpected behavior, and a medium-priority suggestion to enhance the extensibility of the new AIModelRegistry.

@abhishek-nexgen-dev
Copy link
Member

@ShashankSaga instant of creating multiple pr create a single pr this is good for me because each time you create a pr for a single issue i need to verify the changes again and again 😔 and I already got lots of pr related to my project, lots of comments that's why create a single pr that some a single issue

@ShashankSaga
Copy link
Contributor Author

Got it, thanks for clarifying @abhishek-nexgen-dev 🙏

I understand your concern — I’ll stick to one single PR per issue and avoid opening multiple PRs for the same feature.

I’ll continue developing incrementally on the same branch locally and only open one final PR once the implementation is complete, stable, and ready for review.

Appreciate your time and the guidance — I’ll follow this approach going forward.

@ShashankSaga
Copy link
Contributor Author

Hi @abhishek-nexgen-dev 👋

All requested changes are now addressed.
I’ve kept this PR focused strictly on core routing and health logic, without expanding provider implementations.
Ready for merge whenever convenient. Thanks!

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