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) voidvoidcom.dtsx.astra.sdk.AstraDBCollectionvoidclear()Delete all records from the table.intfindRelevant(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.intsearch(EmbeddingSearchRequest request) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmbeddingStore
addAll, generateIds, remove, removeAll, removeAll, removeAll
-
Field Details
-
KEY_ATTRIBUTES_BLOB
-
KEY_SIMILARITY
-
-
Constructor Details
-
AstraDbEmbeddingStore
public AstraDbEmbeddingStore(@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 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
public void addAll(List<String> ids, List<Embedding> embeddingList, List<TextSegment> textSegmentList) - Specified by:
addAllin interfaceEmbeddingStore<TextSegment>
-
search
- Specified by:
searchin interfaceEmbeddingStore<TextSegment>
-
findRelevant
public List<EmbeddingMatch<TextSegment>> findRelevant(Embedding referenceEmbedding, int maxResults, double minScore) -
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
-
astraDBCollection
public com.dtsx.astra.sdk.AstraDBCollection astraDBCollection() -
itemsPerChunk
public int itemsPerChunk() -
concurrentThreads
public int concurrentThreads()
-