Demonstrate use of get_buffer_string (#13013)
**Description**
The docs for creating a RAG chain with Memory [currently use a manual
lambda](https://python.langchain.com/docs/expression_language/cookbook/retrieval#with-memory-and-returning-source-documents)
to format chat history messages. [There exists a helper method within
the
codebase](https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain/schema/messages.py#L14C15-L14C15)
to perform this task so I've updated the documentation to demonstrate
its usage
Also worth noting that the current documented method of using the
included `_format_chat_history ` function actually results in an error:
```
TypeError: 'HumanMessage' object is not subscriptable
```
---------
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>