Class CoherenceEmbeddingStore
java.lang.Object
dev.langchain4j.store.embedding.coherence.CoherenceEmbeddingStore
- All Implemented Interfaces:
EmbeddingStore<TextSegment>
An
EmbeddingStore backed by an Oracle Coherence NamedMap.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder to createCoherenceEmbeddingStoreinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe defaultNamedMapname.protected final com.tangosol.net.NamedMap<com.oracle.coherence.ai.DocumentChunk.Id, com.oracle.coherence.ai.DocumentChunk> TheNamedMapused to store thedocument chunks.protected final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCoherenceEmbeddingStore(com.tangosol.net.NamedMap<com.oracle.coherence.ai.DocumentChunk.Id, com.oracle.coherence.ai.DocumentChunk> namedMap, boolean normalizeEmbeddings) Create anCoherenceEmbeddingStore. -
Method Summary
Modifier and TypeMethodDescriptionadd(Embedding embedding, TextSegment segment) voidvoidAdd multipleEmbeddinginstances to the repository.builder()Return aCoherenceEmbeddingStore.Builderto use to build aCoherenceEmbeddingStore.static CoherenceEmbeddingStorecreate()Create a defaultCoherenceEmbeddingStore.static CoherenceEmbeddingStorecreate(com.tangosol.net.NamedMap<com.oracle.coherence.ai.DocumentChunk.Id, com.oracle.coherence.ai.DocumentChunk> map) Create aCoherenceEmbeddingStorethat uses the specified CoherenceNamedMapname.static CoherenceEmbeddingStoreCreate aCoherenceEmbeddingStorethat uses the specified CoherenceNamedMapname.voidvoidvoidvoidremoveAll(Collection<String> ids) search(EmbeddingSearchRequest request) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmbeddingStore
addAll, generateIds
-
Field Details
-
DEFAULT_MAP_NAME
-
documentChunks
protected final com.tangosol.net.NamedMap<com.oracle.coherence.ai.DocumentChunk.Id, com.oracle.coherence.ai.DocumentChunk> documentChunksTheNamedMapused to store thedocument chunks. -
normalizeEmbeddings
protected final boolean normalizeEmbeddings
-
-
Constructor Details
-
CoherenceEmbeddingStore
protected CoherenceEmbeddingStore(com.tangosol.net.NamedMap<com.oracle.coherence.ai.DocumentChunk.Id, com.oracle.coherence.ai.DocumentChunk> namedMap, boolean normalizeEmbeddings) Create anCoherenceEmbeddingStore.This method is protected, instances of
CoherenceEmbeddingStoreare created using the builder.- Parameters:
namedMap- theNamedMapto contain thedocument chunksnormalizeEmbeddings-trueif thisCoherenceEmbeddingStoreshould callEmbedding.normalize()on embeddings when adding or searching
-
-
Method Details
-
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
addAll
- Specified by:
addAllin interfaceEmbeddingStore<TextSegment>
-
remove
- Specified by:
removein interfaceEmbeddingStore<TextSegment>
-
removeAll
- Specified by:
removeAllin interfaceEmbeddingStore<TextSegment>
-
removeAll
- Specified by:
removeAllin interfaceEmbeddingStore<TextSegment>
-
removeAll
public void removeAll()- Specified by:
removeAllin interfaceEmbeddingStore<TextSegment>
-
search
- Specified by:
searchin interfaceEmbeddingStore<TextSegment>
-
addAll
Add multipleEmbeddinginstances to the repository.- Specified by:
addAllin interfaceEmbeddingStore<TextSegment>- Parameters:
ids- the list of identifiers to use for each of theEmbeddingembeddings- theEmbeddingto addsegments- an optional list ofTextSegmentto add with the embeddings
-
create
Create a defaultCoherenceEmbeddingStore.- Returns:
- a default
CoherenceEmbeddingStore
-
create
Create aCoherenceEmbeddingStorethat uses the specified CoherenceNamedMapname.- Parameters:
name- the name of the CoherenceNamedMapused to store documents- Returns:
- a
CoherenceEmbeddingStore
-
create
public static CoherenceEmbeddingStore create(com.tangosol.net.NamedMap<com.oracle.coherence.ai.DocumentChunk.Id, com.oracle.coherence.ai.DocumentChunk> map) Create aCoherenceEmbeddingStorethat uses the specified CoherenceNamedMapname.- Parameters:
map- theNamedMapused to store documents- Returns:
- a
CoherenceEmbeddingStore
-
builder
Return aCoherenceEmbeddingStore.Builderto use to build aCoherenceEmbeddingStore.- Returns:
- a
CoherenceEmbeddingStore.Builderto use to build aCoherenceEmbeddingStore
-