package org.acme;

import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.model.embedding.EmbeddingModel;
import dev.langchain4j.rag.DefaultRetrievalAugmentor;
import dev.langchain4j.rag.RetrievalAugmentor;
import dev.langchain4j.rag.content.retriever.EmbeddingStoreContentRetriever;
import dev.langchain4j.store.embedding.EmbeddingStore;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;

import java.util.function.Supplier;

@Singleton
public class RetrievalAugmentorExample implements Supplier<RetrievalAugmentor> {

    @Inject
    EmbeddingModel embeddingModel;

    @Inject
    EmbeddingStore<TextSegment> embeddingStore;

    @Override
    public RetrievalAugmentor get() {
        return DefaultRetrievalAugmentor.builder()
                .contentRetriever(EmbeddingStoreContentRetriever.builder()
                        .embeddingModel(embeddingModel)
                        .embeddingStore(embeddingStore)
                        .build())
                .build();
    }
}

dev.langchain4j.rag.DefaultRetrievalAugmentor.builder dev.langchain4j.rag.content.retriever.EmbeddingStoreContentRetriever.builder
[((726, 1007), 'dev.langchain4j.rag.DefaultRetrievalAugmentor.builder'), ((726, 982), 'dev.langchain4j.rag.DefaultRetrievalAugmentor.builder'), ((796, 981), 'dev.langchain4j.rag.content.retriever.EmbeddingStoreContentRetriever.builder'), ((796, 948), 'dev.langchain4j.rag.content.retriever.EmbeddingStoreContentRetriever.builder'), ((796, 892), 'dev.langchain4j.rag.content.retriever.EmbeddingStoreContentRetriever.builder')]