Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Aug 24, 2024
1 parent 2ab9555 commit b31212d
Showing 1 changed file with 48 additions and 41 deletions.
89 changes: 48 additions & 41 deletions examples/how-tos/delete-messages.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,11 @@
"{ type: 'human', content: \"hi! I'm bob\", tool_calls: undefined }\n",
"{\n",
" type: 'ai',\n",
" content: 'Hello, Bob! How can I assist you today?',\n",
" content: 'Hi Bob! How can I assist you today?',\n",
" tool_calls: []\n",
"}\n",
"{ type: 'human', content: \"What's my name?\", tool_calls: undefined }\n",
"{\n",
" type: 'ai',\n",
" content: 'You mentioned that your name is Bob.',\n",
" tool_calls: []\n",
"}\n"
"{ type: 'ai', content: 'Your name is Bob.', tool_calls: [] }\n"
]
}
],
Expand Down Expand Up @@ -227,27 +223,27 @@
"text": [
"[\n",
" {\n",
" id: 'd4f8009a-296f-476c-9da7-a2ba540ddb4c',\n",
" id: '24187daa-00dd-40d8-bc30-f4e24ff78165',\n",
" type: 'human',\n",
" content: \"hi! I'm bob\",\n",
" tool_calls: undefined\n",
" },\n",
" {\n",
" id: 'chatcmpl-9zYD0o7x51RDnltDiQJFNeIDwyKq0',\n",
" id: 'chatcmpl-9zYV9yHLiZmR2ZVHEhHcbVEshr3qG',\n",
" type: 'ai',\n",
" content: 'Hello, Bob! How can I assist you today?',\n",
" content: 'Hi Bob! How can I assist you today?',\n",
" tool_calls: []\n",
" },\n",
" {\n",
" id: 'c4ab9309-777f-4301-b54a-ac5adb0b0460',\n",
" id: 'a67e53c3-5dcf-4ddc-83f5-309b72ac61f4',\n",
" type: 'human',\n",
" content: \"What's my name?\",\n",
" tool_calls: undefined\n",
" },\n",
" {\n",
" id: 'chatcmpl-9zYD1r8qJ7kfmcaVBGAuSgbGele5R',\n",
" id: 'chatcmpl-9zYV9mmpJrm3SQ7ngMJZ1XBHzHfL6',\n",
" type: 'ai',\n",
" content: 'You mentioned that your name is Bob.',\n",
" content: 'Your name is Bob.',\n",
" tool_calls: []\n",
" }\n",
"]\n"
Expand All @@ -273,7 +269,7 @@
"id": "81be8a0a-1e94-4302-bd84-d1b72e3c501c",
"metadata": {},
"source": [
"We can call `update_state` and pass in the id of the first message. This will delete that message."
"We can call `updateState` and pass in the id of the first message. This will delete that message."
]
},
{
Expand All @@ -290,7 +286,7 @@
" configurable: {\n",
" thread_id: '2',\n",
" checkpoint_ns: '',\n",
" checkpoint_id: '1ef61a95-3dfd-6501-8005-574e57c84bad'\n",
" checkpoint_id: '1ef61abf-1fc2-6431-8005-92730e9d667c'\n",
" }\n",
"}\n"
]
Expand Down Expand Up @@ -322,21 +318,21 @@
"text": [
"[\n",
" {\n",
" id: 'chatcmpl-9zYD0o7x51RDnltDiQJFNeIDwyKq0',\n",
" id: 'chatcmpl-9zYV9yHLiZmR2ZVHEhHcbVEshr3qG',\n",
" type: 'ai',\n",
" content: 'Hello, Bob! How can I assist you today?',\n",
" content: 'Hi Bob! How can I assist you today?',\n",
" tool_calls: []\n",
" },\n",
" {\n",
" id: 'c4ab9309-777f-4301-b54a-ac5adb0b0460',\n",
" id: 'a67e53c3-5dcf-4ddc-83f5-309b72ac61f4',\n",
" type: 'human',\n",
" content: \"What's my name?\",\n",
" tool_calls: undefined\n",
" },\n",
" {\n",
" id: 'chatcmpl-9zYD1r8qJ7kfmcaVBGAuSgbGele5R',\n",
" id: 'chatcmpl-9zYV9mmpJrm3SQ7ngMJZ1XBHzHfL6',\n",
" type: 'ai',\n",
" content: 'You mentioned that your name is Bob.',\n",
" content: 'Your name is Bob.',\n",
" tool_calls: []\n",
" }\n",
"]\n"
Expand Down Expand Up @@ -436,33 +432,42 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[ [ 'human', \"hi! I'm bob\" ] ]\n",
"--- FIRST ITERATION ---\n",
"\n",
"[ [ 'human', \"hi! I'm bob\" ] ]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"[\n",
" [ 'human', \"hi! I'm bob\" ],\n",
" [ 'ai', 'Hello, Bob! How can I assist you today?' ]\n",
" [ 'ai', 'Hi Bob! How can I assist you today?' ]\n",
"]\n",
"\n",
"\n",
"--- SECOND ITERATION ---\n",
"\n",
"[\n",
" [ 'human', \"hi! I'm bob\" ],\n",
" [ 'ai', 'Hello, Bob! How can I assist you today?' ],\n",
" [ 'ai', 'Hi Bob! How can I assist you today?' ],\n",
" [ 'human', \"what's my name?\" ]\n",
"]\n",
"] \n",
"\n",
"[\n",
" [ 'human', \"hi! I'm bob\" ],\n",
" [ 'ai', 'Hello, Bob! How can I assist you today?' ],\n",
" [ 'ai', 'Hi Bob! How can I assist you today?' ],\n",
" [ 'human', \"what's my name?\" ],\n",
" [\n",
" 'ai',\n",
" 'You mentioned that your name is Bob. How can I help you today, Bob?'\n",
" ]\n",
"]\n",
" [ 'ai', \"Based on what you've told me, your name is Bob.\" ]\n",
"] \n",
"\n",
"[\n",
" [ 'ai', 'Hello, Bob! How can I assist you today?' ],\n",
" [ 'ai', 'Hi Bob! How can I assist you today?' ],\n",
" [ 'human', \"what's my name?\" ],\n",
" [\n",
" 'ai',\n",
" 'You mentioned that your name is Bob. How can I help you today, Bob?'\n",
" ]\n",
"]\n"
" [ 'ai', \"Based on what you've told me, your name is Bob.\" ]\n",
"] \n",
"\n"
]
}
],
Expand All @@ -477,6 +482,7 @@
" content: \"hi! I'm bob\",\n",
"});\n",
"\n",
"console.log(\"--- FIRST ITERATION ---\\n\");\n",
"for await (const event of await app2.stream(\n",
" { messages: [inputMessage3] },\n",
" config2\n",
Expand All @@ -489,11 +495,12 @@
" content: \"what's my name?\",\n",
"});\n",
"\n",
"console.log(\"\\n\\n--- SECOND ITERATION ---\\n\");\n",
"for await (const event of await app2.stream(\n",
" { messages: [inputMessage4] },\n",
" config2\n",
")) {\n",
" console.log(event.messages.map((message) => [message._getType(), message.content]));\n",
" console.log(event.messages.map((message) => [message._getType(), message.content]), \"\\n\");\n",
"}"
]
},
Expand All @@ -517,21 +524,21 @@
"text": [
"[\n",
" {\n",
" id: 'chatcmpl-9zYD1VPNuqsUBmBSkGm9kfTetn0Yu',\n",
" id: 'chatcmpl-9zYVAEiiC9D7bb0wF4KLXgY0OAG8O',\n",
" type: 'ai',\n",
" content: 'Hello, Bob! How can I assist you today?',\n",
" content: 'Hi Bob! How can I assist you today?',\n",
" tool_calls: []\n",
" },\n",
" {\n",
" id: '3a5d2825-a794-4ad6-b193-d9d4adb8ca97',\n",
" id: 'b93e5f35-cfa3-4ca6-9b59-154ce2bd476b',\n",
" type: 'human',\n",
" content: \"what's my name?\",\n",
" tool_calls: undefined\n",
" },\n",
" {\n",
" id: 'chatcmpl-9zYD2oRkngWTtiPazQX4Pg6SUO0MU',\n",
" id: 'chatcmpl-9zYVBHJWtEM6pw2koE8dykzSA0XSO',\n",
" type: 'ai',\n",
" content: 'You mentioned that your name is Bob. How can I help you today, Bob?',\n",
" content: \"Based on what you've told me, your name is Bob.\",\n",
" tool_calls: []\n",
" }\n",
"]\n"
Expand Down

0 comments on commit b31212d

Please sign in to comment.