Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a16a0a3
feat: implement generative query with bm25 filter
bevzzz Oct 9, 2025
7f61a62
feat: add generative w/ fetchObjects
bevzzz Oct 21, 2025
c6d0865
feat: add generative w/ hybrid query
bevzzz Oct 21, 2025
9707ddf
feat: add generative w/ nearVector query
bevzzz Oct 21, 2025
82111dd
feat: add generative w/ nearObject query
bevzzz Oct 21, 2025
e9bb5c5
feat: add generative w/ nearText query
bevzzz Oct 21, 2025
c7219b8
feat: add generative w/ nearImage + nearAudio queries
bevzzz Oct 21, 2025
dde9e11
feat: add generative w/ nearVideo/Thermal/Depth/Imu queries
bevzzz Oct 21, 2025
f8f7bdf
feat: add configurations for generative modules:
bevzzz Oct 21, 2025
d59a7c2
feat: add generative modules
bevzzz Oct 21, 2025
15724ba
test: update test code
bevzzz Oct 21, 2025
c8b0770
fix: rename google's 'kind' to 'palm'
bevzzz Oct 21, 2025
bd2deb7
feat: read provider metadata from generative response
bevzzz Oct 21, 2025
5a05ea0
chore: paraphrase generative javadoc
bevzzz Oct 21, 2025
a237799
feat: provide static factories for generative providers
bevzzz Oct 21, 2025
30744ec
chore: delete redundant import
bevzzz Oct 22, 2025
aee94ba
feat: add methods to cast Generative to specific classes
bevzzz Oct 22, 2025
f18ddf2
test: add JSON tests for Generative.CustomTypeAdapterFactory
bevzzz Oct 22, 2025
478b7a6
feat(rag): add dynamic providers for Anthropic/Anyscale/Aws/Cohere
bevzzz Oct 22, 2025
3131daf
feat: add move dynamic generative providers
bevzzz Oct 22, 2025
4f0bf5e
chore: remove Azure-related config from OpenAI
bevzzz Oct 22, 2025
af31af4
feat: add dynamic provider static factories
bevzzz Oct 22, 2025
f26b55d
feat: extend generative functionality to async client
bevzzz Oct 22, 2025
fe07d37
chore: rename generativeProvider -> dynamicProvider
bevzzz Oct 22, 2025
e66e304
chore: remove redundant method from ProviderMetadata interface
bevzzz Oct 22, 2025
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
98 changes: 98 additions & 0 deletions src/it/java/io/weaviate/integration/SearchITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import io.weaviate.client6.v1.api.collections.WeaviateMetadata;
import io.weaviate.client6.v1.api.collections.WeaviateObject;
import io.weaviate.client6.v1.api.collections.data.Reference;
import io.weaviate.client6.v1.api.collections.generate.GenerativeObject;
import io.weaviate.client6.v1.api.collections.generate.TaskOutput;
import io.weaviate.client6.v1.api.collections.generative.DummyGenerative;
import io.weaviate.client6.v1.api.collections.query.GroupBy;
import io.weaviate.client6.v1.api.collections.query.Metadata;
import io.weaviate.client6.v1.api.collections.query.QueryMetadata;
Expand All @@ -47,6 +50,7 @@ public class SearchITest extends ConcurrentTest {
Weaviate.custom()
.withContextionaryUrl(Contextionary.URL)
.withImageInference(Img2VecNeural.URL, Img2VecNeural.MODULE)
.addModules("generative-dummy")
.build(),
Container.IMG2VEC_NEURAL,
Container.CONTEXTIONARY);
Expand Down Expand Up @@ -549,4 +553,98 @@ public void testNearVector_targetVectors() throws IOException {
.hasSize(1).extracting(WeaviateObject::uuid)
.containsExactly(thing456.uuids().get(0));
}

@Test
public void testGenerative_bm25() throws IOException {
// Arrange
var nsThings = ns("Things");

client.collections.create(nsThings,
c -> c
.properties(Property.text("title"))
.generativeModule(new DummyGenerative())
.vectorConfig(VectorConfig.text2vecContextionary(
t2v -> t2v.sourceProperties("title"))));

var things = client.collections.use(nsThings);

things.data.insertMany(
Map.of("title", "Salad Fork"),
Map.of("title", "Dessert Fork"));

// Act
var french = things.generate.bm25(
"fork",
bm25 -> bm25.queryProperties("title").limit(2),
generate -> generate
.singlePrompt("translate to French")
.groupedTask("count letters R"));

// Assert
Assertions.assertThat(french.objects())
.as("individual results")
.hasSize(2)
.extracting(GenerativeObject::generated)
.allSatisfy(generated -> {
Assertions.assertThat(generated.text()).isNotBlank();
});

Assertions.assertThat(french.generated())
.as("summary")
.extracting(TaskOutput::text, InstanceOfAssertFactories.STRING)
.isNotBlank();
}

