Repository navigation
Fix problem with Google Cloud models with reasoning (like gemini) - Additional fix to issue #10474 - #10502
Merged
Conversation
…nai SDK This PR migrates the Gemini/Vertex AI integration from the deprecated vertexai.generative_models API to the new unified google-genai SDK, building upon PR infiniflow#10477 which added ThinkingConfig support. Why this migration is necessary: - The vertexai.generative_models API is being phased out - The new google-genai SDK provides unified access to Vertex AI and AI Studio - Better support for new features like ThinkingConfig - Type-safe message handling with Content/Part objects Key changes: 1. Client initialization migrated to genai.Client(vertexai=True, ...) 2. Messages converted to Content objects with Part arrays (fixes Pydantic validation) 3. Configuration handled via GenerateContentConfig instead of dict parameters 4. Streaming uses explicit generate_content_stream() method 5. ThinkingConfig integrated into GenerateContentConfig (replaces _get_thinking_config) Dependencies updated: - vertexai: 1.64.0 → 1.70.0 (required for compatibility) - google-genai: Added >=1.41.0,<2.0.0 (new unified SDK) Supersedes the old _get_thinking_config() approach from PR infiniflow#10477 with the new SDK's native ThinkingConfig support, maintaining the same default behavior (thinking_budget=0 disabled by default). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
google-genai requires httpx>=0.28.1, but ragflow currently has 0.27.2 which is incompatible. This update ensures compatibility. Changes: - httpx[socks]: ==0.27.2 → >=0.28.1,<0.29.0 - Updated pr.txt to document this critical dependency requirement 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Analysis revealed that: - google-genai requires: httpx>=0.28.1 - ollama 0.2.1 requires: httpx ^0.27.0 (i.e., >=0.27.0, <0.28.0) - These requirements are mutually exclusive Solution: - ollama 0.5.0+ changed to httpx>=0.27 (no upper bound) - Updated to ollama>=0.5.0 to resolve the conflict This update is NECESSARY to avoid pip dependency resolution failures when installing both google-genai and ollama. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Regenerated lock file after updating: - vertexai: 1.64.0 → 1.70.0 - google-genai: Added v1.43.0 - httpx: 0.27.2 → 0.28.1 - ollama: 0.2.1 → 0.6.0 This ensures reproducible builds with the correct dependency versions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Contributor
Author
|
@yingfeng CI issue fixed |
4 tasks done
clifftseng
pushed a commit
to clifftseng/ragflow
that referenced
this pull request
Feb 9, 2026
…dditional fix to issue infiniflow#10474 (infiniflow#10502) ### What problem does this PR solve? Issue infiniflow#10474 - Update to PR infiniflow#10477 ### Type of change - [X] Bug Fix (non-breaking change which fixes an issue)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue #10474 - Update to PR #10477
Summary
This PR migrates the Google Vertex AI integration from the deprecated
vertexai.generative_modelsAPI to the new unifiedgoogle-genaiSDK, building upon PR #10477 which added ThinkingConfig support for the old API.Problem Statement
PR #10477 successfully added ThinkingConfig support to control thinking mode in Gemini models, but used the deprecated
vertexai.generative_modelsAPI. This API has several limitations:vertexai.generative_models.GenerativeModelis being phased out by GoogleGoogle is consolidating all Gemini/Vertex AI access through the unified
google-genaiSDK, making migration necessary.Technical Changes
1. Client Initialization Migration
Why this change is necessary:
aiplatform.init()) and model creation (GenerativeModel())genai.ClientobjectWhat changed:
Before (old API from PR #10477):
After (new google-genai SDK):
Benefits:
vertexai=Trueflag enables Vertex AI mode in the unified SDK2. Message Format: Content/Part Objects
Why this change is necessary:
ContentobjectsInput should be a valid dictionary or object to extract fields fromContent(role=..., parts=[Part(text=...)])What changed:
Before (old API):
After (new SDK):
Benefits:
3. Configuration: GenerateContentConfig
Why this change is necessary:
GenerateContentConfigobjectsWhat changed:
Before (old API with _get_thinking_config helper):
After (new SDK with integrated config):
Benefits:
_get_thinking_config()helper methodthinking_budget=0(disabled)4. Streaming API
Why this change is necessary:
generate_content(..., stream=True)with implicit streaminggenerate_content_stream()methodWhat changed:
Before:
After:
Benefits:
5. Dependency Updates
Why these changes are necessary:
vertexai: 1.64.0 → 1.70.0
google-genaiSDKgoogle-genai: Added >=1.41.0,<2.0.0
vertexai=Trueparameter)vertexai.generative_modelshttpx[socks]: ==0.27.2 → >=0.28.1,<0.29.0
google-genairequireshttpx>=0.28.1[socks]extra is preserved for existing proxy functionalityollama: ==0.2.1 → >=0.5.0
ollama 0.2.1requireshttpx ^0.27.0(i.e.,>=0.27.0, <0.28.0)google-genai's requirement ofhttpx>=0.28.1ollama 0.5.0+updated tohttpx>=0.27(removed upper bound), resolving the conflictgoogle-generativeai: Comment clarification
Code Structure Changes
Removed:
_get_thinking_config()helper method (replaced by native SDK support)Modified:
GoogleChat.__init__(): Client initializationGoogleChat._chat(): Complete reimplementation for new SDKGoogleChat.chat_streamly(): Streaming implementation for new SDKPreserved:
thinking_budget=0(disabled)gen_conf/llm_settingModified Files
rag/llm/chat_model.py (190 lines changed)
GoogleChat.__init__(): Migrated togenai.ClientGoogleChat._chat(): New implementation with Content/Part objects and GenerateContentConfigGoogleChat.chat_streamly(): Updated streaming withgenerate_content_stream()_get_thinking_config()(superseded by SDK-native support)pyproject.toml (5 lines changed)
vertexaito 1.70.0google-genai>=1.41.0,<2.0.0httpx[socks]to >=0.28.1,<0.29.0 (required by google-genai)ollamato >=0.5.0 (resolves httpx conflict)google-generativeaiuv.lock (153 lines changed)
Type of change