Package dev.langchain4j.rag.query.router
Interface QueryRouter
- All Known Implementing Classes:
DefaultQueryRouter
,LanguageModelQueryRouter
public interface QueryRouter
Routes the given
The goal is to ensure that
Some potential approaches include:
Query
to one or multiple ContentRetriever
s.
The goal is to ensure that
Content
is retrieved only from relevant data sources.
Some potential approaches include:
- Using an LLM (seeLanguageModelQueryRouter
) - Using anEmbeddingModel
(aka "semantic routing", seeEmbeddingModelTextClassifier
in thelangchain4j
module) - Using keyword-based routing - Route depending on the user (query.metadata().chatMemoryId()
) and/or permissions
- See Also:
-
Method Summary
-
Method Details
-
route
Routes the givenQuery
to one or multipleContentRetriever
s.- Parameters:
query
- TheQuery
to be routed.- Returns:
- A collection of one or more
ContentRetriever
s to which theQuery
should be routed.
-