Class LanguageModelQueryRouter

  • All Implemented Interfaces:
    dev.langchain4j.rag.query.router.QueryRouter

    
    public class LanguageModelQueryRouter
     implements QueryRouter
                        

    A QueryRouter that utilizes a ChatLanguageModel to make a routing decision. Each ContentRetriever provided in the constructor should be accompanied by a description which should help the LLM to decide where to route a Query. Refer to DEFAULT_PROMPT_TEMPLATE and implementation for more details. Configurable parameters (optional): - promptTemplate: The prompt template used to ask the LLM for routing decisions. - fallbackStrategy: The strategy applied if the call to the LLM fails of if LLM does not return a valid response. Please check FallbackStrategy for more details. Default value: DO_NOT_ROUTE