-
-
Notifications
You must be signed in to change notification settings - Fork 41
[Feature] Add Gemini 3.0 Pro and thinking mode support #628
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
Conversation
…lities - Add Gemini 3.0 Pro model detection in client - Implement thought signature tracking in message chunks - Extend types to support thought data in chat parts - Propagate thought data through message conversion pipeline - Configure context size for Gemini 3.0 Pro (1,097,152 tokens) - Refactor thinking model detection to include both 2.5 and 3.0 Pro variants
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Walkthrough本次更改扩展了 Gemini 适配器的思维模型判定列表,移动了 imagePart 的计算到消息块创建处,统一在消息中传播 thought_data,更新类型以携带 thoughtSignature,并调整/新增共享模型上下文配置(新增 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant P as _processChunks(调用方)
participant C as _createMessageChunk(集中化)
participant M as MessageChunk(输出)
Note over P,C: 变更:P 不再计算 imagePart,直接传 chunk
P->>C: 调用(content, functionCall, chunk)
C->>C: 若无 chatluna_storage,从 chunk 派生 imagePart
C->>C: 提取 thoughtSignature,构建 thought_data
C->>M: 构建 MessageChunk,additional_kwargs 包含 thought_data
C-->>P: 返回增强的 MessageChunk
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20-25 minutes 需要额外关注的区域:
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
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. Comment |
Summary of ChangesHello @dingyi222666, 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! 此拉取请求引入了对最新 Gemini 3.0 Pro 模型的支持,并增强了多个 Gemini 模型的“思维模式”功能。它还改进了模型能力检测和管理方式,以确保更好的兼容性和功能利用,同时实现了思维签名的追踪与传递。 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
此 PR 添加了对 Gemini 3.0 Pro 和思维模式的支持,整体实现思路清晰。代码改动主要集中在 Gemini 适配器中,用于传递和处理思维模式相关的 thoughtSignature。同时更新了模型列表和上下文大小配置。
我在 packages/adapter-gemini/src/client.ts 文件中发现了一个关键问题,这可能会导致思维模式的模型检测逻辑完全失效。请务必修复此问题,具体细节请见我的评论。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
packages/adapter-gemini/package.jsonis excluded by!**/*.json
📒 Files selected for processing (5)
packages/adapter-gemini/src/client.ts(1 hunks)packages/adapter-gemini/src/requester.ts(3 hunks)packages/adapter-gemini/src/types.ts(1 hunks)packages/adapter-gemini/src/utils.ts(4 hunks)packages/shared-adapter/src/client.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/adapter-gemini/src/requester.ts (2)
packages/adapter-gemini/src/types.ts (2)
ChatPart(10-17)ChatInlineDataPart(32-37)packages/adapter-gemini/src/utils.ts (1)
partAsTypeCheck(242-247)
packages/adapter-gemini/src/utils.ts (1)
packages/core/src/utils/string.ts (1)
isMessageContentText(46-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: lint
- GitHub Check: build
🔇 Additional comments (7)
packages/adapter-gemini/src/types.ts (2)
6-8: 类型设计良好!新增的
BaseChatPart类型使用可选字段thoughtSignature,能够很好地支持思维签名的传递而不破坏现有代码。
10-17: 正确扩展了 ChatPart 联合类型。仅在
ChatMessagePart和ChatFunctionCallingPart上添加BaseChatPart交集类型是合理的,因为思维签名主要与这些部分相关。packages/adapter-gemini/src/utils.ts (3)
54-64: 思维数据提取和传播实现正确!从
additional_kwargs中提取thought_data并在字符串内容和复杂内容处理中一致地传播,实现得很好。使用?? {}确保了安全的默认值。
220-236: 内容处理函数正确传播思维数据。更新
processGeminiContentParts函数签名以接受thoughtData参数,并将其传播到文本部分,确保了思维元数据的一致传递。
126-142: 函数消息处理正确传播思维数据。在
processFunctionMessage中提取并将thought_data传播到工具调用中,确保了思维签名在函数调用流程中的一致性。packages/adapter-gemini/src/requester.ts (2)
527-531: 集中化的块处理逻辑改进了代码结构。将
chunk直接传递给_createMessageChunk而不是预先推导imagePart,使得逻辑更加集中和清晰。
657-686: 消息块创建逻辑正确实现了思维数据传播。在
_createMessageChunk中集中处理imagePart推导,并始终包含带有thoughtSignature的thought_data,确保了元数据的一致传递。逻辑封装得很好。
…l support - Bump version from 1.3.0 to 1.3.4 - Add Gemini 2.5 Flash to thinking models list - Add Gemini 3.0 Pro to thinking models list - Fix thinking model detection logic to correctly match model names - Improve model filtering to exclude image variants from thinking models
ea88751 to
023e50d
Compare
This PR adds support for Gemini 3.0 Pro and implements thinking mode capabilities.
New Features
Other Changes