Skip to content

Commit 4d34561

Browse files
committed
Try to exit cleanly in CI
1 parent 8a91c60 commit 4d34561

File tree

1 file changed

+7
-30
lines changed

1 file changed

+7
-30
lines changed

python-recipes/agents/03_memory_agent.ipynb

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"2. Long-term memory storage and retrieval using RedisVL\n",
1414
"3. Manually storing and retrieving long-term memory vs. exposing tool access (AKA function-calling)\n",
1515
"4. Managing conversation history size with summarization\n",
16-
"5. Memory consolidation and decay\n",
16+
"5. Memory consolidation\n",
1717
"\n",
1818
"## Let's Begin!\n",
1919
"<a href=\"https://colab.research.google.com/github/redis-developer/redis-ai-resources/blob/main/python-recipes/agents/03_memory_agent.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
@@ -1539,36 +1539,9 @@
15391539
}
15401540
],
15411541
"source": [
1542-
"%pip install ipywidgets\n",
1543-
"\n",
15441542
"import threading\n",
15451543
"\n",
15461544
"\n",
1547-
"import ipywidgets as widgets\n",
1548-
"from IPython.display import display, Javascript\n",
1549-
"\n",
1550-
"\n",
1551-
"def popup(text):\n",
1552-
" display(\n",
1553-
" Javascript(f\"\"\"\n",
1554-
" require(['base/js/dialog'], function(dialog) {{\n",
1555-
" dialog.modal({{\n",
1556-
" title: 'Message',\n",
1557-
" body: '{text}',\n",
1558-
" buttons: {{'OK': {{'class': 'btn-primary'}}}}\n",
1559-
" }});\n",
1560-
" }});\n",
1561-
" \"\"\")\n",
1562-
" )\n",
1563-
"\n",
1564-
"\n",
1565-
"# Example usage:\n",
1566-
"popup(\"This is a modal message!\")\n",
1567-
"\n",
1568-
"# To show the modal again with different content, call popup() again\n",
1569-
"popup(\"Another message!\")\n",
1570-
"\n",
1571-
"\n",
15721545
"def main(thread_id: str = \"book_flight\", user_id: str = \"demo_user\"):\n",
15731546
" \"\"\"Main interaction loop for the travel agent\"\"\"\n",
15741547
" print(\"Welcome to the Travel Assistant! (Type 'exit' to quit)\")\n",
@@ -1639,8 +1612,12 @@
16391612
" state[\"messages\"].append(AIMessage(content=error_message))\n",
16401613
"\n",
16411614
"\n",
1642-
"user_id = input(\"Enter a user ID: \") or \"demo_user\"\n",
1643-
"thread_id = input(\"Enter a thread ID: \") or \"demo_thread\"\n",
1615+
"try:\n",
1616+
" user_id = input(\"Enter a user ID: \") or \"demo_user\"\n",
1617+
" thread_id = input(\"Enter a thread ID: \") or \"demo_thread\"\n",
1618+
"except Exception:\n",
1619+
" # If we're running in CI, we don't have a terminal to input from, so just exit\n",
1620+
" exit()\n",
16441621
"\n",
16451622
"main(thread_id, user_id)"
16461623
]

0 commit comments

Comments
 (0)