跳到主要内容

Class: RouterQueryEngine

A query engine that uses multiple query engines and selects the best one.

Hierarchy

Implements

Constructors

constructor

new RouterQueryEngine(init): RouterQueryEngine

Parameters

NameType
initObject
init.queryEngineToolsRouterQueryEngineTool[]
init.selectorBaseSelector
init.serviceContext?ServiceContext
init.summarizer?TreeSummarize
init.verbose?boolean

Returns

RouterQueryEngine

Overrides

PromptMixin.constructor

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:66

Properties

metadatas

Private metadatas: RouterQueryEngineMetadata[]

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:62


queryEngines

Private queryEngines: BaseQueryEngine[]

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:61


selector

Private selector: BaseSelector

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:60


serviceContext

serviceContext: ServiceContext

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:58


summarizer

Private summarizer: TreeSummarize

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:63


verbose

Private verbose: boolean

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:64

Methods

_getPromptModules

_getPromptModules(): Record<string, any>

Returns

Record<string, any>

Overrides

PromptMixin._getPromptModules

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:85


_getPrompts

_getPrompts(): PromptsDict

Returns

PromptsDict

Inherited from

PromptMixin._getPrompts

Defined in

packages/core/src/prompts/Mixin.ts:78


_updatePrompts

_updatePrompts(promptsDict): void

Parameters

NameType
promptsDictPromptsDict

Returns

void

Inherited from

PromptMixin._updatePrompts

Defined in

packages/core/src/prompts/Mixin.ts:86


getPrompts

getPrompts(): PromptsDict

Returns all prompts from the mixin and its modules

Returns

PromptsDict

Inherited from

PromptMixin.getPrompts

Defined in

packages/core/src/prompts/Mixin.ts:27


query

query(params): Promise<AsyncIterable<Response>>

Query the query engine and get a response.

Parameters

NameType
paramsQueryEngineParamsStreaming

Returns

Promise<AsyncIterable<Response>>

Implementation of

BaseQueryEngine.query

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:112

query(params): Promise<Response>

Parameters

NameType
paramsQueryEngineParamsNonStreaming

Returns

Promise<Response>

Implementation of

BaseQueryEngine.query

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:113


queryRoute

queryRoute(queryBundle): Promise<Response>

Parameters

NameType
queryBundleQueryBundle

Returns

Promise<Response>

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:128


updatePrompts

updatePrompts(promptsDict): void

Updates the prompts in the mixin and its modules

Parameters

NameType
promptsDictPromptsDict

Returns

void

Inherited from

PromptMixin.updatePrompts

Defined in

packages/core/src/prompts/Mixin.ts:48


validatePrompts

validatePrompts(promptsDict, moduleDict): void

Validates the prompt keys and module keys

Parameters

NameType
promptsDictPromptsDict
moduleDictModuleDict

Returns

void

Inherited from

PromptMixin.validatePrompts

Defined in

packages/core/src/prompts/Mixin.ts:10


fromDefaults

fromDefaults(init): RouterQueryEngine

Parameters

NameType
initObject
init.queryEngineToolsRouterQueryEngineTool[]
init.selector?BaseSelector
init.serviceContext?ServiceContext
init.summarizer?TreeSummarize
init.verbose?boolean

Returns

RouterQueryEngine

Defined in

packages/core/src/engines/query/RouterQueryEngine.ts:92