Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.x #9

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 1 addition & 1 deletion astra-db-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.datastax.astra</groupId>
<artifactId>astra-db-java-parent</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.3-SNAPSHOT</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public static DataAPIClient createForLocal() {
new UsernamePasswordTokenProvider().getToken(),
DataAPIOptions.builder()
.withDestination(DataAPIOptions.DataAPIDestination.CASSANDRA)
.logRequests()
.withObserver(new LoggingCommandObserver(DataAPIClient.class))
.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public ApiResponse runCommand(Command command, CommandOptions<?> overridingOptio
throw new DataApiResponseException(Collections.singletonList(executionInfo.build()));
}
// Trace All Warning
if (jsonRes.getStatus().containsKey("warnings")) {
if (jsonRes.getStatus()!= null && jsonRes.getStatus().containsKey("warnings")) {
jsonRes.getStatusKeyAsStringStream("warnings").forEach(log::warn);
}
return jsonRes;
Expand Down
5 changes: 3 additions & 2 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>astra-db-java-examples</artifactId>
<version>1.5.0</version>
<name>Data API Client Samples</name>

<parent>
<groupId>com.datastax.astra</groupId>
<artifactId>astra-db-java-parent</artifactId>
<version>1.5.0</version>
<version>1.5.3-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>com.datastax.astra</groupId>
<artifactId>astra-db-java</artifactId>
<version>${project.version}</version>
<version>1.5.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down
4 changes: 2 additions & 2 deletions langchain4j-astradb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<parent>
<groupId>com.datastax.astra</groupId>
<artifactId>astra-db-java-parent</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.3-SNAPSHOT</version>
</parent>

<properties>
<langchain4j.version>0.34.0</langchain4j.version>
<langchain4j.version>0.35.0</langchain4j.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import dev.langchain4j.data.embedding.Embedding;
import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.store.embedding.EmbeddingMatch;
import dev.langchain4j.store.embedding.EmbeddingSearchRequest;
import dev.langchain4j.store.embedding.EmbeddingSearchResult;
import dev.langchain4j.store.embedding.EmbeddingStore;
import lombok.Getter;
Expand Down Expand Up @@ -215,6 +216,18 @@ public List<EmbeddingMatch<TextSegment>> findRelevant(Embedding referenceEmbeddi
return findRelevant(referenceEmbedding, (Filter) null, maxResults, minScore);
}

public EmbeddingSearchResult<TextSegment> search(EmbeddingSearchRequest request) {
dev.langchain4j.store.embedding.filter.Filter lc4jFilter = request.filter();
if (lc4jFilter != null) {
// Map Filter
Filter astraFilter = AstraDbFilterMapper.map(lc4jFilter);
List<EmbeddingMatch<TextSegment>> matches = this.findRelevant(request.queryEmbedding(), astraFilter, request.maxResults(), request.minScore());
return new EmbeddingSearchResult(matches);
}
List<EmbeddingMatch<TextSegment>> matches2 = this.findRelevant(request.queryEmbedding(), request.maxResults(), request.minScore());
return new EmbeddingSearchResult(matches2);
}

/**
* Implementation of the Search to add the metadata Filtering.
*
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.datastax.astra</groupId>
<artifactId>astra-db-java-parent</artifactId>
<name>Data API Client</name>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.3-SNAPSHOT</version>
<packaging>pom</packaging>
<url>https://github.com/datastax/astra-db-java</url>
<inceptionYear>2024</inceptionYear>
Expand Down
5 changes: 3 additions & 2 deletions tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>astra-db-java-tools</artifactId>
<version>1.5.0</version>
<name>Data API Client Tools</name>

<parent>
<groupId>com.datastax.astra</groupId>
<artifactId>astra-db-java-parent</artifactId>
<version>1.5.0</version>
<version>1.5.3-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>com.datastax.astra</groupId>
<artifactId>astra-db-java</artifactId>
<version>${project.version}</version>
<version>1.5.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down
Loading