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:79

Properties

contextRole

contextRole: MessageType

Defined in

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


contextSystemPrompt

contextSystemPrompt: ContextSystemPrompt

Defined in

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


metadataMode?

optional metadataMode: MetadataMode

Defined in

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


nodePostprocessors

nodePostprocessors: BaseNodePostprocessor[]

Defined in

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


retriever

retriever: BaseRetriever

Defined in

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

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:86


_getPrompts()

protected _getPrompts(): object

Returns

object

contextSystemPrompt

contextSystemPrompt: ContextSystemPrompt

Overrides

PromptMixin._getPrompts

Defined in

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


_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:90


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:94


getPrompts()

getPrompts(): PromptsRecord

Returns

PromptsRecord

Inherited from

PromptMixin.getPrompts

Defined in

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


updatePrompts()

updatePrompts(prompts): void

Parameters

prompts: PromptsRecord

Returns

void

Inherited from

PromptMixin.updatePrompts

Defined in

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


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:65