Class RetrievalQAChain

java.lang.Object
dev.langchain4j.community.chain.RetrievalQAChain
All Implemented Interfaces:
dev.langchain4j.chain.Chain<dev.langchain4j.rag.query.Query,String>

@Experimental public class RetrievalQAChain extends Object implements dev.langchain4j.chain.Chain<dev.langchain4j.rag.query.Query,String>
A conversational chain that interacts with a specified ChatModel, using an initial UserMessage generated by a RetrievalAugmentor.

This chain is typically used in retrieval-augmented generation (RAG) workflows, where relevant context is retrieved and injected into the conversation before invoking the chat model.

Since:
1.1.0-beta7
  • Constructor Details

    • RetrievalQAChain

      public RetrievalQAChain(dev.langchain4j.model.chat.ChatModel chatModel, dev.langchain4j.rag.RetrievalAugmentor retrievalAugmentor)
  • Method Details

    • execute

      public String execute(dev.langchain4j.rag.query.Query query)
      Specified by:
      execute in interface dev.langchain4j.chain.Chain<dev.langchain4j.rag.query.Query,String>
    • builder

      public static RetrievalQAChain.Builder builder()