ChatMemoryBuffer
Defined in: .build/typescript/packages/core/src/memory/deprecated/chat-memory-buffer.ts:18
Deprecated
Section titled “Deprecated”Use Memory instead.
Extends
Section titled “Extends”BaseChatStoreMemory
<AdditionalMessageOptions
>
Type Parameters
Section titled “Type Parameters”AdditionalMessageOptions
Section titled “AdditionalMessageOptions”AdditionalMessageOptions
extends object
= object
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ChatMemoryBuffer<
AdditionalMessageOptions
>(options?
):ChatMemoryBuffer
<AdditionalMessageOptions
>
Defined in: .build/typescript/packages/core/src/memory/deprecated/chat-memory-buffer.ts:23
Parameters
Section titled “Parameters”options?
Section titled “options?”Partial
<ChatMemoryBufferOptions
<AdditionalMessageOptions
>>
Returns
Section titled “Returns”ChatMemoryBuffer
<AdditionalMessageOptions
>
Overrides
Section titled “Overrides”BaseChatStoreMemory<AdditionalMessageOptions>.constructor
Properties
Section titled “Properties”chatStore
Section titled “chatStore”chatStore:
BaseChatStore
<AdditionalMessageOptions
>
Defined in: .build/typescript/packages/core/src/memory/deprecated/base.ts:66
Inherited from
Section titled “Inherited from”BaseChatStoreMemory.chatStore
chatStoreKey
Section titled “chatStoreKey”chatStoreKey:
string
=DEFAULT_CHAT_STORE_KEY
Defined in: .build/typescript/packages/core/src/memory/deprecated/base.ts:67
Inherited from
Section titled “Inherited from”BaseChatStoreMemory.chatStoreKey
tokenLimit
Section titled “tokenLimit”tokenLimit:
number
Defined in: .build/typescript/packages/core/src/memory/deprecated/chat-memory-buffer.ts:21
Methods
Section titled “Methods”_tokenCountForMessages()
Section titled “_tokenCountForMessages()”
protected
_tokenCountForMessages(messages
):number
Defined in: .build/typescript/packages/core/src/memory/deprecated/base.ts:48
Parameters
Section titled “Parameters”messages
Section titled “messages”Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”BaseChatStoreMemory._tokenCountForMessages
getAllMessages()
Section titled “getAllMessages()”getAllMessages():
ChatMessage
<AdditionalMessageOptions
>[] |Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
Defined in: .build/typescript/packages/core/src/memory/deprecated/base.ts:72
Retrieves all messages stored in the memory.
Returns
Section titled “Returns”ChatMessage
<AdditionalMessageOptions
>[] | Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
An array of all chat messages, either synchronously or as a Promise.
Inherited from
Section titled “Inherited from”BaseChatStoreMemory.getAllMessages
put(
messages
):void
|Promise
<void
>
Defined in: .build/typescript/packages/core/src/memory/deprecated/base.ts:78
Adds a new message to the memory.
Parameters
Section titled “Parameters”messages
Section titled “messages”ChatMessage
<AdditionalMessageOptions
>
The chat message to be added to the memory.
Returns
Section titled “Returns”void
| Promise
<void
>
Inherited from
Section titled “Inherited from”BaseChatStoreMemory.put
set(
messages
):void
|Promise
<void
>
Defined in: .build/typescript/packages/core/src/memory/deprecated/base.ts:82
Parameters
Section titled “Parameters”messages
Section titled “messages”ChatMessage
<AdditionalMessageOptions
>[]
Returns
Section titled “Returns”void
| Promise
<void
>
Inherited from
Section titled “Inherited from”BaseChatStoreMemory.set
reset()
Section titled “reset()”reset():
void
|Promise
<void
>
Defined in: .build/typescript/packages/core/src/memory/deprecated/base.ts:86
Clears all messages from the memory.
Returns
Section titled “Returns”void
| Promise
<void
>
Inherited from
Section titled “Inherited from”BaseChatStoreMemory.reset
getMessages()
Section titled “getMessages()”getMessages(
transientMessages?
,initialTokenCount?
):Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
Defined in: .build/typescript/packages/core/src/memory/deprecated/chat-memory-buffer.ts:39
Retrieves messages from the memory, optionally including transient messages. Compared to getAllMessages, this method a) allows for transient messages to be included in the retrieval and b) may return a subset of the total messages by applying a token limit.
Parameters
Section titled “Parameters”transientMessages?
Section titled “transientMessages?”ChatMessage
<AdditionalMessageOptions
>[]
Optional array of temporary messages to be included in the retrieval. These messages are not stored in the memory but are considered for the current interaction.
initialTokenCount?
Section titled “initialTokenCount?”number
= 0
Returns
Section titled “Returns”Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
An array of chat messages, either synchronously or as a Promise.
Overrides
Section titled “Overrides”BaseChatStoreMemory.getMessages