|
13 | 13 | "2. Long-term memory storage and retrieval using RedisVL\n", |
14 | 14 | "3. Manually storing and retrieving long-term memory vs. exposing tool access (AKA function-calling)\n", |
15 | 15 | "4. Managing conversation history size with summarization\n", |
16 | | - "5. Memory consolidation and decay\n", |
| 16 | + "5. Memory consolidation\n", |
17 | 17 | "\n", |
18 | 18 | "## Let's Begin!\n", |
19 | 19 | "<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 | 1539 | } |
1540 | 1540 | ], |
1541 | 1541 | "source": [ |
1542 | | - "%pip install ipywidgets\n", |
1543 | | - "\n", |
1544 | 1542 | "import threading\n", |
1545 | 1543 | "\n", |
1546 | 1544 | "\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", |
1572 | 1545 | "def main(thread_id: str = \"book_flight\", user_id: str = \"demo_user\"):\n", |
1573 | 1546 | " \"\"\"Main interaction loop for the travel agent\"\"\"\n", |
1574 | 1547 | " print(\"Welcome to the Travel Assistant! (Type 'exit' to quit)\")\n", |
|
1639 | 1612 | " state[\"messages\"].append(AIMessage(content=error_message))\n", |
1640 | 1613 | "\n", |
1641 | 1614 | "\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", |
1644 | 1621 | "\n", |
1645 | 1622 | "main(thread_id, user_id)" |
1646 | 1623 | ] |
|
0 commit comments