This function is used by memory classes to get a string representation of the chat message history, based on the message content and role.
Produces compact output like:
Human: What's the weather?
AI: Let me check...[tool_calls]
Tool: 72°F and sunny
This avoids token inflation from metadata when stringifying message objects directly.
getBufferString(
messages: BaseMessage<MessageStructure<MessageToolSet>, MessageType>[],
humanPrefix: string = "Human",
aiPrefix: string = "AI"
): string| Name | Type | Description |
|---|---|---|
messages* | BaseMessage<MessageStructure<MessageToolSet>, MessageType>[] | |
humanPrefix | string | Default: "Human" |
aiPrefix | string | Default: "AI" |