Class: RouterQueryEngine
A query engine that uses multiple query engines and selects the best one.
Extends
Constructors
new RouterQueryEngine()
new RouterQueryEngine(
init
):RouterQueryEngine
Parameters
• init
• init.queryEngineTools: RouterQueryEngineTool
[]
• init.selector: BaseSelector
• init.serviceContext?: ServiceContext
• init.summarizer?: BaseSynthesizer
• init.verbose?: boolean
Returns
Overrides
Defined in
packages/llamaindex/src/engines/query/RouterQueryEngine.ts:60
Methods
_getPromptModules()
protected
_getPromptModules():object
Return a dictionary of sub-modules within the current module that also implement PromptMixin (so that their prompts can also be get/set).
Can be blank if no sub-modules.
Returns
object
selector
selector:
BaseSelector
summarizer
summarizer:
BaseSynthesizer
Overrides
BaseQueryEngine
._getPromptModules
Defined in
packages/llamaindex/src/engines/query/RouterQueryEngine.ts:99
_getPrompts()
protected
_getPrompts():object
Returns
object
Overrides
Defined in
packages/llamaindex/src/engines/query/RouterQueryEngine.ts:93
_query()
_query(
strOrQueryBundle
,stream
?):Promise
<EngineResponse
>
Parameters
• strOrQueryBundle: QueryType
• stream?: boolean
Returns
Promise
<EngineResponse
>
Overrides
Defined in
packages/llamaindex/src/engines/query/RouterQueryEngine.ts:79
_updatePrompts()
protected
_updatePrompts():void
Returns
void
Overrides
BaseQueryEngine
._updatePrompts
Defined in
packages/llamaindex/src/engines/query/RouterQueryEngine.ts:97
getPrompts()
getPrompts():
PromptsRecord
Returns
Inherited from
Defined in
packages/core/prompts/dist/index.d.ts:66
query()
query(params)
query(
params
):Promise
<AsyncIterable
<EngineResponse
,any
,any
>>
Parameters
• params: StreamingQueryParams
Returns
Promise
<AsyncIterable
<EngineResponse
, any
, any
>>
Inherited from
Defined in
packages/core/query-engine/dist/index.d.ts:32
query(params)
query(
params
):Promise
<EngineResponse
>
Parameters
• params: NonStreamingQueryParams
Returns
Promise
<EngineResponse
>
Inherited from
Defined in
packages/core/query-engine/dist/index.d.ts:33
retrieve()
retrieve(
params
):Promise
<NodeWithScore
<Metadata
>[]>
Parameters
• params: QueryType
Returns
Promise
<NodeWithScore
<Metadata
>[]>
Inherited from
Defined in
packages/core/query-engine/dist/index.d.ts:31
updatePrompts()
updatePrompts(
prompts
):void
Parameters
• prompts: PromptsRecord
Returns
void
Inherited from
Defined in
packages/core/prompts/dist/index.d.ts:67
validatePrompts()
validatePrompts(
promptsDict
,moduleDict
):void
Parameters
• promptsDict: PromptsRecord
• moduleDict: ModuleRecord
Returns
void
Inherited from
BaseQueryEngine
.validatePrompts
Defined in
packages/core/prompts/dist/index.d.ts:65
fromDefaults()
static
fromDefaults(init
):RouterQueryEngine
Parameters
• init
• init.queryEngineTools: RouterQueryEngineTool
[]
• init.selector?: BaseSelector
• init.serviceContext?: ServiceContext
• init.summarizer?: BaseSynthesizer
• init.verbose?: boolean
Returns
Defined in
packages/llamaindex/src/engines/query/RouterQueryEngine.ts:106