Class EmbeddingStoreContentRetriever
-
- All Implemented Interfaces:
-
dev.langchain4j.rag.content.retriever.ContentRetriever
public class EmbeddingStoreContentRetriever implements ContentRetriever
A ContentRetriever that retrieves from an EmbeddingStore. By default, it retrieves the 3 most similar Contents to the provided Query, without any Filtering. Configurable parameters (optional): -
displayName: Display name for logging purposes, e.g. when multiple instances are used. -maxResults: The maximum number of Contents to retrieve. -dynamicMaxResults: It is a Function that accepts a Query and returns amaxResultsvalue. It can be used to dynamically definemaxResultsvalue, depending on factors such as the query, the user (using Metadata#chatMemoryId()} from metadata), etc. -minScore: The minimum relevance score for the returned Contents. Contents scoring below#minScoreare excluded from the results. -dynamicMinScore: It is a Function that accepts a Query and returns aminScorevalue. It can be used to dynamically defineminScorevalue, depending on factors such as the query, the user (using Metadata#chatMemoryId()} from metadata), etc. -filter: The Filter that will be applied to a dev.langchain4j.data.document.Metadata in the textSegment. -dynamicFilter: It is a Function that accepts a Query and returns afiltervalue. It can be used to dynamically definefiltervalue, depending on factors such as the query, the user (using Metadata#chatMemoryId()} from metadata), etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classEmbeddingStoreContentRetriever.EmbeddingStoreContentRetrieverBuilder
-
Field Summary
Fields Modifier and Type Field Description public final static Function<Query, Integer>DEFAULT_MAX_RESULTSpublic final static Function<Query, Double>DEFAULT_MIN_SCOREpublic final static Function<Query, Filter>DEFAULT_FILTERpublic final static StringDEFAULT_DISPLAY_NAME
-
Constructor Summary
Constructors Constructor Description EmbeddingStoreContentRetriever(EmbeddingStore<TextSegment> embeddingStore, EmbeddingModel embeddingModel)EmbeddingStoreContentRetriever(EmbeddingStore<TextSegment> embeddingStore, EmbeddingModel embeddingModel, int maxResults)EmbeddingStoreContentRetriever(EmbeddingStore<TextSegment> embeddingStore, EmbeddingModel embeddingModel, Integer maxResults, Double minScore)
-
Method Summary
Modifier and Type Method Description static EmbeddingStoreContentRetriever.EmbeddingStoreContentRetrieverBuilderbuilder()static EmbeddingStoreContentRetrieverfrom(EmbeddingStore<TextSegment> embeddingStore)Creates an instance of an EmbeddingStoreContentRetrieverfrom the specified EmbeddingStore and EmbeddingModel found through SPI (see EmbeddingModelFactory).List<Content>retrieve(Query query)Retrieves relevant Contents using a given Query. StringtoString()-
-
Constructor Detail
-
EmbeddingStoreContentRetriever
EmbeddingStoreContentRetriever(EmbeddingStore<TextSegment> embeddingStore, EmbeddingModel embeddingModel)
-
EmbeddingStoreContentRetriever
EmbeddingStoreContentRetriever(EmbeddingStore<TextSegment> embeddingStore, EmbeddingModel embeddingModel, int maxResults)
-
EmbeddingStoreContentRetriever
EmbeddingStoreContentRetriever(EmbeddingStore<TextSegment> embeddingStore, EmbeddingModel embeddingModel, Integer maxResults, Double minScore)
-
-
Method Detail
-
from
static EmbeddingStoreContentRetriever from(EmbeddingStore<TextSegment> embeddingStore)
Creates an instance of an
EmbeddingStoreContentRetrieverfrom the specified EmbeddingStore and EmbeddingModel found through SPI (see EmbeddingModelFactory).
-
-
-
-