Update to Getting Started docs page for Memory (#5855)

Simply fixing a small typo in the memory page. 

Also removed an extra code block at the end of the file.

Along the way, the current outputs seem to have changed in a few places
so left that for posterity, and updated the number of runs which seems
harmless, though I can clean that up if preferred.
searx_updates
Dave Ingram 11 months ago committed by GitHub
parent 9355e3f5f5
commit 106364a45c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,7 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "d31df93e",
"metadata": {},
@ -9,7 +10,7 @@
"\n",
"This notebook walks through how LangChain thinks about memory. \n",
"\n",
"Memory involves keeping a concept of state around throughout a user's interactions with an language model. A user's interactions with a language model are captured in the concept of ChatMessages, so this boils down to ingesting, capturing, transforming and extracting knowledge from a sequence of chat messages. There are many different ways to do this, each of which exists as its own memory type.\n",
"Memory involves keeping a concept of state around throughout a user's interactions with a language model. A user's interactions with a language model are captured in the concept of ChatMessages, so this boils down to ingesting, capturing, transforming and extracting knowledge from a sequence of chat messages. There are many different ways to do this, each of which exists as its own memory type.\n",
"\n",
"In general, for each type of memory there are two ways to understanding using memory. These are the standalone functions which extract information from a sequence of messages, and then there is the way you can use this type of memory in a chain. \n",
"\n",
@ -25,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "87235cf1",
"metadata": {},
"outputs": [],
@ -41,18 +42,18 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"id": "be030822",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[HumanMessage(content='hi!', additional_kwargs={}),\n",
" AIMessage(content='whats up?', additional_kwargs={})]"
"[HumanMessage(content='hi!', additional_kwargs={}, example=False),\n",
" AIMessage(content='whats up?', additional_kwargs={}, example=False)]"
]
},
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
@ -75,7 +76,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 4,
"id": "a382b160",
"metadata": {},
"outputs": [],
@ -85,7 +86,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 5,
"id": "a280d337",
"metadata": {},
"outputs": [],
@ -97,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 7,
"id": "1b739c0a",
"metadata": {},
"outputs": [
@ -107,7 +108,7 @@
"{'history': 'Human: hi!\\nAI: whats up?'}"
]
},
"execution_count": 12,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@ -126,7 +127,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 8,
"id": "798ceb1c",
"metadata": {},
"outputs": [],
@ -138,18 +139,18 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 9,
"id": "698688fd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'history': [HumanMessage(content='hi!', additional_kwargs={}),\n",
" AIMessage(content='whats up?', additional_kwargs={})]}"
"{'history': [HumanMessage(content='hi!', additional_kwargs={}, example=False),\n",
" AIMessage(content='whats up?', additional_kwargs={}, example=False)]}"
]
},
"execution_count": 14,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@ -169,7 +170,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 10,
"id": "54301321",
"metadata": {},
"outputs": [],
@ -188,7 +189,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 11,
"id": "ae046bff",
"metadata": {},
"outputs": [
@ -216,7 +217,7 @@
"\" Hi there! It's nice to meet you. How can I help you today?\""
]
},
"execution_count": 16,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@ -227,7 +228,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 12,
"id": "d8e2a6ff",
"metadata": {},
"outputs": [
@ -256,7 +257,7 @@
"\" That's great! It's always nice to have a conversation with someone new. What would you like to talk about?\""
]
},
"execution_count": 17,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@ -267,7 +268,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 13,
"id": "15eda316",
"metadata": {},
"outputs": [
@ -298,7 +299,7 @@
"\" Sure! I'm an AI created to help people with their everyday tasks. I'm programmed to understand natural language and provide helpful information. I'm also constantly learning and updating my knowledge base so I can provide more accurate and helpful answers.\""
]
},
"execution_count": 18,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@ -319,7 +320,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 14,
"id": "b5acbc4b",
"metadata": {},
"outputs": [],
@ -338,7 +339,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 15,
"id": "7812ee21",
"metadata": {},
"outputs": [],
@ -348,18 +349,20 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 16,
"id": "3ed6e6a0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'type': 'human', 'data': {'content': 'hi!', 'additional_kwargs': {}}},\n",
" {'type': 'ai', 'data': {'content': 'whats up?', 'additional_kwargs': {}}}]"
"[{'type': 'human',\n",
" 'data': {'content': 'hi!', 'additional_kwargs': {}, 'example': False}},\n",
" {'type': 'ai',\n",
" 'data': {'content': 'whats up?', 'additional_kwargs': {}, 'example': False}}]"
]
},
"execution_count": 3,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
@ -370,7 +373,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 17,
"id": "cdf4ebd2",
"metadata": {},
"outputs": [],
@ -380,18 +383,18 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 18,
"id": "9724e24b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[HumanMessage(content='hi!', additional_kwargs={}),\n",
" AIMessage(content='whats up?', additional_kwargs={})]"
"[HumanMessage(content='hi!', additional_kwargs={}, example=False),\n",
" AIMessage(content='whats up?', additional_kwargs={}, example=False)]"
]
},
"execution_count": 5,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
@ -407,14 +410,6 @@
"source": [
"And that's it for the getting started! There are plenty of different types of memory, check out our examples to see them all"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3dd37d93",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@ -433,7 +428,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
"version": "3.10.9"
}
},
"nbformat": 4,

Loading…
Cancel
Save