Package dev.langchain4j.rag.query.router
Interface QueryRouter
-
- All Implemented Interfaces:
public interface QueryRouter
Routes the given Query to one or multiple ContentRetrievers. The goal is to ensure that Content is retrieved only from relevant data sources. Some potential approaches include:
- Using an LLM (see LanguageModelQueryRouter) - Using an EmbeddingModel (aka "semantic routing", see
in theEmbeddingModelTextClassifier
module) - Using keyword-based routing - Route depending on the user (langchain4j
) and/or permissionsquery.metadata().chatMemoryId()
-
-
Method Summary
Modifier and Type Method Description abstract Collection<ContentRetriever>
route(Query query)
Routes the given Query to one or multiple ContentRetrievers. -
-
Method Detail
-
route
abstract Collection<ContentRetriever> route(Query query)
Routes the given Query to one or multiple ContentRetrievers.
- Parameters:
query
- The Query to be routed.- Returns:
A collection of one or more ContentRetrievers to which the Query should be routed.
-
-
-
-