From b41a635a5cc36be25738fac6a9ed5c282c065b57 Mon Sep 17 00:00:00 2001 From: Ivan Despot <66276597+g-despot@users.noreply.github.com> Date: Wed, 19 Nov 2025 08:23:03 +0100 Subject: [PATCH 1/2] Rename generated, autocut, byId and module parameters --- README.md | 2 +- .../io/weaviate/integration/DataITest.java | 18 +++--- .../io/weaviate/integration/ORMITest.java | 4 +- .../weaviate/integration/ReferencesITest.java | 4 +- .../io/weaviate/integration/SearchITest.java | 19 ++++-- .../v1/api/collections/Generative.java | 32 +++++----- .../v1/api/collections/VectorConfig.java | 26 ++++---- .../v1/api/collections/WeaviateObject.java | 4 +- .../collections/data/WeaviateDataClient.java | 2 +- .../data/WeaviateDataClientAsync.java | 2 +- .../collections/generate/DynamicProvider.java | 10 +-- .../generate/GenerativeObject.java | 23 +++++-- .../generate/GenerativeResponse.java | 12 ++-- .../generate/GenerativeResponseGroup.java | 2 +- .../generate/GenerativeResponseGrouped.java | 2 +- .../collections/generative/AwsGenerative.java | 52 +++++++-------- .../generative/DatabricksGenerative.java | 32 +++++----- .../generative/GoogleGenerative.java | 64 +++++++++---------- .../generative/OllamaGenerative.java | 24 +++---- .../query/AbstractQueryClient.java | 10 +-- .../collections/query/BaseQueryOptions.java | 16 ++--- .../query/{ById.java => FetchObjectById.java} | 14 ++-- .../v1/api/collections/query/SortBy.java | 2 +- .../query/WeaviateQueryClient.java | 2 +- .../query/WeaviateQueryClientAsync.java | 4 +- .../v1/api/collections/query/Where.java | 2 +- .../vectorizers/Multi2VecClipVectorizer.java | 10 +-- .../vectorizers/Text2VecAwsVectorizer.java | 30 ++++----- .../Text2VecDatabricksVectorizer.java | 14 ++-- .../vectorizers/Text2VecGoogleVectorizer.java | 22 +++---- .../Text2VecHuggingFaceVectorizer.java | 14 ++-- .../Text2VecModel2VecVectorizer.java | 14 ++-- .../vectorizers/Text2VecOllamaVectorizer.java | 14 ++-- .../Text2VecTransformersVectorizer.java | 10 +-- .../api/collections/CollectionHandleTest.java | 2 +- .../client6/v1/internal/json/JSONTest.java | 10 +-- 36 files changed, 271 insertions(+), 253 deletions(-) rename src/main/java/io/weaviate/client6/v1/api/collections/query/{ById.java => FetchObjectById.java} (91%) diff --git a/README.md b/README.md index 6c7765420..817b21d78 100644 --- a/README.md +++ b/README.md @@ -701,7 +701,7 @@ record Artist(String firstName, String lastName, int age) {}; record Song(String title, Artist artist) {}; -var song1 = songs.query.byId( +var song1 = songs.query.fetchObjectById( uuid1, song -> song.returnReferences(QueryReference.single("artist")) ); diff --git a/src/it/java/io/weaviate/integration/DataITest.java b/src/it/java/io/weaviate/integration/DataITest.java index 27c3aafec..598053904 100644 --- a/src/it/java/io/weaviate/integration/DataITest.java +++ b/src/it/java/io/weaviate/integration/DataITest.java @@ -52,7 +52,7 @@ public void testCreateGetDelete() throws IOException { .uuid(id) .vectors(Vectors.of(VECTOR_INDEX, vector))); - var object = artists.query.byId(id, query -> query + var object = artists.query.fetchObjectById(id, query -> query .returnProperties("name") .returnMetadata( MetadataField.VECTOR, @@ -99,7 +99,7 @@ public void testBlobData() throws IOException { "breed", "ragdoll", "img", ragdollPng)); - var got = cats.query.byId(ragdoll.metadata().uuid(), + var got = cats.query.fetchObjectById(ragdoll.metadata().uuid(), cat -> cat.returnProperties("img")); Assertions.assertThat(got).get() @@ -145,7 +145,7 @@ public void testReferences_AddReplaceDelete() throws IOException { Reference.object(albie)); // Assert - var johnWithFriends = persons.query.byId(john.metadata().uuid(), + var johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(), query -> query.returnReferences( QueryReference.single("hasFriend", friend -> friend.returnProperties("name")))); @@ -165,7 +165,7 @@ public void testReferences_AddReplaceDelete() throws IOException { "hasFriend", Reference.object(barbara)); - johnWithFriends = persons.query.byId(john.metadata().uuid(), + johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(), query -> query.returnReferences( QueryReference.single("hasFriend", friend -> friend.returnProperties("name")))); @@ -185,7 +185,7 @@ public void testReferences_AddReplaceDelete() throws IOException { Reference.object(barbara)); // Assert - johnWithFriends = persons.query.byId(john.metadata().uuid(), + johnWithFriends = persons.query.fetchObjectById(john.metadata().uuid(), query -> query.returnReferences( QueryReference.single("hasFriend"))); @@ -214,7 +214,7 @@ public void testReplace() throws IOException { replace -> replace.properties(Map.of("year", 1819))); // Assert - var replacedIvanhoe = books.query.byId(ivanhoe.metadata().uuid()); + var replacedIvanhoe = books.query.fetchObjectById(ivanhoe.metadata().uuid()); Assertions.assertThat(replacedIvanhoe).get() .as("has ONLY year property") @@ -258,7 +258,7 @@ public void testUpdate() throws IOException { .vectors(Vectors.of(vector))); // Assert - var updIvanhoe = books.query.byId( + var updIvanhoe = books.query.fetchObjectById( ivanhoe.metadata().uuid(), query -> query .includeVector() @@ -387,7 +387,7 @@ public void testReferenceAddMany() throws IOException { // Assert Assertions.assertThat(response.errors()).isEmpty(); - var goodburgAirports = cities.query.byId(goodburg.metadata().uuid(), + var goodburgAirports = cities.query.fetchObjectById(goodburg.metadata().uuid(), city -> city.returnReferences( QueryReference.single("hasAirports"))); @@ -469,7 +469,7 @@ public void testDataTypes() throws IOException { // Act var object = types.data.insert(want); - var got = types.query.byId(object.uuid()); // return all properties + var got = types.query.fetchObjectById(object.uuid()); // return all properties // Assert Assertions.assertThat(got).get() diff --git a/src/it/java/io/weaviate/integration/ORMITest.java b/src/it/java/io/weaviate/integration/ORMITest.java index 3d066b5e5..73b856ea1 100644 --- a/src/it/java/io/weaviate/integration/ORMITest.java +++ b/src/it/java/io/weaviate/integration/ORMITest.java @@ -239,7 +239,7 @@ public void test_insertAndQuery() throws Exception { var inserted = things.data.insert(thing); // Assert - var response = things.query.byId(inserted.uuid()); + var response = things.query.fetchObjectById(inserted.uuid()); var got = Assertions.assertThat(response).get().actual(); Assertions.assertThat(got.properties()) @@ -353,7 +353,7 @@ public void test_partialScan() throws IOException { null)); // Act: return subset of the properties - var got = songs.query.byId(dystopia.uuid(), + var got = songs.query.fetchObjectById(dystopia.uuid(), q -> q.returnProperties("title", "hasAward")); // Assert diff --git a/src/it/java/io/weaviate/integration/ReferencesITest.java b/src/it/java/io/weaviate/integration/ReferencesITest.java index 53a36a2c1..6e9016cdd 100644 --- a/src/it/java/io/weaviate/integration/ReferencesITest.java +++ b/src/it/java/io/weaviate/integration/ReferencesITest.java @@ -91,7 +91,7 @@ public void testReferences() throws IOException { .extracting(ReferenceProperty::dataTypes, InstanceOfAssertFactories.list(String.class)) .containsOnly(nsMovies); - var gotAlex = artists.query.byId(alex.metadata().uuid(), + var gotAlex = artists.query.fetchObjectById(alex.metadata().uuid(), opt -> opt.returnReferences( QueryReference.multi("hasAwards", nsOscar), QueryReference.multi("hasAwards", nsGrammy))); @@ -155,7 +155,7 @@ public void testNestedReferences() throws IOException { .reference("hasAwards", Reference.objects(grammy_1))); // Assert: fetch nested references - var gotAlex = artists.query.byId(alex.metadata().uuid(), + var gotAlex = artists.query.fetchObjectById(alex.metadata().uuid(), opt -> opt.returnReferences( QueryReference.single("hasAwards", ref -> ref diff --git a/src/it/java/io/weaviate/integration/SearchITest.java b/src/it/java/io/weaviate/integration/SearchITest.java index 346a8b2a3..0fd68b684 100644 --- a/src/it/java/io/weaviate/integration/SearchITest.java +++ b/src/it/java/io/weaviate/integration/SearchITest.java @@ -478,7 +478,7 @@ public void test_includeVectors() throws IOException { Vectors.of("v3", new float[] { 7, 8, 9 }))); // Act - var got = things.query.byId( + var got = things.query.fetchObjectById( thing_1.uuid(), q -> q.includeVector("v1", "v2")); @@ -597,7 +597,7 @@ public void testGenerative_bm25() throws IOException { // Act var french = things.generate.bm25( "fork", - bm25 -> bm25.queryProperties("title").limit(2), + bm25 -> bm25.queryProperties("title").limit(2).includeVector(), generate -> generate .singlePrompt("translate to French") .groupedTask("count letters R")); @@ -606,12 +606,19 @@ public void testGenerative_bm25() throws IOException { Assertions.assertThat(french.objects()) .as("individual results") .hasSize(2) - .extracting(GenerativeObject::generated) + .allSatisfy(obj -> { + Assertions.assertThat(obj.uuid()).as("uuid shorthand").isNotBlank() + .isEqualTo(obj.metadata().uuid()); + Assertions.assertThat(obj.vectors()).as("vectors shorthand").isNotNull() + .isEqualTo(obj.metadata().vectors()); + }) + // **END SHORTHAND TESTS** + .extracting(GenerativeObject::generative) .allSatisfy(generated -> { Assertions.assertThat(generated.text()).isNotBlank(); }); - Assertions.assertThat(french.generated()) + Assertions.assertThat(french.generative()) .as("summary") .extracting(TaskOutput::text, InstanceOfAssertFactories.STRING) .isNotBlank(); @@ -655,14 +662,14 @@ public void testGenerative_bm25_groupBy() throws IOException { .describedAs("objects in group %s", groupName) .hasSize(1); - Assertions.assertThat(group.generated()) + Assertions.assertThat(group.generative()) .describedAs("summary group %s", groupName) .extracting(TaskOutput::text, InstanceOfAssertFactories.STRING) .isNotBlank(); }); - Assertions.assertThat(french.generated()) + Assertions.assertThat(french.generative()) .as("summary") .extracting(TaskOutput::text, InstanceOfAssertFactories.STRING) .isNotBlank(); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/Generative.java b/src/main/java/io/weaviate/client6/v1/api/collections/Generative.java index ce160b7f3..c4462f7d4 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/Generative.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/Generative.java @@ -118,23 +118,23 @@ public static Generative awsBedrock(String region, String model, /** * Configure a default {@code generative-aws} module with Sagemaker integration. * - * @param region AWS region. - * @param baseUrl Base inference URL. + * @param region AWS region. + * @param endpoint Base inference URL. */ - public static Generative awsSagemaker(String region, String baseUrl) { - return AwsGenerative.sagemaker(region, baseUrl); + public static Generative awsSagemaker(String region, String endpoint) { + return AwsGenerative.sagemaker(region, endpoint); } /** * Configure a {@code generative-aws} module with Sagemaker integration. * - * @param region AWS region. - * @param baseUrl Base inference URL. - * @param fn Lambda expression for optional parameters. + * @param region AWS region. + * @param endpoint Base inference URL. + * @param fn Lambda expression for optional parameters. */ - public static Generative awsSagemaker(String region, String baseUrl, + public static Generative awsSagemaker(String region, String endpoint, Function> fn) { - return AwsGenerative.sagemaker(region, baseUrl, fn); + return AwsGenerative.sagemaker(region, endpoint, fn); } /** Configure a default {@code generative-cohere} module. */ @@ -154,21 +154,21 @@ public static Generative cohere(Function> fn) { - return DatabricksGenerative.of(baseURL, fn); + return DatabricksGenerative.of(endpoint, fn); } /** Configure a default {@code generative-frienliai} module. */ diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index ffb05dd64..bd44fe714 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -619,23 +619,23 @@ public static Map.Entry text2vecAwsBedrock(String vectorNa * Create a vector index with an {@code text2vec-aws} vectorizer with Sagemaker * integration. * - * @param baseUrl Base URL of the inference service. + * @param endpoint Base URL of the inference service. */ - public static Map.Entry text2vecAwsSagemaker(String baseUrl) { - return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, baseUrl); + public static Map.Entry text2vecAwsSagemaker(String endpoint) { + return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, endpoint); } /** * Create a vector index with an {@code text2vec-aws} vectorizer with Sagemaker * integration. * - * @param baseUrl Base URL of the inference service. - * @param fn Lambda expression for optional parameters. + * @param endpoint Base URL of the inference service. + * @param fn Lambda expression for optional parameters. */ public static Map.Entry text2vecAwsSagemaker( - String baseUrl, + String endpoint, Function> fn) { - return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, baseUrl, fn); + return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, endpoint, fn); } /** @@ -643,10 +643,10 @@ public static Map.Entry text2vecAwsSagemaker( * vectorizer with Sagemaker integration. * * @param vectorName Vector name. - * @param baseUrl Base URL of the inference service. + * @param endpoint Base URL of the inference service. */ - public static Map.Entry text2vecAwsSagemaker(String vectorName, String baseUrl) { - return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(baseUrl)); + public static Map.Entry text2vecAwsSagemaker(String vectorName, String endpoint) { + return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(endpoint)); } /** @@ -654,13 +654,13 @@ public static Map.Entry text2vecAwsSagemaker(String vector * vectorizer with Sagemaker integration. * * @param vectorName Vector name. - * @param baseUrl Base URL of the inference service. + * @param endpoint Base URL of the inference service. * @param fn Lambda expression for optional parameters. */ public static Map.Entry text2vecAwsSagemaker(String vectorName, - String baseUrl, + String endpoint, Function> fn) { - return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(baseUrl, fn)); + return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(endpoint, fn)); } /** diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/WeaviateObject.java b/src/main/java/io/weaviate/client6/v1/api/collections/WeaviateObject.java index 3180cf2e7..c320cb20f 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/WeaviateObject.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/WeaviateObject.java @@ -27,12 +27,12 @@ public record WeaviateObject( Map> references, M metadata) { - /** Shorthand for accesing objects's UUID from metadata. */ + /** Shorthand for accessing objects's UUID from metadata. */ public String uuid() { return metadata.uuid(); } - /** Shorthand for accesing objects's vectors from metadata. */ + /** Shorthand for accessing objects's vectors from metadata. */ public Vectors vectors() { return metadata.vectors(); } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClient.java b/src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClient.java index be9cb5d4e..1effe1aa0 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClient.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClient.java @@ -80,7 +80,7 @@ public WeaviateObject insert(InsertObjectRe } public boolean exists(String uuid) { - return this.query.byId(uuid).isPresent(); + return this.query.fetchObjectById(uuid).isPresent(); } public void update(String uuid, diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClientAsync.java b/src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClientAsync.java index 6aae3bb41..251b2c055 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClientAsync.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/data/WeaviateDataClientAsync.java @@ -77,7 +77,7 @@ public CompletableFuture insertMany(InsertManyRequest exists(String uuid) { - return this.query.byId(uuid).thenApply(Optional::isPresent); + return this.query.fetchObjectById(uuid).thenApply(Optional::isPresent); } public CompletableFuture update(String uuid, diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generate/DynamicProvider.java b/src/main/java/io/weaviate/client6/v1/api/collections/generate/DynamicProvider.java index da2452391..231cd8558 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generate/DynamicProvider.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generate/DynamicProvider.java @@ -58,15 +58,15 @@ public static DynamicProvider awsBedrock( /** * Configure {@code generative-aws} as a dynamic provider. * - * @param region AWS region. - * @param baseUrl Base inference URL. - * @param fn Lambda expression for optional parameters. + * @param region AWS region. + * @param endpoint Base inference URL. + * @param fn Lambda expression for optional parameters. */ public static DynamicProvider awsSagemaker( String region, - String baseUrl, + String endpoint, Function> fn) { - return AwsGenerative.Provider.sagemaker(region, baseUrl, fn); + return AwsGenerative.Provider.sagemaker(region, endpoint, fn); } /** diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeObject.java b/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeObject.java index 1767865e9..79f735b3c 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeObject.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeObject.java @@ -1,12 +1,23 @@ package io.weaviate.client6.v1.api.collections.generate; +import io.weaviate.client6.v1.api.collections.Vectors; import io.weaviate.client6.v1.api.collections.query.QueryMetadata; public record GenerativeObject( - /** Object properties. */ - PropertiesT properties, - /** Object metadata. */ - QueryMetadata metadata, - /** Generative task output. */ - TaskOutput generated) { + /** Object properties. */ + PropertiesT properties, + /** Object metadata. */ + QueryMetadata metadata, + /** Generative task output. */ + TaskOutput generative) { + + /** Shorthand for accessing objects's UUID from metadata. */ + public String uuid() { + return metadata.uuid(); + } + + /** Shorthand for accessing objects's vectors from metadata. */ + public Vectors vectors() { + return metadata.vectors(); + } } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeResponse.java b/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeResponse.java index 82a75cefe..275722e52 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeResponse.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeResponse.java @@ -25,7 +25,7 @@ public record GenerativeResponse( float took, List> objects, - TaskOutput generated) { + TaskOutput generative) { static GenerativeResponse unmarshal( WeaviateProtoSearchGet.SearchReply reply, CollectionDescriptor collection) { @@ -57,9 +57,9 @@ static TaskOutput unmarshalTaskOutput(List( /** Objects retrieved in the query. */ List> objects, /** Output of the summary task for this group. */ - TaskOutput generated) { + TaskOutput generative) { } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeResponseGrouped.java b/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeResponseGrouped.java index 673cddbde..9c8504894 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeResponseGrouped.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeResponseGrouped.java @@ -20,7 +20,7 @@ public record GenerativeResponseGrouped( /** Grouped results with per-group generated output. */ Map> groups, /** Output of the summary group task. */ - TaskOutput generated) { + TaskOutput generative) { static GenerativeResponseGrouped unmarshal( WeaviateProtoSearchGet.SearchReply reply, diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generative/AwsGenerative.java b/src/main/java/io/weaviate/client6/v1/api/collections/generative/AwsGenerative.java index d49e03900..e92a0d548 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generative/AwsGenerative.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generative/AwsGenerative.java @@ -17,7 +17,7 @@ public record AwsGenerative( @SerializedName("region") String region, @SerializedName("service") Service service, - @SerializedName("endpoint") String baseUrl, + @SerializedName("endpoint") String endpoint, @SerializedName("model") String model) implements Generative { @Override @@ -39,20 +39,20 @@ public static AwsGenerative bedrock(String region, String model, return fn.apply(new BedrockBuilder(region, model)).build(); } - public static AwsGenerative sagemaker(String region, String baseUrl) { - return sagemaker(region, baseUrl, ObjectBuilder.identity()); + public static AwsGenerative sagemaker(String region, String endpoint) { + return sagemaker(region, endpoint, ObjectBuilder.identity()); } - public static AwsGenerative sagemaker(String region, String baseUrl, + public static AwsGenerative sagemaker(String region, String endpoint, Function> fn) { - return fn.apply(new SagemakerBuilder(region, baseUrl)).build(); + return fn.apply(new SagemakerBuilder(region, endpoint)).build(); } public AwsGenerative(Builder builder) { this( builder.region, builder.service, - builder.baseUrl, + builder.endpoint, builder.model); } @@ -65,12 +65,12 @@ public Builder(Service service, String region) { this.region = region; } - private String baseUrl; + private String endpoint; private String model; /** Base URL of the generative provider. */ - protected Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + protected Builder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } @@ -100,14 +100,14 @@ public Builder model(String model) { } public static class SagemakerBuilder extends Builder { - public SagemakerBuilder(String region, String baseUrl) { + public SagemakerBuilder(String region, String endpoint) { super(Service.SAGEMAKER, region); - super.baseUrl(baseUrl); + super.endpoint(endpoint); } /** Required for {@link Service#SAGEMAKER}. */ - public Builder baseUrl(String baseUrl) { - return super.baseUrl(baseUrl); + public Builder endpoint(String endpoint) { + return super.endpoint(endpoint); } } @@ -117,7 +117,7 @@ public static record Metadata() implements ProviderMetadata { public static record Provider( String region, Service service, - String baseUrl, + String endpoint, String model, String targetModel, String targetModelVariant, @@ -134,9 +134,9 @@ public static Provider bedrock( public static Provider sagemaker( String region, - String baseUrl, + String endpoint, Function> fn) { - return fn.apply(new SagemakerBuilder(region, baseUrl)).build(); + return fn.apply(new SagemakerBuilder(region, endpoint)).build(); } @Override @@ -152,8 +152,8 @@ public void appendTo( : service == Service.SAGEMAKER ? "sagemaker" : "unknown"); } - if (baseUrl != null) { - provider.setEndpoint(baseUrl); + if (endpoint != null) { + provider.setEndpoint(endpoint); } if (model != null) { provider.setModel(model); @@ -182,7 +182,7 @@ public Provider(Builder builder) { this( builder.region, builder.service, - builder.baseUrl, + builder.endpoint, builder.model, builder.targetModel, builder.targetModelVariant, @@ -194,7 +194,7 @@ public Provider(Builder builder) { public abstract static class Builder implements ObjectBuilder { private final Service service; private final String region; - private String baseUrl; + private String endpoint; private String model; private String targetModel; private String targetModelVariant; @@ -208,8 +208,8 @@ protected Builder(Service service, String region) { } /** Base URL of the generative provider. */ - protected Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + protected Builder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } @@ -276,14 +276,14 @@ public Builder model(String model) { } public static class SagemakerBuilder extends Builder { - public SagemakerBuilder(String region, String baseUrl) { + public SagemakerBuilder(String region, String endpoint) { super(Service.SAGEMAKER, region); - super.baseUrl(baseUrl); + super.endpoint(endpoint); } /** Required for {@link Service#SAGEMAKER}. */ - public Builder baseUrl(String baseUrl) { - return super.baseUrl(baseUrl); + public Builder endpoint(String endpoint) { + return super.endpoint(endpoint); } } } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generative/DatabricksGenerative.java b/src/main/java/io/weaviate/client6/v1/api/collections/generative/DatabricksGenerative.java index df2b44f14..0b69fd54b 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generative/DatabricksGenerative.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generative/DatabricksGenerative.java @@ -14,7 +14,7 @@ import io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoGenerative; public record DatabricksGenerative( - @SerializedName("endpoint") String baseUrl, + @SerializedName("endpoint") String endpoint, @SerializedName("maxTokens") Integer maxTokens, @SerializedName("topK") Integer topK, @SerializedName("topP") Float topP, @@ -30,17 +30,17 @@ public Object _self() { return this; } - public static DatabricksGenerative of(String baseURL) { - return of(baseURL, ObjectBuilder.identity()); + public static DatabricksGenerative of(String endpoint) { + return of(endpoint, ObjectBuilder.identity()); } - public static DatabricksGenerative of(String baseURL, Function> fn) { - return fn.apply(new Builder(baseURL)).build(); + public static DatabricksGenerative of(String endpoint, Function> fn) { + return fn.apply(new Builder(endpoint)).build(); } public DatabricksGenerative(Builder builder) { this( - builder.baseUrl, + builder.endpoint, builder.maxTokens, builder.topK, builder.topP, @@ -48,15 +48,15 @@ public DatabricksGenerative(Builder builder) { } public static class Builder implements ObjectBuilder { - private final String baseUrl; + private final String endpoint; private Integer maxTokens; private Integer topK; private Float topP; private Float temperature; - public Builder(String baseUrl) { - this.baseUrl = baseUrl; + public Builder(String endpoint) { + this.endpoint = endpoint; } /** Limit the number of tokens to generate in the response. */ @@ -96,7 +96,7 @@ public static record Metadata(ProviderMetadata.Usage usage) implements ProviderM } public static record Provider( - String baseUrl, + String endpoint, Integer maxTokens, String model, Float temperature, @@ -117,8 +117,8 @@ public static Provider of( public void appendTo( io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoGenerative.GenerativeProvider.Builder req) { var provider = WeaviateProtoGenerative.GenerativeDatabricks.newBuilder(); - if (baseUrl != null) { - provider.setEndpoint(baseUrl); + if (endpoint != null) { + provider.setEndpoint(endpoint); } if (maxTokens != null) { provider.setMaxTokens(maxTokens); @@ -156,7 +156,7 @@ public void appendTo( public Provider(Builder builder) { this( - builder.baseUrl, + builder.endpoint, builder.maxTokens, builder.model, builder.temperature, @@ -170,7 +170,7 @@ public Provider(Builder builder) { } public static class Builder implements ObjectBuilder { - private String baseUrl; + private String endpoint; private Integer n; private Float topP; private String model; @@ -183,8 +183,8 @@ public static class Builder implements ObjectBuilder stopSequences = new ArrayList<>(); /** Base URL of the generative provider. */ - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generative/GoogleGenerative.java b/src/main/java/io/weaviate/client6/v1/api/collections/generative/GoogleGenerative.java index 0418e1e4d..45536cdc4 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generative/GoogleGenerative.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generative/GoogleGenerative.java @@ -15,8 +15,8 @@ import io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoGenerative; public record GoogleGenerative( - @SerializedName("apiEndpoint") String baseUrl, - @SerializedName("modelId") String model, + @SerializedName("apiEndpoint") String apiEndpoint, + @SerializedName("modelId") String modelId, @SerializedName("projectId") String projectId, @SerializedName("maxOutputTokens") Integer maxTokens, @SerializedName("topK") Integer topK, @@ -51,8 +51,8 @@ public static GoogleGenerative vertex(String projectId, Function { - private String baseUrl; + private String apiEndpoint; private final String projectId; - private String model; + private String modelId; private Integer maxTokens; private Integer topK; private Float topP; private Float temperature; - public Builder(String baseUrl, String projectId) { + public Builder(String apiEndpoint, String projectId) { this.projectId = projectId; - this.baseUrl = baseUrl; + this.apiEndpoint = apiEndpoint; } /** Base URL of the generative provider. */ - protected Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + protected Builder apiEndpoint(String apiEndpoint) { + this.apiEndpoint = apiEndpoint; return this; } /** Select generative model. */ - public Builder model(String model) { - this.model = model; + public Builder modelId(String modelId) { + this.modelId = modelId; return this; } @@ -132,8 +132,8 @@ public VertexBuilder(String projectId) { } /** Base URL of the generative provider. */ - public VertexBuilder baseUrl(String baseUrl) { - super.baseUrl(baseUrl); + public VertexBuilder apiEndpoint(String apiEndpoint) { + super.apiEndpoint(apiEndpoint); return this; } } @@ -151,9 +151,9 @@ public static record Usage(Long promptTokenCount, Long candidatesTokenCount, Lon } public static record Provider( - String baseUrl, + String apiEndpoint, Integer maxTokens, - String model, + String modelId, Float temperature, Integer topK, Float topP, @@ -181,14 +181,14 @@ public static Provider aiStudio( public void appendTo( io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoGenerative.GenerativeProvider.Builder req) { var provider = WeaviateProtoGenerative.GenerativeGoogle.newBuilder(); - if (baseUrl != null) { - provider.setApiEndpoint(baseUrl); + if (apiEndpoint != null) { + provider.setApiEndpoint(apiEndpoint); } if (maxTokens != null) { provider.setMaxTokens(maxTokens); } - if (model != null) { - provider.setModel(model); + if (modelId != null) { + provider.setModel(modelId); } if (temperature != null) { provider.setTemperature(temperature); @@ -223,9 +223,9 @@ public void appendTo( public Provider(Builder builder) { this( - builder.baseUrl, + builder.apiEndpoint, builder.maxTokens, - builder.model, + builder.modelId, builder.temperature, builder.topK, builder.topP, @@ -241,11 +241,11 @@ public Provider(Builder builder) { public abstract static class Builder implements ObjectBuilder { private final String projectId; - private String baseUrl; + private String apiEndpoint; private Integer topK; private Float topP; - private String model; + private String modelId; private Integer maxTokens; private Float temperature; private Float frequencyPenalty; @@ -256,14 +256,14 @@ public abstract static class Builder implements ObjectBuilder images = new ArrayList<>(); private final List imageProperties = new ArrayList<>(); - public Builder(String baseUrl, String projectId) { + public Builder(String apiEndpoint, String projectId) { this.projectId = projectId; - this.baseUrl = baseUrl; + this.apiEndpoint = apiEndpoint; } /** Base URL of the generative provider. */ - protected Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + protected Builder apiEndpoint(String apiEndpoint) { + this.apiEndpoint = apiEndpoint; return this; } @@ -290,8 +290,8 @@ public Builder presencePenalty(float presencePenalty) { } /** Select generative model. */ - public Builder model(String model) { - this.model = model; + public Builder modelId(String modelId) { + this.modelId = modelId; return this; } @@ -371,8 +371,8 @@ public VertexBuilder(String projectId) { } /** Base URL of the generative provider. */ - public VertexBuilder baseUrl(String baseUrl) { - super.baseUrl(baseUrl); + public VertexBuilder apiEndpoint(String apiEndpoint) { + super.apiEndpoint(apiEndpoint); return this; } } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generative/OllamaGenerative.java b/src/main/java/io/weaviate/client6/v1/api/collections/generative/OllamaGenerative.java index 89a356b8d..93b5fb3c7 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generative/OllamaGenerative.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generative/OllamaGenerative.java @@ -14,7 +14,7 @@ import io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoGenerative; public record OllamaGenerative( - @SerializedName("apiEndpoint") String baseUrl, + @SerializedName("apiEndpoint") String apiEndpoint, @SerializedName("model") String model) implements Generative { @Override @@ -37,17 +37,17 @@ public static OllamaGenerative of(Function { - private String baseUrl; + private String apiEndpoint; private String model; /** Base URL of the generative model. */ - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + public Builder apiEndpoint(String apiEndpoint) { + this.apiEndpoint = apiEndpoint; return this; } @@ -67,7 +67,7 @@ public static record Metadata() implements ProviderMetadata { } public static record Provider( - String baseUrl, + String apiEndpoint, String model, Float temperature, List images, @@ -82,8 +82,8 @@ public static Provider of( public void appendTo( io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoGenerative.GenerativeProvider.Builder req) { var provider = WeaviateProtoGenerative.GenerativeOllama.newBuilder(); - if (baseUrl != null) { - provider.setApiEndpoint(baseUrl); + if (apiEndpoint != null) { + provider.setApiEndpoint(apiEndpoint); } if (model != null) { provider.setModel(model); @@ -104,7 +104,7 @@ public void appendTo( public Provider(Builder builder) { this( - builder.baseUrl, + builder.apiEndpoint, builder.model, builder.temperature, builder.images, @@ -112,15 +112,15 @@ public Provider(Builder builder) { } public static class Builder implements ObjectBuilder { - private String baseUrl; + private String apiEndpoint; private String model; private Float temperature; private final List images = new ArrayList<>(); private final List imageProperties = new ArrayList<>(); /** Base URL of the generative provider. */ - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + public Builder apiEndpoint(String apiEndpoint) { + this.apiEndpoint = apiEndpoint; return this; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/query/AbstractQueryClient.java b/src/main/java/io/weaviate/client6/v1/api/collections/query/AbstractQueryClient.java index 99ee83fd6..2e440df84 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/query/AbstractQueryClient.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/query/AbstractQueryClient.java @@ -31,7 +31,7 @@ abstract class AbstractQueryClient> fn) { + public SingleT fetchObjectById(String uuid, Function> fn) { // Collection handle defaults (consistencyLevel / tenant) are irrelevant for // by-ID lookup. Do not `applyDefaults` to `fn`. - return byId(ById.of(uuid, fn)); + return fetchObjectById(FetchObjectById.of(uuid, fn)); } /** diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/query/BaseQueryOptions.java b/src/main/java/io/weaviate/client6/v1/api/collections/query/BaseQueryOptions.java index 382b9d48b..bdd3ed82e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/query/BaseQueryOptions.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/query/BaseQueryOptions.java @@ -16,7 +16,7 @@ public record BaseQueryOptions( Integer limit, Integer offset, - Integer autocut, + Integer autolimit, String after, ConsistencyLevel consistencyLevel, Where where, @@ -30,7 +30,7 @@ private BaseQueryOptions(Builder, T> this( builder.limit, builder.offset, - builder.autocut, + builder.autolimit, builder.after, builder.consistencyLevel, builder.where, @@ -46,7 +46,7 @@ private BaseQueryOptions(Builder, T> public static abstract class Builder, T extends Object> implements ObjectBuilder { private Integer limit; private Integer offset; - private Integer autocut; + private Integer autolimit; private String after; private ConsistencyLevel consistencyLevel; private Where where; @@ -85,12 +85,12 @@ public final SelfT offset(int offset) { /** * Discard results after an automatically calculated cutoff point. * - * @param autocut The number of "groups" to keep. + * @param autolimit The number of "groups" to keep. * @see Documentation */ - public final SelfT autocut(int autocut) { - this.autocut = autocut; + public final SelfT autolimit(int autolimit) { + this.autolimit = autolimit; return (SelfT) this; } @@ -210,8 +210,8 @@ final void appendTo(WeaviateProtoSearchGet.SearchRequest.Builder req) { if (StringUtils.isNotBlank(after)) { req.setAfter(after); } - if (autocut != null) { - req.setAutocut(autocut); + if (autolimit != null) { + req.setAutocut(autolimit); } if (consistencyLevel != null) { diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/query/ById.java b/src/main/java/io/weaviate/client6/v1/api/collections/query/FetchObjectById.java similarity index 91% rename from src/main/java/io/weaviate/client6/v1/api/collections/query/ById.java rename to src/main/java/io/weaviate/client6/v1/api/collections/query/FetchObjectById.java index babca7841..caf00ff19 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/query/ById.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/query/FetchObjectById.java @@ -12,7 +12,7 @@ import io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoBase; import io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoSearchGet; -public record ById( +public record FetchObjectById( String uuid, List returnProperties, List returnReferences, @@ -21,15 +21,15 @@ public record ById( static final String ID_PROPERTY = "_id"; - public static ById of(String uuid) { + public static FetchObjectById of(String uuid) { return of(uuid, ObjectBuilder.identity()); } - public static ById of(String uuid, Function> fn) { + public static FetchObjectById of(String uuid, Function> fn) { return fn.apply(new Builder(uuid)).build(); } - public ById(Builder builder) { + public FetchObjectById(Builder builder) { this(builder.uuid, new ArrayList<>(builder.returnProperties), builder.returnReferences, @@ -37,7 +37,7 @@ public ById(Builder builder) { builder.includeVectors); } - public static class Builder implements ObjectBuilder { + public static class Builder implements ObjectBuilder { // Required query parameters. private final String uuid; @@ -101,8 +101,8 @@ public final Builder includeVector(List vectors) { } @Override - public ById build() { - return new ById(this); + public FetchObjectById build() { + return new FetchObjectById(this); } } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/query/SortBy.java b/src/main/java/io/weaviate/client6/v1/api/collections/query/SortBy.java index cf8118002..55ca1b3e4 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/query/SortBy.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/query/SortBy.java @@ -26,7 +26,7 @@ public static SortBy property(String property) { * @see #desc() to sort in descending order. */ public static SortBy uuid() { - return property(ById.ID_PROPERTY); + return property(FetchObjectById.ID_PROPERTY); } /** diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/query/WeaviateQueryClient.java b/src/main/java/io/weaviate/client6/v1/api/collections/query/WeaviateQueryClient.java index d88588450..6e875deda 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/query/WeaviateQueryClient.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/query/WeaviateQueryClient.java @@ -24,7 +24,7 @@ public WeaviateQueryClient(WeaviateQueryClient c, CollectionHandleDefaults de } @Override - protected Optional> byId(ById byId) { + protected Optional> fetchObjectById(FetchObjectById byId) { var request = new QueryRequest(byId, null); var result = this.grpcTransport.performRequest(request, QueryRequest.rpc(collection, defaults)); return optionalFirst(result); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/query/WeaviateQueryClientAsync.java b/src/main/java/io/weaviate/client6/v1/api/collections/query/WeaviateQueryClientAsync.java index a774d0e29..3b5c2e3f6 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/query/WeaviateQueryClientAsync.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/query/WeaviateQueryClientAsync.java @@ -25,8 +25,8 @@ public WeaviateQueryClientAsync(WeaviateQueryClientAsync qc, CollectionHandle } @Override - protected CompletableFuture>> byId( - ById byId) { + protected CompletableFuture>> fetchObjectById( + FetchObjectById byId) { var request = new QueryRequest(byId, null); var result = this.grpcTransport.performRequestAsync(request, QueryRequest.rpc(collection, defaults)); return result.thenApply(this::optionalFirst); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/query/Where.java b/src/main/java/io/weaviate/client6/v1/api/collections/query/Where.java index 74667a3f8..b28f68a2f 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/query/Where.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/query/Where.java @@ -110,7 +110,7 @@ public Where not() { /** Filter by object UUID. */ public static WhereBuilder uuid() { - return property(ById.ID_PROPERTY); + return property(FetchObjectById.ID_PROPERTY); } /** Filter by object property. */ diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecClipVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecClipVectorizer.java index 036f77a41..40148ff80 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecClipVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecClipVectorizer.java @@ -15,7 +15,7 @@ public record Multi2VecClipVectorizer( /** Base URL of the embedding service. */ - @SerializedName("inferenceUrl") String baseUrl, + @SerializedName("inferenceUrl") String inferenceUrl, /** BLOB properties included in the embedding. */ @SerializedName("imageFields") List imageFields, /** TEXT properties included in the embedding. */ @@ -60,7 +60,7 @@ public static Multi2VecClipVectorizer of(Function { private Map imageFields = new LinkedHashMap<>(); private Map textFields = new LinkedHashMap<>(); - private String baseUrl; + private String inferenceUrl; /** Set base URL of the embedding service. */ - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + public Builder inferenceUrl(String inferenceUrl) { + this.inferenceUrl = inferenceUrl; return this; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java index 0523baade..9b9db2ee5 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java @@ -13,7 +13,7 @@ import io.weaviate.client6.v1.internal.ObjectBuilder; public record Text2VecAwsVectorizer( - @SerializedName("endpoint") String baseUrl, + @SerializedName("endpoint") String endpoint, @SerializedName("model") String model, @SerializedName("region") String region, @SerializedName("service") Service service, @@ -62,21 +62,21 @@ public static Text2VecAwsVectorizer bedrock( return fn.apply(new BedrockBuilder(model)).build(); } - public static Text2VecAwsVectorizer sagemaker(String baseUrl) { - return sagemaker(baseUrl, ObjectBuilder.identity()); + public static Text2VecAwsVectorizer sagemaker(String endpoint) { + return sagemaker(endpoint, ObjectBuilder.identity()); } public static Text2VecAwsVectorizer sagemaker( - String baseUrl, + String endpoint, Function> fn) { - return fn.apply(new SagemakerBuilder(baseUrl)).build(); + return fn.apply(new SagemakerBuilder(endpoint)).build(); } /** * Canonical constructor always sets {@link #vectorizeCollectionName} to false. */ public Text2VecAwsVectorizer( - String baseUrl, + String endpoint, String model, String region, Service service, @@ -85,7 +85,7 @@ public Text2VecAwsVectorizer( List sourceProperties, VectorIndex vectorIndex, Quantization quantization) { - this.baseUrl = baseUrl; + this.endpoint = endpoint; this.model = model; this.region = region; this.service = service; @@ -98,7 +98,7 @@ public Text2VecAwsVectorizer( public Text2VecAwsVectorizer(Builder builder) { this( - builder.baseUrl, + builder.endpoint, builder.model, builder.region, builder.service, @@ -116,7 +116,7 @@ public abstract static class Builder implements ObjectBuilder sourceProperties, VectorIndex vectorIndex, Quantization quantization) { - this.baseUrl = baseUrl; + this.endpoint = endpoint; this.instruction = instruction; this.vectorizeCollectionName = false; @@ -70,7 +70,7 @@ public Text2VecDatabricksVectorizer( public Text2VecDatabricksVectorizer(Builder builder) { this( - builder.baseUrl, + builder.endpoint, builder.instruction, builder.vectorizeCollectionName, @@ -85,11 +85,11 @@ public static class Builder implements ObjectBuilder sourceProperties = new ArrayList<>(); private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; - private String baseUrl; + private String endpoint; private String instruction; - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleVectorizer.java index 2dcb7e875..8103c114f 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleVectorizer.java @@ -13,7 +13,7 @@ import io.weaviate.client6.v1.internal.ObjectBuilder; public record Text2VecGoogleVectorizer( - @SerializedName("apiEndpoint") String baseUrl, + @SerializedName("apiEndpoint") String apiEndpoint, @SerializedName("model") String model, @SerializedName("titleProperty") String titleProperty, @SerializedName("dimensions") Integer dimensions, @@ -85,7 +85,7 @@ public static Text2VecGoogleVectorizer vertex( * Canonical constructor always sets {@link #vectorizeCollectionName} to false. */ public Text2VecGoogleVectorizer( - String baseUrl, + String apiEndpoint, String model, String titleProperty, Integer dimensions, @@ -96,7 +96,7 @@ public Text2VecGoogleVectorizer( List sourceProperties, VectorIndex vectorIndex, Quantization quantization) { - this.baseUrl = baseUrl; + this.apiEndpoint = apiEndpoint; this.model = model; this.titleProperty = titleProperty; this.dimensions = dimensions; @@ -111,7 +111,7 @@ public Text2VecGoogleVectorizer( public Text2VecGoogleVectorizer(Builder builder) { this( - builder.baseUrl, + builder.apiEndpoint, builder.model, builder.titleProperty, builder.dimensions, @@ -131,7 +131,7 @@ public abstract static class Builder implements ObjectBuilder sourceProperties, VectorIndex vectorIndex, Quantization quantization) { - this.baseUrl = baseUrl; + this.endpointUrl = endpointUrl; this.model = model; this.passageModel = passageModel; this.queryModel = queryModel; @@ -85,7 +85,7 @@ public Text2VecHuggingFaceVectorizer( public Text2VecHuggingFaceVectorizer(Builder builder) { this( - builder.baseUrl, + builder.endpointUrl, builder.model, builder.passageModel, builder.queryModel, @@ -104,7 +104,7 @@ public static class Builder implements ObjectBuilder sourceProperties = new ArrayList<>(); private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; - private String baseUrl; + private String endpointUrl; private String model; private String passageModel; private String queryModel; @@ -112,8 +112,8 @@ public static class Builder implements ObjectBuilder sourceProperties, VectorIndex vectorIndex, Quantization quantization) { - this.baseUrl = baseUrl; + this.inferenceUrl = inferenceUrl; this.vectorizeCollectionName = false; this.sourceProperties = sourceProperties; @@ -67,7 +67,7 @@ public Text2VecModel2VecVectorizer( public Text2VecModel2VecVectorizer(Builder builder) { this( - builder.baseUrl, + builder.inferenceUrl, builder.vectorizeCollectionName, builder.sourceProperties, builder.vectorIndex, @@ -80,10 +80,10 @@ public static class Builder implements ObjectBuilder sourceProperties = new ArrayList<>(); private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; - private String baseUrl; + private String inferenceUrl; - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + public Builder inferenceUrl(String inferenceUrl) { + this.inferenceUrl = inferenceUrl; return this; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOllamaVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOllamaVectorizer.java index f2f0a0ad8..64a70875d 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOllamaVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOllamaVectorizer.java @@ -13,7 +13,7 @@ import io.weaviate.client6.v1.internal.ObjectBuilder; public record Text2VecOllamaVectorizer( - @SerializedName("apiEndpoint") String baseUrl, + @SerializedName("apiEndpoint") String apiEndpoint, @SerializedName("model") String model, /** @@ -52,14 +52,14 @@ public static Text2VecOllamaVectorizer of( * Canonical constructor always sets {@link #vectorizeCollectionName} to false. */ public Text2VecOllamaVectorizer( - String baseUrl, + String apiEndpoint, String model, boolean vectorizeCollectionName, List sourceProperties, VectorIndex vectorIndex, Quantization quantization) { - this.baseUrl = baseUrl; + this.apiEndpoint = apiEndpoint; this.model = model; this.vectorizeCollectionName = false; @@ -70,7 +70,7 @@ public Text2VecOllamaVectorizer( public Text2VecOllamaVectorizer(Builder builder) { this( - builder.baseUrl, + builder.apiEndpoint, builder.model, builder.vectorizeCollectionName, @@ -85,11 +85,11 @@ public static class Builder implements ObjectBuilder { private List sourceProperties = new ArrayList<>(); private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; - private String baseUrl; + private String apiEndpoint; private String model; - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + public Builder apiEndpoint(String apiEndpoint) { + this.apiEndpoint = apiEndpoint; return this; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecTransformersVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecTransformersVectorizer.java index e6dcba73e..ce05b956d 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecTransformersVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecTransformersVectorizer.java @@ -13,7 +13,7 @@ import io.weaviate.client6.v1.internal.ObjectBuilder; public record Text2VecTransformersVectorizer( - @SerializedName("inferenceUrl") String baseUrl, + @SerializedName("inferenceUrl") String inferenceUrl, @SerializedName("passageInferenceUrl") String passageInferenceUrl, @SerializedName("queryInferenceUrl") String queryInferenceUrl, @SerializedName("poolingStrategy") PoolingStrategy poolingStrategy, @@ -53,7 +53,7 @@ public static Text2VecTransformersVectorizer of( public Text2VecTransformersVectorizer(Builder builder) { this( - builder.baseUrl, + builder.inferenceUrl, builder.passageInferenceUrl, builder.queryInferenceUrl, builder.poolingStrategy, @@ -67,13 +67,13 @@ public static class Builder implements ObjectBuilder sourceProperties = new ArrayList<>(); private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; - private String baseUrl; + private String inferenceUrl; private String passageInferenceUrl; private String queryInferenceUrl; private PoolingStrategy poolingStrategy; - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; + public Builder inferenceUrl(String inferenceUrl) { + this.inferenceUrl = inferenceUrl; return this; } diff --git a/src/test/java/io/weaviate/client6/v1/api/collections/CollectionHandleTest.java b/src/test/java/io/weaviate/client6/v1/api/collections/CollectionHandleTest.java index c9b186afc..9e6e93a1a 100644 --- a/src/test/java/io/weaviate/client6/v1/api/collections/CollectionHandleTest.java +++ b/src/test/java/io/weaviate/client6/v1/api/collections/CollectionHandleTest.java @@ -152,7 +152,7 @@ public static Object[][] grpcTestCases() { { "data::object exists", (Act) c -> c.data.exists("test-uuid") }, { "data::delete many", (Act) c -> c.data.deleteMany() }, - { "query::get by id", (Act) c -> c.query.byId("test-uuid") }, + { "query::get by id", (Act) c -> c.query.fetchObjectById("test-uuid") }, { "query::fetch objects", (Act) c -> c.query.fetchObjects(ObjectBuilder.identity()) }, { "query::bm25", (Act) c -> c.query.bm25("red ballon") }, { "query::hybrid", (Act) c -> c.query.hybrid("red ballon") }, diff --git a/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java b/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java index 8e3353227..9584585bd 100644 --- a/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java +++ b/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java @@ -93,7 +93,7 @@ public static Object[][] testCases() { { VectorConfig.class, Multi2VecClipVectorizer.of(m2v -> m2v - .baseUrl("http://example.com") + .inferenceUrl("http://example.com") .imageField("img", 1f) .textField("txt", 2f)), """ @@ -977,7 +977,7 @@ public static Object[][] testCases() { "aws-region", "https://example.com", cfg -> cfg - .baseUrl("https://example.com")), + .endpoint("https://example.com")), """ { "generative-aws": { @@ -1090,12 +1090,12 @@ public static Object[][] testCases() { Generative.googleVertex( "google-project", cfg -> cfg - .baseUrl("https://example.com") + .apiEndpoint("https://example.com") .maxTokens(2) .temperature(3f) .topK(4) .topP(5f) - .model("example-model")), + .modelId("example-model")), """ { "generative-palm": { @@ -1113,7 +1113,7 @@ public static Object[][] testCases() { { Generative.class, Generative.ollama(cfg -> cfg - .baseUrl("https://example.com") + .apiEndpoint("https://example.com") .model("example-model")), """ { From 49e71a1c9d8b943336647ebb0f2470ab10ae9f08 Mon Sep 17 00:00:00 2001 From: Ivan Despot <66276597+g-despot@users.noreply.github.com> Date: Wed, 19 Nov 2025 13:28:32 +0100 Subject: [PATCH 2/2] Minor update --- src/it/java/io/weaviate/integration/SearchITest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/it/java/io/weaviate/integration/SearchITest.java b/src/it/java/io/weaviate/integration/SearchITest.java index 0fd68b684..bf31da44f 100644 --- a/src/it/java/io/weaviate/integration/SearchITest.java +++ b/src/it/java/io/weaviate/integration/SearchITest.java @@ -607,12 +607,11 @@ public void testGenerative_bm25() throws IOException { .as("individual results") .hasSize(2) .allSatisfy(obj -> { - Assertions.assertThat(obj.uuid()).as("uuid shorthand").isNotBlank() - .isEqualTo(obj.metadata().uuid()); - Assertions.assertThat(obj.vectors()).as("vectors shorthand").isNotNull() - .isEqualTo(obj.metadata().vectors()); + Assertions.assertThat(obj).as("uuid shorthand") + .returns(obj.uuid(), GenerativeObject::uuid); + Assertions.assertThat(obj).as("vectors shorthand") + .returns(obj.vectors(), GenerativeObject::vectors); }) - // **END SHORTHAND TESTS** .extracting(GenerativeObject::generative) .allSatisfy(generated -> { Assertions.assertThat(generated.text()).isNotBlank();