From a66e06a1233bfff8b98745679692998c3a81d4ab Mon Sep 17 00:00:00 2001 From: Andrew <15331990+ahuang11@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:11:12 -0700 Subject: [PATCH] Fix `await outside function` in ChatFeed notebook cell (#5653) * Remove await * Mention panel-chat-examples (#5654) --- examples/reference/chat/ChatFeed.ipynb | 8 +++++--- examples/reference/chat/ChatInterface.ipynb | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/reference/chat/ChatFeed.ipynb b/examples/reference/chat/ChatFeed.ipynb index 7334706f59..656d53603c 100644 --- a/examples/reference/chat/ChatFeed.ipynb +++ b/examples/reference/chat/ChatFeed.ipynb @@ -6,7 +6,7 @@ "metadata": {}, "outputs": [], "source": [ - "import asyncio\n", + "import time\n", "import panel as pn\n", "\n", "pn.extension()" @@ -27,6 +27,8 @@ "\n", "See [`ChatInterface`](ChatInterface.ipynb) for a high-level, *easy to use*, *ChatGPT like* interface.\n", "\n", + "Check out the [panel-chat-examples](https://holoviz-topics.github.io/panel-chat-examples/) docs to see applicable examples related to [LangChain](https://python.langchain.com/docs/get_started/introduction), [OpenAI](https://openai.com/blog/chatgpt), [Mistral](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjZtP35yvSBAxU00wIHHerUDZAQFnoECBEQAQ&url=https%3A%2F%2Fdocs.mistral.ai%2F&usg=AOvVaw2qpx09O_zOzSksgjBKiJY_&opi=89978449), [Llama](https://ai.meta.com/llama/), etc.\n", + "\n", "![Chat Design Specification](../../assets/ChatDesignSpecification.png)\n", "\n", "#### Parameters:\n", @@ -555,7 +557,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The `stream` method is commonly used with for loops." + "The `stream` method is commonly used with for loops; here, we use `time.sleep`, but if you're using `async`, it's better to use `asyncio.sleep`." ] }, { @@ -576,7 +578,7 @@ "source": [ "entry = None\n", "for n in \"123456789 abcdefghijklmnopqrstuvxyz\":\n", - " await asyncio.sleep(0.1)\n", + " time.sleep(0.1)\n", " entry = chat_feed.stream(n, entry=entry)" ] }, diff --git a/examples/reference/chat/ChatInterface.ipynb b/examples/reference/chat/ChatInterface.ipynb index d186b6f428..05c8612340 100644 --- a/examples/reference/chat/ChatInterface.ipynb +++ b/examples/reference/chat/ChatInterface.ipynb @@ -27,6 +27,8 @@ "\n", "Since `ChatInterface` inherits from [`ChatFeed`](ChatFeed.ipynb), it features all the capabilities of [`ChatFeed`](ChatFeed.ipynb); please see [ChatFeed.ipynb](ChatFeed.ipynb) for its backend capabilities.\n", "\n", + "Check out the [panel-chat-examples](https://holoviz-topics.github.io/panel-chat-examples/) docs to see applicable examples related to [LangChain](https://python.langchain.com/docs/get_started/introduction), [OpenAI](https://openai.com/blog/chatgpt), [Mistral](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjZtP35yvSBAxU00wIHHerUDZAQFnoECBEQAQ&url=https%3A%2F%2Fdocs.mistral.ai%2F&usg=AOvVaw2qpx09O_zOzSksgjBKiJY_&opi=89978449), [Llama](https://ai.meta.com/llama/), etc.\n", + "\n", "![Chat Design Specification](../../assets/ChatDesignSpecification.png)\n", "#### Parameters:\n", "\n",