Skip to main content

Class: DefaultContextGenerator

Extends

Implements

  • ContextGenerator

Constructors

new DefaultContextGenerator()

new DefaultContextGenerator(init): DefaultContextGenerator

Parameters

init

init.contextRole?: MessageType

init.contextSystemPrompt?: ContextSystemPrompt

init.metadataMode?: MetadataMode

init.nodePostprocessors?: BaseNodePostprocessor[]

init.retriever: BaseRetriever

Returns

DefaultContextGenerator

Overrides

PromptMixin.constructor

Defined in

packages/core/chat-engine/dist/index.d.ts:76

Properties

contextRole

contextRole: MessageType

Defined in

packages/core/chat-engine/dist/index.d.ts:74


contextSystemPrompt

contextSystemPrompt: ContextSystemPrompt

Defined in

packages/core/chat-engine/dist/index.d.ts:72


metadataMode?

optional metadataMode: MetadataMode

Defined in

packages/core/chat-engine/dist/index.d.ts:75


nodePostprocessors

nodePostprocessors: BaseNodePostprocessor[]

Defined in

packages/core/chat-engine/dist/index.d.ts:73


retriever

retriever: BaseRetriever

Defined in

packages/core/chat-engine/dist/index.d.ts:71

Methods

_getPromptModules()

protected _getPromptModules(): ModuleRecord

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

ModuleRecord

Overrides

PromptMixin._getPromptModules

Defined in

packages/core/chat-engine/dist/index.d.ts:83


_getPrompts()

protected _getPrompts(): object

Returns

object

contextSystemPrompt

contextSystemPrompt: ContextSystemPrompt

Overrides

PromptMixin._getPrompts

Defined in

packages/core/chat-engine/dist/index.d.ts:84


_updatePrompts()

protected _updatePrompts(promptsDict): void

Parameters

promptsDict

promptsDict.contextSystemPrompt: ContextSystemPrompt

Returns

void

Overrides

PromptMixin._updatePrompts

Defined in

packages/core/chat-engine/dist/index.d.ts:87


generate()

generate(message): Promise<Context>

Parameters

message: MessageContent

Returns

Promise<Context>

Implementation of

ContextGenerator.generate

Defined in

packages/core/chat-engine/dist/index.d.ts:91


getPrompts()

getPrompts(): PromptsRecord

Returns

PromptsRecord

Inherited from

PromptMixin.getPrompts

Defined in

packages/core/prompts/dist/index.d.ts:58


updatePrompts()

updatePrompts(prompts): void

Parameters

prompts: PromptsRecord

Returns

void

Inherited from

PromptMixin.updatePrompts

Defined in

packages/core/prompts/dist/index.d.ts:59


validatePrompts()

validatePrompts(promptsDict, moduleDict): void

Parameters

promptsDict: PromptsRecord

moduleDict: ModuleRecord

Returns

void

Inherited from

PromptMixin.validatePrompts

Defined in

packages/core/prompts/dist/index.d.ts:57