---
hide_table_of_contents: true
---

import CodeBlock from "@theme/CodeBlock";
import Example from "@examples/chat/memory.ts";

# Using Buffer Memory with Chat Models

This example covers how to use chat-specific memory classes with chat models.
The key thing to notice is that setting `returnMessages: true` makes the memory return a list of chat messages instead of a string.

<CodeBlock language="typescript">{Example}</CodeBlock>
