Class: SimpleChatEngine
SimpleChatEngine is the simplest possible chat engine. Useful for using your own custom prompts.
Implements
Constructors
constructor
• new SimpleChatEngine(init?
)
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
T | extends undefined | boolean = undefined |
R | T extends true ? AsyncGenerator <string , void , unknown > : Response |
Parameters
Name | Type | Description |
---|---|---|
message | MessageContent | |
chatHistory? | ChatMessage [] | optional chat history if you want to customize the chat history |
streaming? | T | optional streaming flag, which auto-sets the return value if True. |
Returns
Promise
<R
>
Implementation of
Defined in
packages/core/src/ChatEngine.ts:56
reset
▸ reset(): void
Resets the chat history so that it's empty.
Returns
void
Implementation of
Defined in
packages/core/src/ChatEngine.ts:101
streamChat
▸ Protected
streamChat(message
, chatHistory?
): AsyncGenerator
<string
, void
, unknown
>
Parameters
Name | Type |
---|---|
message | MessageContent |
chatHistory? | ChatMessage [] |
Returns
AsyncGenerator
<string
, void
, unknown
>