@Test
public void testGenerative_bm25_groupBy() throws IOException {
// Arrange
var nsThings = ns("Things");

client.collections.create(nsThings,
c -> c
.properties(Property.text("title"))
.generativeModule(new DummyGenerative())
.vectorConfig(VectorConfig.text2vecContextionary(
t2v -> t2v.sourceProperties("title"))));

var things = client.collections.use(nsThings);

things.data.insertMany(
Map.of("title", "Salad Fork"),
Map.of("title", "Dessert Fork"));

// Act
var french = things.generate.bm25(
"fork",
bm25 -> bm25.queryProperties("title").limit(2),
generate -> generate
.singlePrompt("translate to French")
.groupedTask("count letters R"),
GroupBy.property("title", 5, 5));

// Assert
Assertions.assertThat(french.objects())
.as("individual results")
.hasSize(2);

Assertions.assertThat(french.groups())
.as("grouped results")
.hasSize(2)
.allSatisfy((groupName, group) -> {
Assertions.assertThat(group.objects())
.describedAs("objects in group %s", groupName)
.hasSize(1);

Assertions.assertThat(group.generated())
.describedAs("summary group %s", groupName)
.extracting(TaskOutput::text, InstanceOfAssertFactories.STRING)
.isNotBlank();

});

Assertions.assertThat(french.generated())
.as("summary")
.extracting(TaskOutput::text, InstanceOfAssertFactories.STRING)
.isNotBlank();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.weaviate.client6.v1.api.collections.aggregate.WeaviateAggregateClient;
import io.weaviate.client6.v1.api.collections.config.WeaviateConfigClient;
import io.weaviate.client6.v1.api.collections.data.WeaviateDataClient;
import io.weaviate.client6.v1.api.collections.generate.WeaviateGenerateClient;
import io.weaviate.client6.v1.api.collections.pagination.Paginator;
import io.weaviate.client6.v1.api.collections.query.ConsistencyLevel;
import io.weaviate.client6.v1.api.collections.query.WeaviateQueryClient;
Expand All @@ -20,6 +21,7 @@ public class CollectionHandle<PropertiesT> {
public final WeaviateDataClient<PropertiesT> data;
public final WeaviateQueryClient<PropertiesT> query;
public final WeaviateAggregateClient aggregate;
public final WeaviateGenerateClient<PropertiesT> generate;
public final WeaviateTenantsClient tenants;

private final CollectionHandleDefaults defaults;
Expand All @@ -32,6 +34,7 @@ public CollectionHandle(
this.config = new WeaviateConfigClient(collection, restTransport, grpcTransport, defaults);
this.aggregate = new WeaviateAggregateClient(collection, grpcTransport, defaults);
this.query = new WeaviateQueryClient<>(collection, grpcTransport, defaults);
this.generate = new WeaviateGenerateClient<>(collection, grpcTransport, defaults);
this.data = new WeaviateDataClient<>(collection, restTransport, grpcTransport, defaults);
this.defaults = defaults;

Expand All @@ -43,6 +46,7 @@ private CollectionHandle(CollectionHandle<PropertiesT> c, CollectionHandleDefaul
this.config = new WeaviateConfigClient(c.config, defaults);
this.aggregate = new WeaviateAggregateClient(c.aggregate, defaults);
this.query = new WeaviateQueryClient<>(c.query, defaults);
this.generate = new WeaviateGenerateClient<>(c.generate, defaults);
this.data = new WeaviateDataClient<>(c.data, defaults);
this.defaults = defaults;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.weaviate.client6.v1.api.collections.aggregate.WeaviateAggregateClientAsync;
import io.weaviate.client6.v1.api.collections.config.WeaviateConfigClientAsync;
import io.weaviate.client6.v1.api.collections.data.WeaviateDataClientAsync;
import io.weaviate.client6.v1.api.collections.generate.WeaviateGenerateClientAsync;
import io.weaviate.client6.v1.api.collections.pagination.AsyncPaginator;
import io.weaviate.client6.v1.api.collections.query.ConsistencyLevel;
import io.weaviate.client6.v1.api.collections.query.WeaviateQueryClientAsync;
Expand All @@ -21,6 +22,7 @@ public class CollectionHandleAsync<PropertiesT> {
public final WeaviateConfigClientAsync config;
public final WeaviateDataClientAsync<PropertiesT> data;
public final WeaviateQueryClientAsync<PropertiesT> query;
public final WeaviateGenerateClientAsync<PropertiesT> generate;
public final WeaviateAggregateClientAsync aggregate;
public final WeaviateTenantsClientAsync tenants;

Expand All @@ -35,6 +37,7 @@ public CollectionHandleAsync(
this.config = new WeaviateConfigClientAsync(collection, restTransport, grpcTransport, defaults);
this.aggregate = new WeaviateAggregateClientAsync(collection, grpcTransport, defaults);
this.query = new WeaviateQueryClientAsync<>(collection, grpcTransport, defaults);
this.generate = new WeaviateGenerateClientAsync<>(collection, grpcTransport, defaults);
this.data = new WeaviateDataClientAsync<>(collection, restTransport, grpcTransport, defaults);
this.defaults = defaults;

Expand All @@ -46,6 +49,7 @@ private CollectionHandleAsync(CollectionHandleAsync<PropertiesT> c, CollectionHa
this.config = new WeaviateConfigClientAsync(c.config, defaults);
this.aggregate = new WeaviateAggregateClientAsync(c.aggregate, defaults);
this.query = new WeaviateQueryClientAsync<>(c.query, defaults);
this.generate = new WeaviateGenerateClientAsync<>(c.generate, defaults);
this.data = new WeaviateDataClientAsync<>(c.data, defaults);
this.defaults = defaults;

Expand Down
Loading