RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix: support Google Cloud Gemini eu/us multipoint endpoints (#15990)
Günter Lukas398f488b1bae
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.pyindex 8d616d7293..bc452b1bbe 100644--- a/rag/llm/chat_model.py+++ b/rag/llm/chat_model.py@@ -1122,6 +1122,22 @@ class BaiduYiyanChat(Base):class GoogleChat(Base):_FACTORY_NAME = "Google Cloud"+ @staticmethod+ def _vertex_http_options(region: str):+ region_norm = (region or "").strip().lower()+ multipoint_hosts = {+ "eu": "https://aiplatform.eu.rep.googleapis.com/",+ "us": "https://aiplatform.us.rep.googleapis.com/",+ }+ base_url = multipoint_hosts.get(region_norm)+ if base_url:+ from google.genai.types import HttpOptions++ # Gemini 3.x multi-region endpoints require *.rep hostnames+ # instead of region-aiplatform host synthesis.+ return HttpOptions(base_url=base_url, api_version="v1")+ return None+def __init__(self, key, model_name, base_url=None, **kwargs):super().__init__(key, model_name, base_url=base_url, **kwargs)@@ -1152,11 +1168,21 @@ class GoogleChat(Base):else:from google import genai+ client_kwargs = {+ "vertexai": True,+ "project": project_id,+ "location": region,+ }+ http_options = self._vertex_http_options(region)+ if http_options is not None:+ client_kwargs["http_options"] = http_options+if access_token:credits = service_account.Credentials.from_service_account_info(access_token, scopes=scopes)- self.client = genai.Client(vertexai=True, project=project_id, location=region, credentials=credits)+ client_kwargs["credentials"] = credits+ self.client = genai.Client(**client_kwargs)else:- self.client = genai.Client(vertexai=True, project=project_id, location=region)+ self.client = genai.Client(**client_kwargs)def _clean_conf(self, gen_conf):if "claude" in self.model_name:diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.pyindex 9b083acca8..a832ad6c1a 100644--- a/rag/llm/cv_model.py+++ b/rag/llm/cv_model.py@@ -1238,6 +1238,22 @@ class AnthropicCV(Base):class GoogleCV(AnthropicCV, GeminiCV):_FACTORY_NAME = "Google Cloud"+ @staticmethod+ def _vertex_http_options(region: str):+ region_norm = (region or "").strip().lower()+ multipoint_hosts = {+ "eu": "https://aiplatform.eu.rep.googleapis.com/",+ "us": "https://aiplatform.us.rep.googleapis.com/",+ }+ base_url = multipoint_hosts.get(region_norm)+ if base_url:+ from google.genai.types import HttpOptions++ # Gemini 3.x multi-region endpoints require *.rep hostnames+ # instead of region-aiplatform host synthesis.+ return HttpOptions(base_url=base_url, api_version="v1")+ return None+def __init__(self, key, model_name, lang="Chinese", base_url=None, **kwargs):import base64@@ -1266,11 +1282,20 @@ class GoogleCV(AnthropicCV, GeminiCV):self.client = AnthropicVertex(region=region, project_id=project_id)else:from google import genai+ client_kwargs = {+ "vertexai": True,+ "project": project_id,+ "location": region,+ }+ http_options = self._vertex_http_options(region)+ if http_options is not None:+ client_kwargs["http_options"] = http_optionsif access_token:credits = service_account.Credentials.from_service_account_info(access_token, scopes=scopes)- self.client = genai.Client(vertexai=True, project=project_id, location=region, credentials=credits)+ client_kwargs["credentials"] = credits+ self.client = genai.Client(**client_kwargs)else:- self.client = genai.Client(vertexai=True, project=project_id, location=region)+ self.client = genai.Client(**client_kwargs)Base.__init__(self, **kwargs)def describe(self, image):