From 6ff0a7858200ebe498d14fb6034a53e8e1c7f66a Mon Sep 17 00:00:00 2001
From: Ivan Despot <66276597+g-despot@users.noreply.github.com>
Date: Fri, 19 Jun 2026 11:09:39 +0200
Subject: [PATCH] feat: add optional location to text2vec-google vectorizer
---
.../Unit/TestVectorizers.cs | 37 +++++++++++++++++++
.../Configure/VectorizerFactory.cs | 8 +++-
src/Weaviate.Client/Models/Vectorizer.cs | 7 ++++
src/Weaviate.Client/PublicAPI.Unshipped.txt | 4 ++
4 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/src/Weaviate.Client.Tests/Unit/TestVectorizers.cs b/src/Weaviate.Client.Tests/Unit/TestVectorizers.cs
index 4ecbb419..b1476954 100644
--- a/src/Weaviate.Client.Tests/Unit/TestVectorizers.cs
+++ b/src/Weaviate.Client.Tests/Unit/TestVectorizers.cs
@@ -496,4 +496,41 @@ public void Test_Text2VecDigitalOcean_Omits_Unset_BaseURL()
Assert.Contains("\"model\":\"qwen3-embedding-0.6b\"", json);
Assert.DoesNotContain("\"baseURL\"", json);
}
+
+ ///
+ /// Tests that Text2VecGoogle omits location when unset so the server can apply its
+ /// default.
+ ///
+ [Fact]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage(
+ "Performance",
+ "CA1869:Cache and reuse 'JsonSerializerOptions' instances",
+ Justification = ""
+ )]
+ public void Test_Text2VecGoogle_Omits_Unset_Location()
+ {
+ // Arrange
+ var vc = Configure.Vector("default", v => v.Text2VecGoogleVertex(projectId: "my-project"));
+
+ // Act
+ var dto = vc.Vectorizer?.ToDto() ?? default;
+ var json = JsonSerializer.Serialize(
+ dto,
+ new JsonSerializerOptions
+ {
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
+ DefaultIgnoreCondition = System
+ .Text
+ .Json
+ .Serialization
+ .JsonIgnoreCondition
+ .WhenWritingNull,
+ WriteIndented = false,
+ }
+ );
+
+ // Assert
+ Assert.Contains("\"text2vec-google\"", json);
+ Assert.DoesNotContain("\"location\"", json);
+ }
}
diff --git a/src/Weaviate.Client/Configure/VectorizerFactory.cs b/src/Weaviate.Client/Configure/VectorizerFactory.cs
index c4bf056d..14ef6913 100644
--- a/src/Weaviate.Client/Configure/VectorizerFactory.cs
+++ b/src/Weaviate.Client/Configure/VectorizerFactory.cs
@@ -863,6 +863,7 @@ public VectorizerConfig Text2VecOpenAI(
/// The dimensions
/// The task type
/// The vectorize collection name
+ /// The Google Vertex AI region; optional, server-defaulted when null
/// The vectorizer config
public VectorizerConfig Text2VecGoogleVertex(
string? apiEndpoint = null,
@@ -871,7 +872,8 @@ public VectorizerConfig Text2VecGoogleVertex(
string? titleProperty = null,
int? dimensions = null,
string? taskType = null,
- bool? vectorizeCollectionName = null
+ bool? vectorizeCollectionName = null,
+ string? location = null
) =>
new Text2VecGoogle
{
@@ -882,6 +884,7 @@ public VectorizerConfig Text2VecGoogleVertex(
Dimensions = dimensions,
TaskType = taskType,
VectorizeCollectionName = vectorizeCollectionName,
+ Location = location,
};
///
@@ -909,6 +912,9 @@ public VectorizerConfig Text2VecGoogleGemini(
Dimensions = dimensions,
TaskType = taskType,
VectorizeCollectionName = vectorizeCollectionName,
+ // Location (Vertex AI region) is not applicable to the Gemini
+ // (generative-language) API; left null so it is omitted on the wire.
+ Location = null,
};
///
diff --git a/src/Weaviate.Client/Models/Vectorizer.cs b/src/Weaviate.Client/Models/Vectorizer.cs
index e27ce4f9..8bdfe367 100644
--- a/src/Weaviate.Client/Models/Vectorizer.cs
+++ b/src/Weaviate.Client/Models/Vectorizer.cs
@@ -1272,6 +1272,13 @@ internal Text2VecGoogle() { }
///
public string? TaskType { get; set; } = null;
+ ///
+ /// Gets or sets the Google Vertex AI region.
+ /// Optional; when omitted the server applies its default.
+ /// Serialized as the lowercase location module-config key.
+ ///
+ public string? Location { get; set; } = null;
+
///
/// Gets or sets the value of the vectorize collection name
///
diff --git a/src/Weaviate.Client/PublicAPI.Unshipped.txt b/src/Weaviate.Client/PublicAPI.Unshipped.txt
index 7dc5c581..9cec467a 100644
--- a/src/Weaviate.Client/PublicAPI.Unshipped.txt
+++ b/src/Weaviate.Client/PublicAPI.Unshipped.txt
@@ -1 +1,5 @@
#nullable enable
+*REMOVED*Weaviate.Client.VectorizerFactory.Text2VecGoogleVertex(string? apiEndpoint = null, string? model = null, string? projectId = null, string? titleProperty = null, int? dimensions = null, string? taskType = null, bool? vectorizeCollectionName = null) -> Weaviate.Client.Models.VectorizerConfig!
+Weaviate.Client.Models.Vectorizer.Text2VecGoogle.Location.get -> string?
+Weaviate.Client.Models.Vectorizer.Text2VecGoogle.Location.set -> void
+Weaviate.Client.VectorizerFactory.Text2VecGoogleVertex(string? apiEndpoint = null, string? model = null, string? projectId = null, string? titleProperty = null, int? dimensions = null, string? taskType = null, bool? vectorizeCollectionName = null, string? location = null) -> Weaviate.Client.Models.VectorizerConfig!