Class: ChatMemoryBuffer<AdditionalMessageOptions>
Extends
BaseChatStoreMemory
<AdditionalMessageOptions
>
Type Parameters
• AdditionalMessageOptions extends object
= object
Constructors
new ChatMemoryBuffer()
new ChatMemoryBuffer<
AdditionalMessageOptions
>(options
?):ChatMemoryBuffer
<AdditionalMessageOptions
>
Parameters
• options?: Partial
<ChatMemoryBufferOptions
<AdditionalMessageOptions
>>
Returns
ChatMemoryBuffer
<AdditionalMessageOptions
>
Overrides
BaseChatStoreMemory<AdditionalMessageOptions>.constructor
Defined in
packages/core/memory/dist/index.d.ts:53
Properties
chatStore
chatStore:
BaseChatStore
<AdditionalMessageOptions
>
Inherited from
BaseChatStoreMemory.chatStore
Defined in
packages/core/memory/dist/index.d.ts:35
chatStoreKey
chatStoreKey:
string
Inherited from
BaseChatStoreMemory.chatStoreKey
Defined in
packages/core/memory/dist/index.d.ts:36
tokenLimit
tokenLimit:
number
Defined in
packages/core/memory/dist/index.d.ts:52
Methods
_tokenCountForMessages()
protected
_tokenCountForMessages(messages
):number
Parameters
• messages: ChatMessage
[]
Returns
number
Inherited from
BaseChatStoreMemory._tokenCountForMessages
Defined in
packages/core/memory/dist/index.d.ts:32
getAllMessages()
getAllMessages():
ChatMessage
<AdditionalMessageOptions
>[] |Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
Retrieves all messages stored in the memory.
Returns
ChatMessage
<AdditionalMessageOptions
>[] | Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
An array of all chat messages, either synchronously or as a Promise.
Inherited from
BaseChatStoreMemory.getAllMessages
Defined in
packages/core/memory/dist/index.d.ts:38
getMessages()
getMessages(
transientMessages
?,initialTokenCount
?):Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
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
• 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?: number
Returns
Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
An array of chat messages, either synchronously or as a Promise.
Overrides
BaseChatStoreMemory.getMessages
Defined in
packages/core/memory/dist/index.d.ts:54
put()
put(
messages
):void
Adds a new message to the memory.
Parameters
• messages: ChatMessage
<AdditionalMessageOptions
>
The chat message to be added to the memory.
Returns
void
Inherited from
BaseChatStoreMemory.put
Defined in
packages/core/memory/dist/index.d.ts:39
reset()
reset():
void
Clears all messages from the memory.
Returns
void
Inherited from
BaseChatStoreMemory.reset
Defined in
packages/core/memory/dist/index.d.ts:41
set()
set(
messages
):void
Parameters
• messages: ChatMessage
<AdditionalMessageOptions
>[]
Returns
void
Inherited from
BaseChatStoreMemory.set
Defined in
packages/core/memory/dist/index.d.ts:40