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

Update google models to add gemini-2.0 #5932

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

fengzai6
Copy link
Contributor

@fengzai6 fengzai6 commented Dec 12, 2024

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

添加gemini-1.5-flash-8b-latest、gemini-2.0-flash-exp,移除已经舍弃的模型:gemini-pro-version

📝 补充信息 | Additional Information

Summary by CodeRabbit

  • New Features
    • Introduced a new model identifier: "gemini-1.5-flash-8b-latest".
  • Updates
    • Deprecated model identifier: "gemini-1.0-pro" (effective 2/15/2025).
    • Renamed model identifier from "gemini-pro-vision" to "gemini-2.0-flash-exp".
    • Expanded criteria for identifying vision models by adding "gemini-2.0" to the classification.
    • Updated network request handling to utilize tauriStreamFetch in Tauri environments.

Copy link

vercel bot commented Dec 12, 2024

@fengzai6 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 Dec 12, 2024

Walkthrough

The changes in this pull request focus on updating the googleModels array within the app/constant.ts file. The model identifier "gemini-1.0-pro" is marked as deprecated with a specified deprecation date, while a new model, "gemini-1.5-flash-8b-latest", is introduced. Additionally, the model previously known as "gemini-pro-vision" is renamed to "gemini-2.0-flash-exp". The overall structure of the file remains unchanged, indicating that the modifications are solely related to model identifiers.

Changes

File Change Summary
app/constant.ts - Deprecated model: "gemini-1.0-pro" (deprecation date: 2/15/2025)
- Added model: "gemini-1.5-flash-8b-latest"
- Renamed model: "gemini-pro-vision""gemini-2.0-flash-exp"
app/utils.ts - Updated isVisionModel function to include "gemini-2.0" in visionKeywords array.
- Modified fetch function to use tauriStreamFetch when window.__TAURI__ is defined.

Possibly related PRs

  • refactor: google #5045: Modifies the ChatPath property in the Google constant within app/constant.ts, which is related to the changes made to the googleModels array in the main PR.
  • update new model for gpt-4o and gemini-exp #5861: Adds new entries to the googleModels array in app/constant.ts, which is directly related to the modifications in the googleModels array in the main PR.

Suggested reviewers

  • Dogtiti
  • lloydzhou

🐇 In the code, I hop and play,
New models join, old ones sway.
"Gemini" shines, a bright new name,
With every change, we stake our claim.
So here's to updates, fresh and bright,
In the code's garden, all feels right! 🌼


📜 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 e27e8fb and 46a0b10.

📒 Files selected for processing (1)
  • app/utils.ts (1 hunks)
🔇 Additional comments (1)
app/utils.ts (1)

264-264: LGTM! Verify the vision model detection for new Gemini 2.0 models.

The addition of "gemini-2.0" to visionKeywords is consistent with the PR objectives and follows the existing pattern.

Let's verify that this change correctly identifies the new Gemini 2.0 models as vision models:

✅ Verification successful

Verified: The addition of "gemini-2.0" to visionKeywords is correct and properly used

The verification shows that:

  • The isVisionModel function is properly implemented with "gemini-2.0" in the visionKeywords array
  • The function is used correctly across the codebase in key components:
    • chat.tsx: For controlling image upload UI
    • Platform clients (tencent.ts, openai.ts, google.ts, anthropic.ts): For handling vision model capabilities
  • The model name "gemini-2.0" is consistently referenced in both app/constant.ts and app/utils.ts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that isVisionModel correctly identifies new Gemini 2.0 models

# Search for usage of isVisionModel with Gemini 2.0 models
rg -A 3 "isVisionModel.*gemini-2\.0"

# Search for any hardcoded model names containing gemini-2.0
rg "gemini-2\.0"

Length of output: 130


Script:

#!/bin/bash
# Let's verify the complete context of isVisionModel function and its usage

# Get the complete isVisionModel function implementation
ast-grep --pattern 'function isVisionModel($_) { $$$ }'

# Find all usages of isVisionModel in the codebase
rg -A 3 "isVisionModel\("

# Check if there are any tests for isVisionModel
fd "test|spec" --exec rg "isVisionModel" {} \;

Length of output: 3210


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@fengzai6 fengzai6 changed the title Update google models Update google models to add gemini-2.0 Dec 12, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 83cea3a and e27e8fb.

📒 Files selected for processing (1)
  • app/constant.ts (1 hunks)
🔇 Additional comments (2)
app/constant.ts (2)

323-323: Update Google API path handling for new models

Ensure that the Google.ChatPath function in the constants properly handles the new models "gemini-1.5-flash-8b-latest" and "gemini-2.0-flash-exp".

Also applies to: 327-327

✅ Verification successful

Based on the results, I can see that the Google.ChatPath implementation in app/constant.ts uses a simple, model-agnostic path construction: v1beta/models/${modelName}:streamGenerateContent. This implementation will work correctly with any model name, including the new models "gemini-1.5-flash-8b-latest" and "gemini-2.0-flash-exp", as it just interpolates the model name into a fixed path pattern.

The path handling for new Gemini models is already properly implemented

The current implementation in Google.ChatPath uses a consistent pattern that works for all models by design, requiring no special handling for specific model names. The function simply interpolates any model name into the path v1beta/models/${modelName}:streamGenerateContent.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the Google.ChatPath implementation handles these models

# Search for Google.ChatPath implementation and model handling
echo "Searching for Google API path handling..."
rg -A 10 "Google = \{" 

# Search for any model-specific API path customizations
echo "Searching for model-specific paths..."
rg "ChatPath.*gemini-"

Length of output: 752


320-327: Verify the model changes against Google's official documentation

Please ensure that these model changes align with Google's official documentation and announcements:

  1. The deprecation of "gemini-1.0-pro"
  2. The addition of new models "gemini-1.5-flash-8b-latest" and "gemini-2.0-flash-exp"

Comment on lines +320 to 321
"gemini-1.0-pro", // Deprecated on 2/15/2025
"gemini-1.5-pro-latest",
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Document the deprecation date in KnowledgeCutOffDate

The model "gemini-1.0-pro" is marked as deprecated, but its cutoff date should also be documented in the KnowledgeCutOffDate constant for consistency.

Add the following entry to the KnowledgeCutOffDate object:

export const KnowledgeCutOffDate: Record<string, string> = {
  default: "2021-09",
+ "gemini-1.0-pro": "2025-02",  // Based on deprecation date
  // ... other entries
};

Committable suggestion skipped: line range outside the PR's diff.

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