Skip to content

Commit de8abf9

Browse files
committed
feat(gh-581): add location parameter to generative-google module
1 parent 3866ce2 commit de8abf9

3 files changed

Lines changed: 12327 additions & 5844 deletions

File tree

src/main/java/io/weaviate/client6/v1/api/collections/generative/GoogleGenerative.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public record GoogleGenerative(
2424
@SerializedName("maxOutputTokens") Integer maxTokens,
2525
@SerializedName("topK") Integer topK,
2626
@SerializedName("topP") Float topP,
27-
@SerializedName("temperature") Float temperature) implements Generative {
27+
@SerializedName("temperature") Float temperature,
28+
@SerializedName("location") String location) implements Generative {
2829

2930
@Override
3031
public Kind _kind() {
@@ -63,7 +64,8 @@ public GoogleGenerative(Builder builder) {
6364
builder.maxTokens,
6465
builder.topK,
6566
builder.topP,
66-
builder.temperature);
67+
builder.temperature,
68+
builder.location);
6769
}
6870

6971
public abstract static class Builder implements ObjectBuilder<GoogleGenerative> {
@@ -78,6 +80,7 @@ public abstract static class Builder implements ObjectBuilder<GoogleGenerative>
7880
private Integer topK;
7981
private Float topP;
8082
private Float temperature;
83+
private String location;
8184

8285
public Builder(String apiEndpoint, String projectId) {
8386
this.projectId = projectId;
@@ -141,6 +144,12 @@ public Builder temperature(float temperature) {
141144
return this;
142145
}
143146

147+
/** Defaults to {@code us-central} on the server. */
148+
public Builder location(String location) {
149+
this.location = location;
150+
return this;
151+
}
152+
144153
@Override
145154
public GoogleGenerative build() {
146155
return new GoogleGenerative(this);
@@ -189,6 +198,7 @@ public static record Provider(
189198
String projectId,
190199
String endpointId,
191200
String region,
201+
String location,
192202
List<String> stopSequences,
193203
List<String> images,
194204
List<String> imageProperties) implements GenerativeProvider {
@@ -261,6 +271,7 @@ public Provider(Builder builder) {
261271
builder.projectId,
262272
builder.endpointId,
263273
builder.region,
274+
builder.location,
264275
builder.stopSequences,
265276
builder.images,
266277
builder.imageProperties);
@@ -279,6 +290,7 @@ public abstract static class Builder implements ObjectBuilder<GoogleGenerative.P
279290
private Float presencePenalty;
280291
private String endpointId;
281292
private String region;
293+
private String location;
282294
private final List<String> stopSequences = new ArrayList<>();
283295
private final List<String> images = new ArrayList<>();
284296
private final List<String> imageProperties = new ArrayList<>();
@@ -353,6 +365,11 @@ public Builder region(String region) {
353365
return this;
354366
}
355367

368+
public Builder location(String location) {
369+
this.location = location;
370+
return this;
371+
}
372+
356373
public Builder images(String... images) {
357374
return images(Arrays.asList(images));
358375
}

0 commit comments

Comments
 (0)