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

feat: add support for gemini #5235

Merged
merged 4 commits into from
Feb 19, 2025
Merged

feat: add support for gemini #5235

merged 4 commits into from
Feb 19, 2025

Conversation

HugoCasa
Copy link
Contributor

@HugoCasa HugoCasa commented Feb 6, 2025

Important

Add support for Google AI (Gemini) as a new AI provider, updating backend and frontend to integrate it into existing systems.

  • Backend:
    • Add GoogleAI to AIProvider enum in ai.rs.
    • Update get_openai_compatible_base_url() in ai.rs to return Google AI's base URL.
    • Modify proxy() in ai.rs to handle GoogleAI.
  • Frontend:
    • Add googleai to AIProvider enum in lib.ts.
    • Update AI_DEFAULT_MODELS and OPENAI_COMPATIBLE_BASE_URLS in lib.ts to include Google AI models and URL.
    • Implement prepareOpenaiCompatibleMessages() in lib.ts to handle Google AI's message format.
    • Modify getNonStreamingCompletion() and getCompletion() in lib.ts to support googleai.
    • Add Google AI toggle button in +page.svelte for workspace settings.

This description was created by Ellipsis for 884cce4. It will automatically update as commits are pushed.

@HugoCasa HugoCasa changed the title feat: add support for gemini [WIP] feat: add support for gemini Feb 6, 2025
Copy link

cloudflare-workers-and-pages bot commented Feb 6, 2025

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 884cce4
Status: ✅  Deploy successful!
Preview URL: https://9436a1dd.windmill.pages.dev
Branch Preview URL: https://hc-add-gemini.windmill.pages.dev

View logs

@rubenfiszel rubenfiszel force-pushed the main branch 3 times, most recently from 30f0807 to 9c57565 Compare February 14, 2025 03:38
@rubenfiszel rubenfiszel force-pushed the main branch 9 times, most recently from 0d0ada6 to 1ef482e Compare February 18, 2025 20:49
@HugoCasa HugoCasa changed the title [WIP] feat: add support for gemini feat: add support for gemini Feb 19, 2025
@HugoCasa HugoCasa marked this pull request as ready for review February 19, 2025 11:01
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 884cce4 in 2 minutes and 26 seconds

More details
  • Looked at 223 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 13 drafted comments based on config settings.
1. frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte:1077
  • Draft comment:
    New ToggleButton for 'googleai' has been added. Verify that the value 'googleai' correctly maps to the appropriate AI defaults and resource type elsewhere in the code.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is asking the PR author to verify something, which violates the rule against asking for confirmation or verification. It does not provide a specific suggestion or point out a clear issue.
2. frontend/src/lib/components/copilot/lib.ts:95
  • Draft comment:
    Added support for the 'googleai' provider via a new base URL. Please verify that the endpoint 'https://generativelanguage.googleapis.com/v1beta/openai' is the correct API endpoint for Gemini and that its behavior (e.g. message formatting) is fully compatible.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is asking the PR author to verify the correctness and compatibility of an API endpoint, which falls under the rule of not asking the author to confirm or ensure behavior. It doesn't provide a specific suggestion or point out a clear issue.
3. frontend/src/lib/script_helpers.ts:913
  • Draft comment:
    Refactored 'isInitialCode' to use nested for-of loops instead of forEach. This allows early return and improves clarity. Consider commenting the rationale for future maintainers.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 30% vs. threshold = 50%
    The change from forEach to for-of is a clear improvement in code quality since it allows early return instead of unnecessarily continuing iteration after finding a match. While documenting this rationale could be helpful, the code change is fairly straightforward and the benefit of for-of loops for early returns is a common pattern that experienced developers would recognize. The comment is suggesting something nice-to-have but not critical.
    The performance and readability benefits of for-of with early return may not be immediately obvious to all developers, especially junior ones. Documentation could help with maintainability.
    While documentation could be helpful, the change is following a standard pattern and the benefits are evident from the code itself. We should avoid requesting documentation for common patterns.
    Delete the comment. While documentation could be nice, the code change follows a common pattern and the benefits are clear from the code itself.
4. frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte:1073
  • Draft comment:
    New ToggleButton for 'Google AI' is added in the AI provider selection. Ensure that the UI update correctly resets associated settings (resource path, models) and that the backend correctly handles the 'googleai' provider.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte:1090
  • Draft comment:
    The ResourcePicker updates in the keyed block use the current aiProvider to set the resource type. Please double-check that for providers like 'googleai', no special handling is needed beyond using the provider name directly.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. backend/windmill-api/openapi.yaml:691
  • Draft comment:
    Typographical error: The operationId 'getJob logs' contains an unexpected space. Please update it to 'getJobLogs'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. backend/windmill-api/openapi.yaml:9570
  • Draft comment:
    Typographical error: The summary for '/w/{workspace}/apps/exists/{path}' uses 'exisst' instead of 'exists'. Please correct the spelling.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. frontend/src/lib/components/copilot/lib.ts:300
  • Draft comment:
    Typo: The interface name 'FixScriptOpions' appears to be misspelled. It should likely be 'FixScriptOptions'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. frontend/src/lib/components/copilot/lib.ts:399
  • Draft comment:
    Typo: The function name 'addDBSChema' appears to have a typographical error. Consider renaming it to 'addDBSchema'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
10. frontend/src/lib/script_helpers.ts:80
  • Draft comment:
    Typo: The comment uses "overriden" but the correct spelling is "overridden".
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. frontend/src/lib/script_helpers.ts:444
  • Draft comment:
    Typo: The error message text has 'occured' which should be spelled as 'occurred'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
12. frontend/src/lib/script_helpers.ts:686
  • Draft comment:
    Typo: The word "clude" should be "include" in the comment describing how to return the resume URL.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
13. frontend/src/lib/script_helpers.ts:564
  • Draft comment:
    Typo: The word "clude" should be "include" in the approval comment.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_W0cd5JphKNonkQCu


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@rubenfiszel rubenfiszel merged commit 35d5293 into main Feb 19, 2025
8 checks passed
@rubenfiszel rubenfiszel deleted the hc/add-gemini branch February 19, 2025 14:03
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants