Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public record Text2VecGoogleVectorizer(
/** Google project ID. Only relevant for Vertex AI integration. */
@SerializedName("projectId") String projectId,

/**
* Google Vertex AI region. Only relevant for Vertex AI integration.
* If omitted, the server applies its default.
*/
@SerializedName("location") String location,

/**
* Weaviate defaults to {@code true} if the value is not provided.
* To avoid that we send "vectorizeClassName": false all the time
Expand Down Expand Up @@ -90,6 +96,7 @@ public Text2VecGoogleVectorizer(
Integer dimensions,
TaskType taskType,
String projectId,
String location,

boolean vectorizeCollectionName,
List<String> sourceProperties,
Expand All @@ -100,6 +107,7 @@ public Text2VecGoogleVectorizer(
this.titleProperty = titleProperty;
this.dimensions = dimensions;
this.projectId = projectId;
this.location = location;
this.taskType = taskType;

this.vectorizeCollectionName = false;
Expand All @@ -116,6 +124,7 @@ public Text2VecGoogleVectorizer(Builder builder) {
builder.dimensions,
builder.taskType,
builder.projectId,
builder.location,

builder.vectorizeCollectionName,
builder.sourceProperties,
Expand All @@ -133,6 +142,8 @@ public abstract static class Builder implements ObjectBuilder<Text2VecGoogleVect
private String apiEndpoint;
/** Google project ID. Only relevant for Vertex AI integration. */
private final String projectId;
/** Google Vertex AI region. Only relevant for Vertex AI integration. */
private String location;

private String model;
private String titleProperty;
Expand All @@ -149,6 +160,11 @@ protected Builder apiEndpoint(String apiEndpoint) {
return this;
}

protected Builder location(String location) {
this.location = location;
return this;
}

public Builder model(String model) {
this.model = model;
return this;
Expand Down Expand Up @@ -220,5 +236,14 @@ public VertexBuilder apiEndpoint(String apiEndpoint) {
super.apiEndpoint(apiEndpoint);
return this;
}

/**
* Set the Google Vertex AI region. If omitted, the server applies its
* default.
*/
public VertexBuilder location(String location) {
super.location(location);
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public static Object[][] testCases() {
},
{
VectorConfig.class,
Text2VecGoogleVectorizer.vertex("projectId", v -> v.sourceProperties("a")),
Text2VecGoogleVectorizer.vertex("projectId", v -> v.location("europe-west4").sourceProperties("a")),
"""
{
"vectorIndexType": "hnsw",
Expand All @@ -228,6 +228,7 @@ public static Object[][] testCases() {
"text2vec-google": {
"apiEndpoint":"us-central1-aiplatform.googleapis.com",
"projectId": "projectId",
"location": "europe-west4",
"properties": ["a"],
"vectorizeClassName": false
}
Expand Down
Loading