类 LanguageModelQueryRouter
java.lang.Object
dev.langchain4j.rag.query.router.LanguageModelQueryRouter
- 所有已实现的接口:
QueryRouter
A
Each
Refer to
Configurable parameters (optional):
-
-
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 LanguageModelQueryRouter.FallbackStrategy for more details. Default value: LanguageModelQueryRouter.FallbackStrategy.DO_NOT_ROUTE- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明static enumStrategy applied if the call to the LLM fails of if LLM does not return a valid response. -
字段概要
字段修饰符和类型字段说明protected final ChatLanguageModelstatic final PromptTemplateprotected final LanguageModelQueryRouter.FallbackStrategyprotected final Map<Integer,ContentRetriever> protected final Stringprotected final PromptTemplate -
构造器概要
构造器构造器说明LanguageModelQueryRouter(ChatLanguageModel chatLanguageModel, Map<ContentRetriever, String> retrieverToDescription) LanguageModelQueryRouter(ChatLanguageModel chatLanguageModel, Map<ContentRetriever, String> retrieverToDescription, PromptTemplate promptTemplate, LanguageModelQueryRouter.FallbackStrategy fallbackStrategy) -
方法概要
修饰符和类型方法说明protected PromptcreatePrompt(Query query) protected Collection<ContentRetriever>protected Collection<ContentRetriever>Routes the givenQueryto one or multipleContentRetrievers.
-
字段详细资料
-
DEFAULT_PROMPT_TEMPLATE
-
chatLanguageModel
-
promptTemplate
-
options
-
idToRetriever
-
fallbackStrategy
-
-
构造器详细资料
-
LanguageModelQueryRouter
public LanguageModelQueryRouter(ChatLanguageModel chatLanguageModel, Map<ContentRetriever, String> retrieverToDescription) -
LanguageModelQueryRouter
public LanguageModelQueryRouter(ChatLanguageModel chatLanguageModel, Map<ContentRetriever, String> retrieverToDescription, PromptTemplate promptTemplate, LanguageModelQueryRouter.FallbackStrategy fallbackStrategy)
-
-
方法详细资料
-
route
从接口复制的说明:QueryRouterRoutes the givenQueryto one or multipleContentRetrievers.- 指定者:
route在接口中QueryRouter- 参数:
query- TheQueryto be routed.- 返回:
- A collection of one or more
ContentRetrievers to which theQueryshould be routed.
-
fallback
-
createPrompt
-
parse
-