Skip to content

Commit

Permalink
Fix await outside function in ChatFeed notebook cell (#5653)
Browse files Browse the repository at this point in the history
* Remove await

* Mention panel-chat-examples (#5654)
  • Loading branch information
ahuang11 authored Oct 16, 2023
1 parent 8e3e193 commit a66e06a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/reference/chat/ChatFeed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"metadata": {},
"outputs": [],
"source": [
"import asyncio\n",
"import time\n",
"import panel as pn\n",
"\n",
"pn.extension()"
Expand All @@ -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",
Expand Down Expand Up @@ -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`."
]
},
{
Expand All @@ -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)"
]
},
Expand Down
2 changes: 2 additions & 0 deletions examples/reference/chat/ChatInterface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a66e06a

Please sign in to comment.