From f173d8e7c83674667452e42a4b54aa7a537b3497 Mon Sep 17 00:00:00 2001 From: Tai An Date: Mon, 3 Aug 2026 00:40:00 +0000 Subject: [PATCH] feat(config): add location to Configure.Generative.google_vertex (#2073) The generative-google module in Weaviate core reads a ``location`` class setting (default ``us-central1``) alongside ``region``, but the Python client had no way to send it, so collections could not select a Vertex location from the client. Add ``location`` to ``_GenerativeGoogleConfig`` and expose it as an optional ``location`` argument on ``Configure.Generative.google_vertex``. It is omitted from the module config when left as ``None``, so the server default still applies and existing configurations are unchanged. Runtime (gRPC) generative parameters are unchanged: the ``GenerativeGoogle`` proto message has no ``location`` field yet, so query-time support has to wait for regenerated protos. Signed-off-by: Tai An --- test/collection/test_config.py | 36 ++++++++++++++++++++++++++ weaviate/collections/classes/config.py | 7 +++++ 2 files changed, 43 insertions(+) diff --git a/test/collection/test_config.py b/test/collection/test_config.py index 99e354c1a..d99045663 100644 --- a/test/collection/test_config.py +++ b/test/collection/test_config.py @@ -1022,6 +1022,42 @@ def test_config_with_vectorizer_and_properties( } }, ), + ( + Configure.Generative.google_vertex(project_id="project"), + { + "generative-palm": { + "projectId": "project", + } + }, + ), + ( + Configure.Generative.google_vertex( + project_id="project", + api_endpoint="https://api.google.com", + region="europe-west4", + location="europe-west4", + max_output_tokens=100, + model_id="model", + endpoint_id="endpoint", + temperature=0.5, + top_k=10, + top_p=0.5, + ), + { + "generative-palm": { + "projectId": "project", + "apiEndpoint": "https://api.google.com", + "region": "europe-west4", + "location": "europe-west4", + "maxOutputTokens": 100, + "modelId": "model", + "endpointId": "endpoint", + "temperature": 0.5, + "topK": 10, + "topP": 0.5, + } + }, + ), ( Configure.Generative.aws( model="cohere.command-light-text-v14", diff --git a/weaviate/collections/classes/config.py b/weaviate/collections/classes/config.py index 19396a7fc..bf9f62604 100644 --- a/weaviate/collections/classes/config.py +++ b/weaviate/collections/classes/config.py @@ -575,6 +575,7 @@ class _GenerativeGoogleConfig(_GenerativeProvider): apiEndpoint: Optional[str] endpointId: Optional[str] region: Optional[str] + location: Optional[str] maxOutputTokens: Optional[int] modelId: Optional[str] projectId: str @@ -1082,6 +1083,7 @@ def palm( return _GenerativeGoogleConfig( apiEndpoint=api_endpoint, region=None, + location=None, maxOutputTokens=max_output_tokens, modelId=model_id, projectId=project_id, @@ -1124,6 +1126,7 @@ def google( return _GenerativeGoogleConfig( apiEndpoint=api_endpoint, region=None, + location=None, maxOutputTokens=max_output_tokens, modelId=model_id, projectId=project_id, @@ -1141,6 +1144,7 @@ def google_vertex( project_id: str, api_endpoint: Optional[str] = None, region: Optional[str] = None, + location: Optional[str] = None, max_output_tokens: Optional[int] = None, model_id: Optional[str] = None, endpoint_id: Optional[str] = None, @@ -1157,6 +1161,7 @@ def google_vertex( project_id: The Google Vertex project ID to use. api_endpoint: The API endpoint to use without a leading scheme such as `http://`. Defaults to `None`, which uses the server-defined default region: The region to use. Defaults to `None`, which uses the server-defined default + location: The location to use. Defaults to `None`, which uses the server-defined default of `us-central1` max_output_tokens: The maximum number of tokens to generate. Defaults to `None`, which uses the server-defined default model_id: The model ID to use. Defaults to `None`, which uses the server-defined default endpoint_id: The endpoint ID to use. Defaults to `None`, which uses the server-defined default @@ -1167,6 +1172,7 @@ def google_vertex( return _GenerativeGoogleConfig( apiEndpoint=api_endpoint, region=region, + location=location, maxOutputTokens=max_output_tokens, modelId=model_id, projectId=project_id, @@ -1202,6 +1208,7 @@ def google_gemini( return _GenerativeGoogleConfig( apiEndpoint=None, region=None, + location=None, maxOutputTokens=max_output_tokens, modelId=model, projectId="",