Skip to content

Commit

Permalink
Increase default chunks to 100 and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
clun committed Jun 23, 2024
1 parent 624fcbb commit 5af665b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public AstraDBEmbeddingStore(@NonNull Collection<Document> client) {
* concurrent threads
*/
public AstraDBEmbeddingStore(@NonNull Collection<Document> client, int itemsPerChunk, int concurrentThreads) {
if (itemsPerChunk>20 || itemsPerChunk<1) {
if (itemsPerChunk>100 || itemsPerChunk<1) {
throw new IllegalArgumentException("'itemsPerChunk' should be in between 1 and 20");
}
if (concurrentThreads<1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,30 @@
import dev.langchain4j.store.embedding.EmbeddingSearchRequest;
import dev.langchain4j.store.embedding.filter.Filter;


/**
* This abstract class represents a search request for embeddings in AstraDB
* A user can provide a field 'vectorize' that will be converted as a embedding on the spot and use for search or insertion
*/
public class EmbeddingSearchRequestAstra extends EmbeddingSearchRequest {

/**
* The field to vectorize
*/
private final String vectorize;

/**
* Constructor leveraging default search request but with the vectorize options.
* @param queryEmbedding
* vector or left empty to use the vectorize field
* @param vectorize
* field to vectorize
* @param maxResults
* maximum number of results to return
* @param minScore
* minimum score to return
* @param filter
* filter to apply
*/
public EmbeddingSearchRequestAstra(Embedding queryEmbedding, String vectorize, Integer maxResults, Double minScore, Filter filter) {
super(queryEmbedding != null ? queryEmbedding : Embedding.from(new float[0]), maxResults, minScore, filter);
this.vectorize = vectorize;
Expand Down

0 comments on commit 5af665b

Please sign in to comment.