Class ConversationalRetrievalChain

java.lang.Object
dev.langchain4j.chain.ConversationalRetrievalChain
All Implemented Interfaces:
Chain<String,String>

public class ConversationalRetrievalChain extends Object implements Chain<String,String>
A chain for conversing with a specified ChatModel based on the information retrieved by a specified ContentRetriever. Includes a default ChatMemory (a message window with maximum 10 messages), which can be overridden. You can fully customize RAG behavior by providing an instance of a RetrievalAugmentor, such as DefaultRetrievalAugmentor, or your own custom implementation.
Chains are not going to be developed further, it is recommended to use AiServices instead.
  • Constructor Details

    • ConversationalRetrievalChain

      public ConversationalRetrievalChain(dev.langchain4j.model.chat.ChatModel chatModel, dev.langchain4j.memory.ChatMemory chatMemory, dev.langchain4j.rag.content.retriever.ContentRetriever contentRetriever)
    • ConversationalRetrievalChain

      public ConversationalRetrievalChain(dev.langchain4j.model.chat.ChatModel chatModel, dev.langchain4j.memory.ChatMemory chatMemory, dev.langchain4j.rag.RetrievalAugmentor retrievalAugmentor)
  • Method Details