Examples fixed (#3042)

### https://github.com/hwchase17/langchain/issues/2997

Replaced `conversation.memory.store` to
`conversation.memory.entity_store.store`
As conversation.memory.store doesn't exist  and re-ran  the whole file.
This commit is contained in:
Azam Iftikhar 2023-04-18 08:55:01 +05:30 committed by GitHub
parent dcdcd3f636
commit 471ef84835
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,7 +161,7 @@
"Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n", "Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n",
"\n", "\n",
"Context:\n", "Context:\n",
"{'Deven': '', 'Sam': ''}\n", "{'Deven': 'Deven is working on a hackathon project with Sam.', 'Sam': 'Sam is working on a hackathon project with Deven.'}\n",
"\n", "\n",
"Current conversation:\n", "Current conversation:\n",
"\n", "\n",
@ -189,29 +189,29 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 14,
"id": "0269f513", "id": "0269f513",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"{'Deven': 'Deven is working on a hackathon project with Sam.',\n", "{'Deven': 'Deven is working on a hackathon project with Sam, which they are entering into a hackathon.',\n",
" 'Sam': 'Sam is working on a hackathon project with Deven.'}" " 'Sam': 'Sam is working on a hackathon project with Deven.'}"
] ]
}, },
"execution_count": 9, "execution_count": 14,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"conversation.memory.store" "conversation.memory.entity_store.store"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 15,
"id": "46324ca8", "id": "46324ca8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -232,7 +232,7 @@
"Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n", "Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n",
"\n", "\n",
"Context:\n", "Context:\n",
"{'Deven': 'Deven is working on a hackathon project with Sam.', 'Sam': 'Sam is working on a hackathon project with Deven.', 'Langchain': ''}\n", "{'Deven': 'Deven is working on a hackathon project with Sam, which they are entering into a hackathon.', 'Sam': 'Sam is working on a hackathon project with Deven.', 'Langchain': ''}\n",
"\n", "\n",
"Current conversation:\n", "Current conversation:\n",
"Human: Deven & Sam are working on a hackathon project\n", "Human: Deven & Sam are working on a hackathon project\n",
@ -250,7 +250,7 @@
"' That sounds like an interesting project! What kind of memory structures are they trying to add?'" "' That sounds like an interesting project! What kind of memory structures are they trying to add?'"
] ]
}, },
"execution_count": 10, "execution_count": 15,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -261,7 +261,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 16,
"id": "ff2ebf6b", "id": "ff2ebf6b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -282,7 +282,7 @@
"Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n", "Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n",
"\n", "\n",
"Context:\n", "Context:\n",
"{'Deven': 'Deven is working on a hackathon project with Sam, attempting to add more complex memory structures to Langchain.', 'Sam': 'Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain.', 'Langchain': 'Langchain is a project that is trying to add more complex memory structures.', 'Key-Value Store': ''}\n", "{'Deven': 'Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are trying to add more complex memory structures to Langchain.', 'Sam': 'Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain.', 'Langchain': 'Langchain is a project that is trying to add more complex memory structures.', 'Key-Value Store': ''}\n",
"\n", "\n",
"Current conversation:\n", "Current conversation:\n",
"Human: Deven & Sam are working on a hackathon project\n", "Human: Deven & Sam are working on a hackathon project\n",
@ -299,10 +299,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"' That sounds like a great idea! How will the key-value store work?'" "' That sounds like a great idea! How will the key-value store help with the project?'"
] ]
}, },
"execution_count": 11, "execution_count": 16,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -313,7 +313,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 17,
"id": "56cfd4ba", "id": "56cfd4ba",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -334,7 +334,7 @@
"Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n", "Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n",
"\n", "\n",
"Context:\n", "Context:\n",
"{'Deven': 'Deven is working on a hackathon project with Sam, attempting to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation.', 'Sam': 'Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation.'}\n", "{'Deven': 'Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation.', 'Sam': 'Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation.'}\n",
"\n", "\n",
"Current conversation:\n", "Current conversation:\n",
"Human: Deven & Sam are working on a hackathon project\n", "Human: Deven & Sam are working on a hackathon project\n",
@ -342,7 +342,7 @@
"Human: They are trying to add more complex memory structures to Langchain\n", "Human: They are trying to add more complex memory structures to Langchain\n",
"AI: That sounds like an interesting project! What kind of memory structures are they trying to add?\n", "AI: That sounds like an interesting project! What kind of memory structures are they trying to add?\n",
"Human: They are adding in a key-value store for entities mentioned so far in the conversation.\n", "Human: They are adding in a key-value store for entities mentioned so far in the conversation.\n",
"AI: That sounds like a great idea! How will the key-value store work?\n", "AI: That sounds like a great idea! How will the key-value store help with the project?\n",
"Last line:\n", "Last line:\n",
"Human: What do you know about Deven & Sam?\n", "Human: What do you know about Deven & Sam?\n",
"You:\u001b[0m\n", "You:\u001b[0m\n",
@ -353,10 +353,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"' Deven and Sam are working on a hackathon project together, attempting to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation.'" "' Deven and Sam are working on a hackathon project together, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to be working hard on this project and have a great idea for how the key-value store can help.'"
] ]
}, },
"execution_count": 12, "execution_count": 17,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -376,7 +376,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 21,
"id": "038b4d3f", "id": "038b4d3f",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -384,28 +384,34 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{'Deven': 'Deven is working on a hackathon project with Sam, attempting to add '\n", "{'Daimon': 'Daimon is a company founded by Sam, a successful entrepreneur.',\n",
" 'more complex memory structures to Langchain, including a key-value '\n", " 'Deven': 'Deven is working on a hackathon project with Sam, which they are '\n",
" 'store for entities mentioned so far in the conversation.',\n", " 'entering into a hackathon. They are trying to add more complex '\n",
" 'Key-Value Store': 'A key-value store that stores entities mentioned in the '\n", " 'memory structures to Langchain, including a key-value store for '\n",
" 'conversation.',\n", " 'entities mentioned so far in the conversation, and seem to be '\n",
" 'working hard on this project with a great idea for how the '\n",
" 'key-value store can help.',\n",
" 'Key-Value Store': 'A key-value store is being added to the project to store '\n",
" 'entities mentioned in the conversation.',\n",
" 'Langchain': 'Langchain is a project that is trying to add more complex '\n", " 'Langchain': 'Langchain is a project that is trying to add more complex '\n",
" 'memory structures, including a key-value store for entities '\n", " 'memory structures, including a key-value store for entities '\n",
" 'mentioned so far in the conversation.',\n", " 'mentioned so far in the conversation.',\n",
" 'Sam': 'Sam is working on a hackathon project with Deven, attempting to add '\n", " 'Sam': 'Sam is working on a hackathon project with Deven, trying to add more '\n",
" 'more complex memory structures to Langchain, including a key-value '\n", " 'complex memory structures to Langchain, including a key-value store '\n",
" 'store for entities mentioned so far in the conversation.'}\n" " 'for entities mentioned so far in the conversation. They seem to have '\n",
" 'a great idea for how the key-value store can help, and Sam is also '\n",
" 'the founder of a company called Daimon.'}\n"
] ]
} }
], ],
"source": [ "source": [
"from pprint import pprint\n", "from pprint import pprint\n",
"pprint(conversation.memory.store)" "pprint(conversation.memory.entity_store.store)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 22,
"id": "2df4800e", "id": "2df4800e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -426,15 +432,16 @@
"Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n", "Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n",
"\n", "\n",
"Context:\n", "Context:\n",
"{'Daimon': '', 'Sam': 'Sam is working on a hackathon project with Deven to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation.'}\n", "{'Daimon': 'Daimon is a company founded by Sam, a successful entrepreneur.', 'Sam': 'Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to have a great idea for how the key-value store can help, and Sam is also the founder of a company called Daimon.'}\n",
"\n", "\n",
"Current conversation:\n", "Current conversation:\n",
"Human: They are trying to add more complex memory structures to Langchain\n",
"AI: That sounds like an interesting project! What kind of memory structures are they trying to add?\n",
"Human: They are adding in a key-value store for entities mentioned so far in the conversation.\n", "Human: They are adding in a key-value store for entities mentioned so far in the conversation.\n",
"AI: That sounds like a great idea! How will the key-value store work?\n", "AI: That sounds like a great idea! How will the key-value store help with the project?\n",
"Human: What do you know about Deven & Sam?\n", "Human: What do you know about Deven & Sam?\n",
"AI: Deven and Sam are working on a hackathon project to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to be very motivated and passionate about their project, and are working hard to make it a success.\n", "AI: Deven and Sam are working on a hackathon project together, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to be working hard on this project and have a great idea for how the key-value store can help.\n",
"Human: Sam is the founder of a company called Daimon.\n",
"AI: \n",
"That's impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon?\n",
"Last line:\n", "Last line:\n",
"Human: Sam is the founder of a company called Daimon.\n", "Human: Sam is the founder of a company called Daimon.\n",
"You:\u001b[0m\n", "You:\u001b[0m\n",
@ -445,10 +452,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"\"\\nThat's impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon?\"" "\" That's impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon?\""
] ]
}, },
"execution_count": 8, "execution_count": 22,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -459,7 +466,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 24,
"id": "ebe9e36f", "id": "ebe9e36f",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -467,32 +474,36 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{'Daimon': 'Daimon is a company founded by Sam.',\n", "{'Daimon': 'Daimon is a company founded by Sam, a successful entrepreneur, who '\n",
" 'Deven': 'Deven is working on a hackathon project with Sam to add more '\n", " 'is working on a hackathon project with Deven to add more complex '\n",
" 'complex memory structures to Langchain, including a key-value store '\n", " 'memory structures to Langchain.',\n",
" 'for entities mentioned so far in the conversation.',\n", " 'Deven': 'Deven is working on a hackathon project with Sam, which they are '\n",
" 'Key-Value Store': 'Key-Value Store: A data structure that stores values '\n", " 'entering into a hackathon. They are trying to add more complex '\n",
" 'associated with a unique key, allowing for efficient '\n",
" 'retrieval of values. Deven and Sam are adding a key-value '\n",
" 'store for entities mentioned so far in the conversation.',\n",
" 'Langchain': 'Langchain is a project that seeks to add more complex memory '\n",
" 'structures, including a key-value store for entities mentioned '\n",
" 'so far in the conversation.',\n",
" 'Sam': 'Sam is working on a hackathon project with Deven to add more complex '\n",
" 'memory structures to Langchain, including a key-value store for '\n", " 'memory structures to Langchain, including a key-value store for '\n",
" 'entities mentioned so far in the conversation. He is also the founder '\n", " 'entities mentioned so far in the conversation, and seem to be '\n",
" 'of a company called Daimon.'}\n" " 'working hard on this project with a great idea for how the '\n",
" 'key-value store can help.',\n",
" 'Key-Value Store': 'A key-value store is being added to the project to store '\n",
" 'entities mentioned in the conversation.',\n",
" 'Langchain': 'Langchain is a project that is trying to add more complex '\n",
" 'memory structures, including a key-value store for entities '\n",
" 'mentioned so far in the conversation.',\n",
" 'Sam': 'Sam is working on a hackathon project with Deven, trying to add more '\n",
" 'complex memory structures to Langchain, including a key-value store '\n",
" 'for entities mentioned so far in the conversation. They seem to have '\n",
" 'a great idea for how the key-value store can help, and Sam is also '\n",
" 'the founder of a successful company called Daimon.'}\n"
] ]
} }
], ],
"source": [ "source": [
"from pprint import pprint\n", "from pprint import pprint\n",
"pprint(conversation.memory.store)" "pprint(conversation.memory.entity_store.store)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 25,
"id": "dd547144", "id": "dd547144",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -513,16 +524,16 @@
"Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n", "Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n",
"\n", "\n",
"Context:\n", "Context:\n",
"{'Sam': 'Sam is working on a hackathon project with Deven to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. He is also the founder of a company called Daimon.', 'Daimon': 'Daimon is a company founded by Sam.'}\n", "{'Deven': 'Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation, and seem to be working hard on this project with a great idea for how the key-value store can help.', 'Sam': 'Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to have a great idea for how the key-value store can help, and Sam is also the founder of a successful company called Daimon.', 'Langchain': 'Langchain is a project that is trying to add more complex memory structures, including a key-value store for entities mentioned so far in the conversation.', 'Daimon': 'Daimon is a company founded by Sam, a successful entrepreneur, who is working on a hackathon project with Deven to add more complex memory structures to Langchain.'}\n",
"\n", "\n",
"Current conversation:\n", "Current conversation:\n",
"Human: They are adding in a key-value store for entities mentioned so far in the conversation.\n",
"AI: That sounds like a great idea! How will the key-value store work?\n",
"Human: What do you know about Deven & Sam?\n", "Human: What do you know about Deven & Sam?\n",
"AI: Deven and Sam are working on a hackathon project to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to be very motivated and passionate about their project, and are working hard to make it a success.\n", "AI: Deven and Sam are working on a hackathon project together, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to be working hard on this project and have a great idea for how the key-value store can help.\n",
"Human: Sam is the founder of a company called Daimon.\n", "Human: Sam is the founder of a company called Daimon.\n",
"AI: \n", "AI: \n",
"That's impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon?\n", "That's impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon?\n",
"Human: Sam is the founder of a company called Daimon.\n",
"AI: That's impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon?\n",
"Last line:\n", "Last line:\n",
"Human: What do you know about Sam?\n", "Human: What do you know about Sam?\n",
"You:\u001b[0m\n", "You:\u001b[0m\n",
@ -533,10 +544,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"' Sam is the founder of a company called Daimon. He is also working on a hackathon project with Deven to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. He seems to be very motivated and passionate about his project, and is working hard to make it a success.'" "' Sam is the founder of a successful company called Daimon. He is also working on a hackathon project with Deven to add more complex memory structures to Langchain. They seem to have a great idea for how the key-value store can help.'"
] ]
}, },
"execution_count": 10, "execution_count": 25,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -570,7 +581,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.1" "version": "3.10.10"
} }
}, },
"nbformat": 4, "nbformat": 4,