Skip to content

Add Gemini-2.5-pro and modify gemini api path #6420

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

penuel-leo
Copy link

@penuel-leo penuel-leo commented Apr 1, 2025

πŸ’» ε˜ζ›΄η±»εž‹ | Change Type

  • feat
  • fix
  • refactor
  • perf
  • style
  • test
  • docs
  • ci
  • chore
  • build

πŸ”€ ε˜ζ›΄θ―΄ζ˜Ž | Description of Change

  • Modify the latest API path for Gemini.
  • Add the gemini-2.5-pro model.
  • Remove the no longer supported gemini-1.0-pro

πŸ“ θ‘₯充俑息 | Additional Information

image

Summary by CodeRabbit

  • New Features
    • Enhanced the content generation service by updating its operational endpoint for a streamlined user experience.
    • Expanded the range of available models by removing an outdated option and introducing two new, advanced versions.

…-pro model. 3. Remove the no longer supported gemini-1.0-pro
Copy link

vercel bot commented Apr 1, 2025

Someone is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Apr 1, 2025

Walkthrough

The changes update the API endpoint within the ChatPath method of the Google constant, replacing the call from streamGenerateContent to generateContent. In addition, the googleModels array in the same file has been modified: the deprecated model "gemini-1.0-pro" has been removed, and two new models, "gemini-2.0-flash-lite" and "gemini-2.5-pro-exp-03-25", have been added.

Changes

File Change Summary
app/constant.ts Updated ChatPath method to use v1beta/models/${modelName}:generateContent instead of ...:streamGenerateContent; removed deprecated "gemini-1.0-pro" and added two new models "gemini-2.0-flash-lite" and "gemini-2.5-pro-exp-03-25".

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant GoogleConstant
    participant API

    Client->>GoogleConstant: Request generateContent(modelName)
    GoogleConstant->>API: Call v1beta/models/modelName:generateContent
    API-->>GoogleConstant: Return generated content
    GoogleConstant-->>Client: Deliver content
Loading

Poem

I'm a rabbit, hopping with glee,
New endpoints and models set free.
Old paths retired, new ones in bloom,
Code jumps ahead, banishing gloom.
With every hop, our changes shine bright! πŸ‡


πŸ“œ Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 48469bd and 27d3ce0.

πŸ“’ Files selected for processing (1)
  • app/constant.ts (2 hunks)
πŸ”‡ Additional comments (4)
app/constant.ts (4)

519-519: New Gemini model added: gemini-2.0-flash-lite.

Adding the new gemini-2.0-flash-lite model aligns with the PR objective to introduce new Gemini models.


527-527: New Gemini model added: gemini-2.5-pro-exp-03-25.

Adding the experimental gemini-2.5-pro-exp-03-25 model aligns with the PR objective to introduce new Gemini models.


193-193:

❓ Verification inconclusive

API endpoint changed from streaming to non-streaming.

The Google API endpoint has been changed from :streamGenerateContent to :generateContent. This switches from streaming responses to non-streaming responses, which might affect how responses are processed in the client code.


🏁 Script executed:

#!/bin/bash
# Verify if there are other places in the codebase that expect streaming responses from Gemini API

# Search for places where the Google API responses might be processed
rg -A 5 -B 5 "Google.*ChatPath" --glob "*.ts" --glob "*.tsx"

# Look for streaming response handling specific to Google models
rg -A 5 -B 5 "streamGenerateContent" --glob "*.ts" --glob "*.tsx"

Length of output: 826


Action: Confirm non-streaming behavior and update client handling if necessary.

The endpoint in app/constant.ts has been correctly updated from the deprecated streaming endpoint (:streamGenerateContent) to the new non-streaming one (:generateContent). However, the client code in app/client/platforms/google.ts still calls Google.ChatPath(modelConfig.model) with a shouldStream flag, which might imply legacy streaming behavior. Please verify that the response handling in the client is fully aligned with non-streaming responses and that any streaming-specific logic is either removed or appropriately bypassed.

  • File: app/constant.ts – Endpoint now returns non-streaming URL.
  • File: app/client/platforms/google.ts – Usage of Google.ChatPath(...) still occurs alongside a streaming flag; ensure this doesn’t lead to processing issues.

503-528:

βœ… Verification successful

Verify that gemini-1.0-pro has been removed as intended.

The PR objective mentions removing the deprecated model "gemini-1.0-pro", which appears to have been successfully removed from the googleModels array.


🏁 Script executed:

#!/bin/bash
# Verify that references to gemini-1.0-pro have been removed from the codebase

# Search for any remaining references to the deprecated model
rg "gemini-1\.0-pro" --glob "*.ts" --glob "*.tsx"

Length of output: 51


Below is a revised review comment that includes an additional shell script to double-check that no instances of "gemini-1.0-pro" remain in the specified file range. Please run the script and manually verify its output:


Action: Confirm Removal of Deprecated "gemini-1.0-pro" Model

The PR objective specifies that the deprecated model "gemini-1.0-pro" must be removed. A preliminary search using ripgrep did not yield any results, but to ensure thoroughness, please run the below script to examine the critical snippet directly in app/constant.ts (lines 503–528):

If this script returns no output, it confirms that "gemini-1.0-pro" has been successfully removed from the googleModels array. Once verified, you can safely approve the change.


🏁 Script executed:

#!/bin/bash
sed -n '503,528p' app/constant.ts | grep "gemini-1\.0-pro"

Length of output: 180


Action: Confirm Removal of Deprecated "gemini-1.0-pro" Model

The deprecated model "gemini-1.0-pro" has been successfully removed from the googleModels array in app/constant.ts (lines 503–528). A manual verification by extracting this file portion and searching for "gemini-1.0-pro" produced no results, indicating that the removal is complete.

✨ Finishing Touches
  • πŸ“ Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

1 participant