From ca88b25da64b36d79154c24f5eac32a5ab257027 Mon Sep 17 00:00:00 2001 From: Davis Chase <130488702+dev2049@users.noreply.github.com> Date: Thu, 25 May 2023 13:42:10 -0700 Subject: [PATCH] Zep sdk version (#5267) zep-python's sync methods no longer need an asyncio wrapper. This was causing issues with FastAPI deployment. Zep also now supports putting and getting of arbitrary message metadata. Bump zep-python version to v0.30 Remove nest-asyncio from Zep example notebooks. Modify tests to include metadata. --------- Co-authored-by: Daniel Chalef Co-authored-by: Daniel Chalef <131175+danielchalef@users.noreply.github.com> --- .../retrievers/examples/zep_memorystore.ipynb | 35 ++--- docs/modules/memory/examples/zep_memory.ipynb | 142 ++++++------------ poetry.lock | 8 +- pyproject.toml | 2 +- .../memory/chat_message_histories/test_zep.py | 4 +- 5 files changed, 65 insertions(+), 126 deletions(-) diff --git a/docs/modules/indexes/retrievers/examples/zep_memorystore.ipynb b/docs/modules/indexes/retrievers/examples/zep_memorystore.ipynb index 6a5b49a2..016eaa89 100644 --- a/docs/modules/indexes/retrievers/examples/zep_memorystore.ipynb +++ b/docs/modules/indexes/retrievers/examples/zep_memorystore.ipynb @@ -44,22 +44,13 @@ "from uuid import uuid4\n", "\n", "# Set this to your Zep server URL\n", - "ZEP_API_URL = \"http://localhost:8000\"\n", - "\n", - "# Zep is async-first. Our sync APIs use an asyncio wrapper to run outside an app's event loop.\n", - "# This interferes with Jupyter's event loop, so we need to install nest_asyncio to run the\n", - "# Zep client in a notebook.\n", - "\n", - "# !pip install nest_asyncio # Uncomment to install nest_asyncio\n", - "import nest_asyncio\n", - "\n", - "nest_asyncio.apply()" + "ZEP_API_URL = \"http://localhost:8000\"" ], "metadata": { "collapsed": false, "ExecuteTime": { - "end_time": "2023-05-18T20:09:20.355017Z", - "start_time": "2023-05-18T20:09:19.526069Z" + "end_time": "2023-05-25T15:03:27.863217Z", + "start_time": "2023-05-25T15:03:25.690273Z" } } }, @@ -90,8 +81,8 @@ "metadata": { "collapsed": false, "ExecuteTime": { - "end_time": "2023-05-18T20:09:20.424764Z", - "start_time": "2023-05-18T20:09:20.355626Z" + "end_time": "2023-05-25T15:03:29.118416Z", + "start_time": "2023-05-25T15:03:29.022464Z" } } }, @@ -170,8 +161,8 @@ "metadata": { "collapsed": false, "ExecuteTime": { - "end_time": "2023-05-18T20:09:20.603865Z", - "start_time": "2023-05-18T20:09:20.427041Z" + "end_time": "2023-05-25T15:03:30.271181Z", + "start_time": "2023-05-25T15:03:30.180442Z" } } }, @@ -194,7 +185,7 @@ "outputs": [ { "data": { - "text/plain": "[Document(page_content='Who was Octavia Butler?', metadata={'score': 0.7759001673780126, 'uuid': '3bedb2bf-aeaf-4849-924b-40a6d91e54b9', 'created_at': '2023-05-18T20:09:20.47556Z', 'role': 'human', 'token_count': 8})]" + "text/plain": "[Document(page_content='Who was Octavia Butler?', metadata={'score': 0.7759001673780126, 'uuid': '3a82a02f-056e-4c6a-b960-67ebdf3b2b93', 'created_at': '2023-05-25T15:03:30.2041Z', 'role': 'human', 'token_count': 8}),\n Document(page_content=\"Octavia Butler's contemporaries included Ursula K. Le Guin, Samuel R. Delany, and Joanna Russ.\", metadata={'score': 0.7602262941130749, 'uuid': 'a2fc9c21-0897-46c8-bef7-6f5c0f71b04a', 'created_at': '2023-05-25T15:03:30.248065Z', 'role': 'ai', 'token_count': 27}),\n Document(page_content='Who were her contemporaries?', metadata={'score': 0.757553366415519, 'uuid': '41f9c41a-a205-41e1-b48b-a0a4cd943fc8', 'created_at': '2023-05-25T15:03:30.243995Z', 'role': 'human', 'token_count': 8}),\n Document(page_content='Octavia Estelle Butler (June 22, 1947 – February 24, 2006) was an American science fiction author.', metadata={'score': 0.7546211059317948, 'uuid': '34678311-0098-4f1a-8fd4-5615ac692deb', 'created_at': '2023-05-25T15:03:30.231427Z', 'role': 'ai', 'token_count': 31}),\n Document(page_content='Which books of hers were made into movies?', metadata={'score': 0.7496714959247069, 'uuid': '18046c3a-9666-4d3e-b4f0-43d1394732b7', 'created_at': '2023-05-25T15:03:30.236837Z', 'role': 'human', 'token_count': 11})]" }, "execution_count": 4, "metadata": {}, @@ -215,8 +206,8 @@ "metadata": { "collapsed": false, "ExecuteTime": { - "end_time": "2023-05-18T20:09:20.979411Z", - "start_time": "2023-05-18T20:09:20.604147Z" + "end_time": "2023-05-25T15:03:32.979155Z", + "start_time": "2023-05-25T15:03:32.590310Z" } } }, @@ -235,7 +226,7 @@ "outputs": [ { "data": { - "text/plain": "[Document(page_content='Who was Octavia Butler?', metadata={'score': 0.7759001673780126, 'uuid': '3bedb2bf-aeaf-4849-924b-40a6d91e54b9', 'created_at': '2023-05-18T20:09:20.47556Z', 'role': 'human', 'token_count': 8}),\n Document(page_content='Octavia Estelle Butler (June 22, 1947 – February 24, 2006) was an American science fiction author.', metadata={'score': 0.7545887969667749, 'uuid': 'b32c0644-2dcb-4c1d-a445-6622e7ba82e5', 'created_at': '2023-05-18T20:09:20.512044Z', 'role': 'ai', 'token_count': 31})]" + "text/plain": "[Document(page_content='Parable of the Sower is a science fiction novel by Octavia Butler, published in 1993. It follows the story of Lauren Olamina, a young woman living in a dystopian future where society has collapsed due to environmental disasters, poverty, and violence.', metadata={'score': 0.8897321402776546, 'uuid': '1c09603a-52c1-40d7-9d69-29f26256029c', 'created_at': '2023-05-25T15:03:30.268257Z', 'role': 'ai', 'token_count': 56}),\n Document(page_content=\"Write a short synopsis of Butler's book, Parable of the Sower. What is it about?\", metadata={'score': 0.8857628682610436, 'uuid': 'f6706e8c-6c91-452f-8c1b-9559fd924657', 'created_at': '2023-05-25T15:03:30.265302Z', 'role': 'human', 'token_count': 23}),\n Document(page_content='Who was Octavia Butler?', metadata={'score': 0.7759670375149477, 'uuid': '3a82a02f-056e-4c6a-b960-67ebdf3b2b93', 'created_at': '2023-05-25T15:03:30.2041Z', 'role': 'human', 'token_count': 8}),\n Document(page_content=\"Octavia Butler's contemporaries included Ursula K. Le Guin, Samuel R. Delany, and Joanna Russ.\", metadata={'score': 0.7602854653476563, 'uuid': 'a2fc9c21-0897-46c8-bef7-6f5c0f71b04a', 'created_at': '2023-05-25T15:03:30.248065Z', 'role': 'ai', 'token_count': 27}),\n Document(page_content='You might want to read Ursula K. Le Guin or Joanna Russ.', metadata={'score': 0.7595293992240313, 'uuid': 'f22f2498-6118-4c74-8718-aa89ccd7e3d6', 'created_at': '2023-05-25T15:03:30.261198Z', 'role': 'ai', 'token_count': 18})]" }, "execution_count": 5, "metadata": {}, @@ -248,8 +239,8 @@ "metadata": { "collapsed": false, "ExecuteTime": { - "end_time": "2023-05-18T20:09:21.296699Z", - "start_time": "2023-05-18T20:09:20.983624Z" + "end_time": "2023-05-25T15:03:34.713354Z", + "start_time": "2023-05-25T15:03:34.577974Z" } } }, diff --git a/docs/modules/memory/examples/zep_memory.ipynb b/docs/modules/memory/examples/zep_memory.ipynb index 0afa7c36..c276919a 100644 --- a/docs/modules/memory/examples/zep_memory.ipynb +++ b/docs/modules/memory/examples/zep_memory.ipynb @@ -39,8 +39,8 @@ "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2023-05-17T05:12:58.500164Z", - "start_time": "2023-05-17T05:12:57.688886Z" + "end_time": "2023-05-25T15:09:41.754535Z", + "start_time": "2023-05-25T15:09:40.897232Z" } }, "outputs": [], @@ -65,30 +65,8 @@ "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2023-05-17T05:12:58.506469Z", - "start_time": "2023-05-17T05:12:58.501324Z" - } - }, - "outputs": [], - "source": [ - "# Zep is async-first. Our sync APIs use an asyncio wrapper to run outside of an app's event loop.\n", - "# This interferes with Jupyter's event loop, so we need to install nest_asyncio to run the\n", - "# Zep client in a notebook.\n", - "\n", - "# !pip install nest_asyncio\n", - "\n", - "import nest_asyncio\n", - "\n", - "nest_asyncio.apply()" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "ExecuteTime": { - "end_time": "2023-05-17T05:12:58.514638Z", - "start_time": "2023-05-17T05:12:58.503811Z" + "end_time": "2023-05-25T15:09:41.762056Z", + "start_time": "2023-05-25T15:09:41.755238Z" } }, "outputs": [ @@ -96,7 +74,7 @@ "data": { "text/plain": "True" }, - "execution_count": 3, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -118,11 +96,11 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2023-05-17T05:12:58.618633Z", - "start_time": "2023-05-17T05:12:58.510414Z" + "end_time": "2023-05-25T15:09:41.840440Z", + "start_time": "2023-05-25T15:09:41.762277Z" } }, "outputs": [], @@ -162,11 +140,11 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2023-05-17T05:12:58.764097Z", - "start_time": "2023-05-17T05:12:58.622528Z" + "end_time": "2023-05-25T15:09:41.960661Z", + "start_time": "2023-05-25T15:09:41.842656Z" } }, "outputs": [], @@ -251,11 +229,11 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2023-05-17T05:13:08.226487Z", - "start_time": "2023-05-17T05:12:58.760795Z" + "end_time": "2023-05-25T15:09:50.485377Z", + "start_time": "2023-05-25T15:09:41.962287Z" } }, "outputs": [ @@ -266,16 +244,17 @@ "\n", "\n", "\u001B[1m> Entering new AgentExecutor chain...\u001B[0m\n", - "\u001B[32;1m\u001B[1;3mAI: Parable of the Sower is a powerful exploration of the challenges facing contemporary society, such as environmental disasters, poverty, and violence. It examines how these issues can lead to the breakdown of society and how individuals can take action to create a better future. The novel also explores themes of faith, hope, and resilience in the face of adversity.\u001B[0m\n", + "\u001B[32;1m\u001B[1;3mThought: Do I need to use a tool? No\n", + "AI: Parable of the Sower is a prescient novel that speaks to the challenges facing contemporary society, such as climate change, economic inequality, and the rise of authoritarianism. It is a cautionary tale that warns of the dangers of ignoring these issues and the importance of taking action to address them.\u001B[0m\n", "\n", "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { "data": { - "text/plain": "'Parable of the Sower is a powerful exploration of the challenges facing contemporary society, such as environmental disasters, poverty, and violence. It examines how these issues can lead to the breakdown of society and how individuals can take action to create a better future. The novel also explores themes of faith, hope, and resilience in the face of adversity.'" + "text/plain": "'Parable of the Sower is a prescient novel that speaks to the challenges facing contemporary society, such as climate change, economic inequality, and the rise of authoritarianism. It is a cautionary tale that warns of the dangers of ignoring these issues and the importance of taking action to address them.'" }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -300,11 +279,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": { "ExecuteTime": { - "end_time": "2023-05-17T05:13:08.240995Z", - "start_time": "2023-05-17T05:13:08.227744Z" + "end_time": "2023-05-25T15:09:50.493438Z", + "start_time": "2023-05-25T15:09:50.479230Z" } }, "outputs": [ @@ -312,16 +291,19 @@ "name": "stdout", "output_type": "stream", "text": [ - "The AI provides a summary of Octavia Butler's science fiction novel, Parable of the Sower, which follows the story of Lauren Olamina in a dystopian future. When asked for recommendations of other women sci-fi writers, the AI suggests Ursula K. Le Guin and Joanna Russ. The AI also mentions Butler's awards, including the Hugo Award, the Nebula Award, and the MacArthur Fellowship.\n", + "The conversation is about Octavia Butler. The AI describes her as an American science fiction author and mentions the\n", + "FX series Kindred as a well-known adaptation of her work. The human then asks about her contemporaries, and the AI lists \n", + "Ursula K. Le Guin, Samuel R. Delany, and Joanna Russ.\n", "\n", "\n", - "{'role': 'ai', 'content': 'Parable of the Sower is a powerful exploration of the challenges facing contemporary society, such as environmental disasters, poverty, and violence. It examines how these issues can lead to the breakdown of society and how individuals can take action to create a better future. The novel also explores themes of faith, hope, and resilience in the face of adversity.', 'uuid': '50836d01-9dfe-4dd9-8245-3dd67c4c5c73', 'created_at': '2023-05-17T05:13:08.221879Z', 'token_count': 0}\n", - "{'role': 'human', 'content': \"WWhat is the book's relevance to the challenges facing contemporary society?\", 'uuid': '4249ee05-22df-41b5-a8e3-e2f9386f9ca8', 'created_at': '2023-05-17T05:13:08.211224Z', 'token_count': 0}\n", - "{'role': 'ai', 'content': 'Parable of the Sower is a science fiction novel by Octavia Butler, published in 1993. It follows the story of Lauren Olamina, a young woman living in a dystopian future where society has collapsed due to environmental disasters, poverty, and violence.', 'uuid': 'd4806cc0-c75e-4c36-80e9-2d74b23aece0', 'created_at': '2023-05-17T05:12:58.757654Z', 'token_count': 56}\n", - "{'role': 'human', 'content': \"Write a short synopsis of Butler's book, Parable of the Sower. What is it about?\", 'uuid': '378f8b63-8ef8-4fe7-b0b2-abc3e73ce1b2', 'created_at': '2023-05-17T05:12:58.754882Z', 'token_count': 23}\n", - "{'role': 'ai', 'content': 'You might want to read Ursula K. Le Guin or Joanna Russ.', 'uuid': 'b9e52976-3417-4d12-868c-34a197e8111d', 'created_at': '2023-05-17T05:12:58.75184Z', 'token_count': 18}\n", - "{'role': 'human', 'content': 'Which other women sci-fi writers might I want to read?', 'uuid': '64c606c8-3c4b-424b-855e-df71825c15d7', 'created_at': '2023-05-17T05:12:58.746194Z', 'token_count': 14}\n", - "{'role': 'ai', 'content': 'Octavia Butler won the Hugo Award, the Nebula Award, and the MacArthur Fellowship.', 'uuid': '39dab3bd-351b-45df-abec-bba056516700', 'created_at': '2023-05-17T05:12:58.743281Z', 'token_count': 21}\n" + "{'role': 'human', 'content': 'What awards did she win?', 'uuid': '9fa75c3c-edae-41e3-b9bc-9fcf16b523c9', 'created_at': '2023-05-25T15:09:41.91662Z', 'token_count': 8}\n", + "{'role': 'ai', 'content': 'Octavia Butler won the Hugo Award, the Nebula Award, and the MacArthur Fellowship.', 'uuid': 'def4636c-32cb-49ed-b671-32035a034712', 'created_at': '2023-05-25T15:09:41.919874Z', 'token_count': 21}\n", + "{'role': 'human', 'content': 'Which other women sci-fi writers might I want to read?', 'uuid': '6e87bd4a-bc23-451e-ae36-05a140415270', 'created_at': '2023-05-25T15:09:41.923771Z', 'token_count': 14}\n", + "{'role': 'ai', 'content': 'You might want to read Ursula K. Le Guin or Joanna Russ.', 'uuid': 'f65d8dde-9ee8-4983-9da6-ba789b7e8aa4', 'created_at': '2023-05-25T15:09:41.935254Z', 'token_count': 18}\n", + "{'role': 'human', 'content': \"Write a short synopsis of Butler's book, Parable of the Sower. What is it about?\", 'uuid': '5678d056-7f05-4e70-b8e5-f85efa56db01', 'created_at': '2023-05-25T15:09:41.938974Z', 'token_count': 23}\n", + "{'role': 'ai', 'content': 'Parable of the Sower is a science fiction novel by Octavia Butler, published in 1993. It follows the story of Lauren Olamina, a young woman living in a dystopian future where society has collapsed due to environmental disasters, poverty, and violence.', 'uuid': '50d64946-9239-4327-83e6-71dcbdd16198', 'created_at': '2023-05-25T15:09:41.957437Z', 'token_count': 56}\n", + "{'role': 'human', 'content': \"WWhat is the book's relevance to the challenges facing contemporary society?\", 'uuid': 'a39cfc07-8858-480a-9026-fc47a8ef7001', 'created_at': '2023-05-25T15:09:50.469533Z', 'token_count': 16}\n", + "{'role': 'ai', 'content': 'Parable of the Sower is a prescient novel that speaks to the challenges facing contemporary society, such as climate change, economic inequality, and the rise of authoritarianism. It is a cautionary tale that warns of the dangers of ignoring these issues and the importance of taking action to address them.', 'uuid': 'a4ecf0fe-fdd0-4aad-b72b-efde2e6830cc', 'created_at': '2023-05-25T15:09:50.473793Z', 'token_count': 62}\n" ] } ], @@ -348,11 +330,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": { "ExecuteTime": { - "end_time": "2023-05-17T05:13:08.382204Z", - "start_time": "2023-05-17T05:13:08.240341Z" + "end_time": "2023-05-25T15:09:50.751203Z", + "start_time": "2023-05-25T15:09:50.495050Z" } }, "outputs": [ @@ -360,16 +342,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'uuid': '64c606c8-3c4b-424b-855e-df71825c15d7', 'created_at': '2023-05-17T05:12:58.746194Z', 'role': 'human', 'content': 'Which other women sci-fi writers might I want to read?', 'token_count': 14} 0.9119339814710342\n", - "{'uuid': 'b9e52976-3417-4d12-868c-34a197e8111d', 'created_at': '2023-05-17T05:12:58.75184Z', 'role': 'ai', 'content': 'You might want to read Ursula K. Le Guin or Joanna Russ.', 'token_count': 18} 0.8533797599308901\n", - "{'uuid': 'e33fd150-d7f1-4539-84cd-61422208c991', 'created_at': '2023-05-17T05:12:58.718873Z', 'role': 'ai', 'content': \"Octavia Butler's contemporaries included Ursula K. Le Guin, Samuel R. Delany, and Joanna Russ.\", 'token_count': 27} 0.8523616510364422\n", - "{'uuid': '727327f0-b3a9-4564-bd07-1f6bf9e344f0', 'created_at': '2023-05-17T05:12:58.671189Z', 'role': 'human', 'content': 'Who was Octavia Butler?', 'token_count': 8} 0.8235829604682462\n", - "{'uuid': 'db4ecb8c-b887-4de4-bf50-1e497b242fa7', 'created_at': '2023-05-17T05:12:58.699086Z', 'role': 'ai', 'content': 'Octavia Estelle Butler (June 22, 1947 – February 24, 2006) was an American science fiction author.', 'token_count': 31} 0.8205039511484328\n", - "{'uuid': '39dab3bd-351b-45df-abec-bba056516700', 'created_at': '2023-05-17T05:12:58.743281Z', 'role': 'ai', 'content': 'Octavia Butler won the Hugo Award, the Nebula Award, and the MacArthur Fellowship.', 'token_count': 21} 0.8197832181782329\n", - "{'uuid': 'b809efd0-0611-4f22-b0a6-acfd19f99078', 'created_at': '2023-05-17T05:12:58.706624Z', 'role': 'human', 'content': 'Which books of hers were made into movies?', 'token_count': 11} 0.7955720292889512\n", - "{'uuid': 'a77a9b03-2eaa-45d0-8883-3fbf6e069a84', 'created_at': '2023-05-17T05:12:58.714159Z', 'role': 'human', 'content': 'Who were her contemporaries?', 'token_count': 8} 0.7943586007524974\n", - "{'uuid': 'd4806cc0-c75e-4c36-80e9-2d74b23aece0', 'created_at': '2023-05-17T05:12:58.757654Z', 'role': 'ai', 'content': 'Parable of the Sower is a science fiction novel by Octavia Butler, published in 1993. It follows the story of Lauren Olamina, a young woman living in a dystopian future where society has collapsed due to environmental disasters, poverty, and violence.', 'token_count': 56} 0.7815872510788034\n", - "{'uuid': '7800b21b-00aa-4f60-a30a-e1c645507e66', 'created_at': '2023-05-17T05:12:58.711137Z', 'role': 'ai', 'content': \"The most well-known adaptation of Octavia Butler's work is the FX series Kindred, based on her novel of the same name.\", 'token_count': 29} 0.781267456930058\n" + "{'uuid': '6e87bd4a-bc23-451e-ae36-05a140415270', 'created_at': '2023-05-25T15:09:41.923771Z', 'role': 'human', 'content': 'Which other women sci-fi writers might I want to read?', 'token_count': 14} 0.9118298949424545\n", + "{'uuid': 'f65d8dde-9ee8-4983-9da6-ba789b7e8aa4', 'created_at': '2023-05-25T15:09:41.935254Z', 'role': 'ai', 'content': 'You might want to read Ursula K. Le Guin or Joanna Russ.', 'token_count': 18} 0.8533024416448016\n", + "{'uuid': '52cfe3e8-b800-4dd8-a7dd-8e9e4764dfc8', 'created_at': '2023-05-25T15:09:41.913856Z', 'role': 'ai', 'content': \"Octavia Butler's contemporaries included Ursula K. Le Guin, Samuel R. Delany, and Joanna Russ.\", 'token_count': 27} 0.852352466457884\n", + "{'uuid': 'd40da612-0867-4a43-92ec-778b86490a39', 'created_at': '2023-05-25T15:09:41.858543Z', 'role': 'human', 'content': 'Who was Octavia Butler?', 'token_count': 8} 0.8235468913583194\n", + "{'uuid': '4fcfbce4-7bfa-44bd-879a-8cbf265bdcf9', 'created_at': '2023-05-25T15:09:41.893848Z', 'role': 'ai', 'content': 'Octavia Estelle Butler (June 22, 1947 – February 24, 2006) was an American science fiction author.', 'token_count': 31} 0.8204317130595353\n", + "{'uuid': 'def4636c-32cb-49ed-b671-32035a034712', 'created_at': '2023-05-25T15:09:41.919874Z', 'role': 'ai', 'content': 'Octavia Butler won the Hugo Award, the Nebula Award, and the MacArthur Fellowship.', 'token_count': 21} 0.8196714827228725\n", + "{'uuid': '862107de-8f6f-43c0-91fa-4441f01b2b3a', 'created_at': '2023-05-25T15:09:41.898149Z', 'role': 'human', 'content': 'Which books of hers were made into movies?', 'token_count': 11} 0.7954322970428519\n", + "{'uuid': '97164506-90fe-4c71-9539-69ebcd1d90a2', 'created_at': '2023-05-25T15:09:41.90887Z', 'role': 'human', 'content': 'Who were her contemporaries?', 'token_count': 8} 0.7942531405021976\n", + "{'uuid': '50d64946-9239-4327-83e6-71dcbdd16198', 'created_at': '2023-05-25T15:09:41.957437Z', 'role': 'ai', 'content': 'Parable of the Sower is a science fiction novel by Octavia Butler, published in 1993. It follows the story of Lauren Olamina, a young woman living in a dystopian future where society has collapsed due to environmental disasters, poverty, and violence.', 'token_count': 56} 0.78144769172694\n", + "{'uuid': 'c460ffd4-0715-4c69-b793-1092054973e6', 'created_at': '2023-05-25T15:09:41.903082Z', 'role': 'ai', 'content': \"The most well-known adaptation of Octavia Butler's work is the FX series Kindred, based on her novel of the same name.\", 'token_count': 29} 0.7811962820699464\n" ] } ], @@ -378,40 +360,6 @@ "for r in search_results:\n", " print(r.message, r.dist)" ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "ExecuteTime": { - "end_time": "2023-05-17T05:13:08.382385Z", - "start_time": "2023-05-17T05:13:08.380270Z" - } - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 8, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2023-05-17T05:13:08.384260Z", - "start_time": "2023-05-17T05:13:08.381802Z" - } - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false - } } ], "metadata": { diff --git a/poetry.lock b/poetry.lock index 45632829..a316ee03 100644 --- a/poetry.lock +++ b/poetry.lock @@ -10775,14 +10775,14 @@ multidict = ">=4.0" [[package]] name = "zep-python" -version = "0.25" +version = "0.30" description = "Zep stores, manages, enriches, indexes, and searches long-term memory for conversational AI applications. This is the Python client for the Zep service." category = "main" optional = true python-versions = ">=3.8,<4.0" files = [ - {file = "zep_python-0.25-py3-none-any.whl", hash = "sha256:d486afc0d621c3211020d89408940bcad4a062bcbb6f5623bf5152fccad1f87e"}, - {file = "zep_python-0.25.tar.gz", hash = "sha256:bc2937c0449a13f2abffee24351aa2e574c977773f453812613e81c5bc253916"}, + {file = "zep_python-0.30-py3-none-any.whl", hash = "sha256:6020d2f3c6dc3c3bfb8de62db88d97a8c0cf4029b5def0c8a682c3ddc2c480d2"}, + {file = "zep_python-0.30.tar.gz", hash = "sha256:902720af8ffdda861ae1ee1d88e374a095195f1dc3ef79a78ecc699062ace203"}, ] [package.dependencies] @@ -10879,4 +10879,4 @@ text-helpers = ["chardet"] [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4.0" -content-hash = "6eefd001a66f12c5b9978fcb46aaaece7a4f1cd9887d85446d773c884816b104" +content-hash = "0f2ed0b37063f533b3403d545b48633ced4d02c15bc8f4e47f1ded1652ab9764" diff --git a/pyproject.toml b/pyproject.toml index 08739e58..5f595978 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ pandas = {version = "^2.0.1", optional = true} telethon = {version = "^1.28.5", optional = true} neo4j = {version = "^5.8.1", optional = true} psychicapi = {version = "^0.2", optional = true} -zep-python = {version="^0.25", optional=true} +zep-python = {version="^0.30", optional=true} langkit = {version = ">=0.0.1.dev3, <0.1.0", optional = true} chardet = {version="^5.1.0", optional=true} requests-toolbelt = {version = "^1.0.0", optional = true} diff --git a/tests/unit_tests/memory/chat_message_histories/test_zep.py b/tests/unit_tests/memory/chat_message_histories/test_zep.py index 06cd9f3f..49f9ac07 100644 --- a/tests/unit_tests/memory/chat_message_histories/test_zep.py +++ b/tests/unit_tests/memory/chat_message_histories/test_zep.py @@ -30,8 +30,8 @@ def test_messages(mocker: MockerFixture, zep_chat: ZepChatMessageHistory) -> Non content="summary", ), messages=[ - Message(content="message", role="ai"), - Message(content="message2", role="human"), + Message(content="message", role="ai", metadata={"key": "value"}), + Message(content="message2", role="human", metadata={"key2": "value2"}), ], ) zep_chat.zep_client.get_memory.return_value = mock_memory # type: ignore