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 <daniel.chalef@private.org>
Co-authored-by: Daniel Chalef <131175+danielchalef@users.noreply.github.com>
This commit is contained in:
Davis Chase
2023-05-25 13:42:10 -07:00
committed by GitHub
parent 5525602df0
commit ca88b25da6
5 changed files with 65 additions and 126 deletions

View File

@@ -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"
}
}
},