Skip to content

feat(copilot): google gemini support #1923

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

Merged
merged 3 commits into from
Apr 14, 2025
Merged

feat(copilot): google gemini support #1923

merged 3 commits into from
Apr 14, 2025

Conversation

ysfscream
Copy link
Member

@ysfscream ysfscream commented Apr 12, 2025

PR Checklist

If you have any questions, you can refer to the Contributing Guide

What is the current behavior?

Currently, MQTTX Copilot does not support using AI models from Google Generative AI (Gemini family). Users cannot select Google as a provider or utilize Gemini models for Copilot features.

Issue Number

None

What is the new behavior?

This PR introduces support for Google Generative AI models within MQTTX Copilot. Users can now select 'Google' as a provider in the Copilot settings and choose from various Gemini models (e.g., gemini-1.5-pro-latest, gemini-2.0-flash, etc.).

Key changes include:

  • Added the @ai-sdk/google dependency.
  • Updated type definitions (src/types/copilot.ts) to include the Google provider configuration (GoogleOptionsModel).
  • Updated AImodelsOptions in src/utils/ai/copilot.ts to list the Google provider, its models, the default API endpoint (https://generativelanguage.googleapis.com/v1beta), and the createGoogleGenerativeAI function.
  • Modified getModelProvider in src/utils/ai/copilot.ts to correctly instantiate the Google provider using the AI SDK.
  • Updated AIAgent in src/utils/ai/AIAgent.ts to correctly determine the providerType ('Google') based on the selected model or host URL, ensuring the correct provider is instantiated.
  • Updated unit tests (tests/unit/utils/ai/copilot.spec.ts) to include checks for the Google provider and ensure the required providerType and baseURL parameters are passed correctly.
image

Does this PR introduce a breaking change?

  • Yes
  • No

Specific Instructions

Users wishing to use Google Gemini models will need to:

  1. Select 'Google' as the provider in the Copilot settings.
  2. Select a desired Gemini model.
  3. Provide their Google Generative AI API Key in the appropriate settings field.
  4. Ensure the correct API Host URL is configured (defaults to https://generativelanguage.googleapis.com/v1beta).

Other information

Optional: Add any other relevant context or notes here.

@ysfscream ysfscream added enhancement New feature or request feature This pr is a feature desktop MQTTX Desktop labels Apr 12, 2025
@ysfscream ysfscream added this to the v1.12.0 milestone Apr 12, 2025
@ysfscream ysfscream requested a review from Copilot April 12, 2025 17:36
@ysfscream ysfscream self-assigned this Apr 12, 2025
@ysfscream ysfscream added this to MQTTX Apr 12, 2025
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.

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

Files not reviewed (1)
  • package.json: Language not supported

@ysfscream ysfscream moved this to In Progress in MQTTX Apr 12, 2025
@ysfscream ysfscream requested a review from Red-Asuka April 12, 2025 17:41
@Red-Asuka Red-Asuka merged commit 77e1608 into main Apr 14, 2025
4 checks passed
@Red-Asuka Red-Asuka deleted the ysf/desktop branch April 14, 2025 01:40
@github-project-automation github-project-automation bot moved this from In Progress to Done in MQTTX Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop MQTTX Desktop enhancement New feature or request feature This pr is a feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants