Saltar al contenido principal

Class: SimpleChatEngine

SimpleChatEngine is the simplest possible chat engine. Useful for using your own custom prompts.

Implements

Constructors

constructor

new SimpleChatEngine(init?)

Parameters

NameType
init?Partial<SimpleChatEngine>

Defined in

packages/core/src/ChatEngine.ts:51

Properties

chatHistory

chatHistory: ChatMessage[]

Defined in

packages/core/src/ChatEngine.ts:48


llm

llm: LLM

Defined in

packages/core/src/ChatEngine.ts:49

Methods

chat

chat<T, R>(message, chatHistory?, streaming?): Promise<R>

Send message along with the class's current chat history to the LLM.

Type parameters

NameType
Textends undefined | boolean = undefined
RT extends true ? AsyncGenerator<string, void, unknown> : Response

Parameters

NameTypeDescription
messageMessageContent
chatHistory?ChatMessage[]optional chat history if you want to customize the chat history
streaming?Toptional streaming flag, which auto-sets the return value if True.

Returns

Promise<R>

Implementation of

ChatEngine.chat

Defined in

packages/core/src/ChatEngine.ts:56


reset

reset(): void

Resets the chat history so that it's empty.

Returns

void

Implementation of

ChatEngine.reset

Defined in

packages/core/src/ChatEngine.ts:101


streamChat

Protected streamChat(message, chatHistory?): AsyncGenerator<string, void, unknown>

Parameters

NameType
messageMessageContent
chatHistory?ChatMessage[]

Returns

AsyncGenerator<string, void, unknown>

Defined in

packages/core/src/ChatEngine.ts:78