Class InMemoryEmbeddingStore<Embedded>

java.lang.Object
dev.langchain4j.store.embedding.inmemory.InMemoryEmbeddingStore<Embedded>
Type Parameters:
Embedded - The class of the object that has been embedded. Typically, it is TextSegment.
All Implemented Interfaces:
EmbeddingStore<Embedded>

public class InMemoryEmbeddingStore<Embedded> extends Object implements EmbeddingStore<Embedded>
An EmbeddingStore that stores embeddings in memory.

Uses a brute force approach by iterating over all embeddings to find the best matches.

This store can be persisted using the serializeToJson() and serializeToFile(Path) methods.

It can also be recreated from JSON or a file using the fromJson(String) and fromFile(Path) methods.