@@ -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 {
@@ -245,6 +255,9 @@ public void appendTo(
245255 provider .setStopSequences (WeaviateProtoBase .TextArray .newBuilder ()
246256 .addAllValues (stopSequences ));
247257 }
258+ if (location != null ) {
259+ provider .setLocation (location );
260+ }
248261 req .setGoogle (provider );
249262 }
250263
@@ -261,6 +274,7 @@ public Provider(Builder builder) {
261274 builder .projectId ,
262275 builder .endpointId ,
263276 builder .region ,
277+ builder .location ,
264278 builder .stopSequences ,
265279 builder .images ,
266280 builder .imageProperties );
@@ -279,6 +293,7 @@ public abstract static class Builder implements ObjectBuilder<GoogleGenerative.P
279293 private Float presencePenalty ;
280294 private String endpointId ;
281295 private String region ;
296+ private String location ;
282297 private final List <String > stopSequences = new ArrayList <>();
283298 private final List <String > images = new ArrayList <>();
284299 private final List <String > imageProperties = new ArrayList <>();
@@ -353,6 +368,11 @@ public Builder region(String region) {
353368 return this ;
354369 }
355370
371+ public Builder location (String location ) {
372+ this .location = location ;
373+ return this ;
374+ }
375+
356376 public Builder images (String ... images ) {
357377 return images (Arrays .asList (images ));
358378 }
0 commit comments