Class AstraDbEmbeddingStore
java.lang.Object
dev.langchain4j.store.embedding.astradb.AstraDbEmbeddingStore
- All Implemented Interfaces:
EmbeddingStore<TextSegment>
Implementation of
EmbeddingStore using AstraDB.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAstraDbEmbeddingStore(@NonNull com.dtsx.astra.sdk.AstraDBCollection client) Initialization of the store with an EXISTING collection.AstraDbEmbeddingStore(@NonNull com.dtsx.astra.sdk.AstraDBCollection client, int itemsPerChunk, int concurrentThreads) Initialization of the store with an EXISTING collection. -
Method Summary
Modifier and TypeMethodDescriptionadd(Embedding embedding, TextSegment textSegment) voidaddAll(List<Embedding> embeddingList, List<TextSegment> textSegmentList) Add multiple embeddings as a single action.voidclear()Delete all records from the table.findRelevant(Embedding referenceEmbedding, int maxResults, double minScore) findRelevant(Embedding referenceEmbedding, io.stargate.sdk.data.domain.query.Filter metaDatafilter, int maxResults, double minScore) Semantic search with metadata filtering.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.store.embedding.EmbeddingStore
findRelevant, findRelevant, findRelevant
-
Field Details
-
KEY_ATTRIBUTES_BLOB
Saving the text chunk as an attribut.- See Also:
-
KEY_SIMILARITY
Metadata used for similarity.- See Also:
-
-
Constructor Details
-
AstraDbEmbeddingStore
public AstraDbEmbeddingStore(@NonNull @NonNull com.dtsx.astra.sdk.AstraDBCollection client) Initialization of the store with an EXISTING collection.- Parameters:
client- astra db collection client
-
AstraDbEmbeddingStore
public AstraDbEmbeddingStore(@NonNull @NonNull com.dtsx.astra.sdk.AstraDBCollection client, int itemsPerChunk, int concurrentThreads) Initialization of the store with an EXISTING collection.- Parameters:
client- astra db collection clientitemsPerChunk- size of 1 chunk in between 1 and 20
-
-
Method Details
-
clear
public void clear()Delete all records from the table. -
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
addAll
- Specified by:
addAllin interfaceEmbeddingStore<TextSegment>
-
addAll
Add multiple embeddings as a single action.- Specified by:
addAllin interfaceEmbeddingStore<TextSegment>- Parameters:
embeddingList- list of embeddingstextSegmentList- list of text segment- Returns:
- list of new row if (same order as the input)
-
findRelevant
public List<EmbeddingMatch<TextSegment>> findRelevant(Embedding referenceEmbedding, int maxResults, double minScore) - Specified by:
findRelevantin interfaceEmbeddingStore<TextSegment>
-
findRelevant
public List<EmbeddingMatch<TextSegment>> findRelevant(Embedding referenceEmbedding, io.stargate.sdk.data.domain.query.Filter metaDatafilter, int maxResults, double minScore) Semantic search with metadata filtering.- Parameters:
referenceEmbedding- vectormetaDatafilter- fileter for metadatamaxResults- limitminScore- threshold- Returns:
- records
-