Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ChatSteps and ChatStep to show/hide intermediate steps #6617

Merged
merged 34 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
782a130
Start adding chat steps
ahuang11 Mar 30, 2024
ae589ca
Fix CSS
ahuang11 Apr 1, 2024
28a4eed
Add chat steps
ahuang11 Apr 2, 2024
a56872d
Address comments
ahuang11 Apr 2, 2024
d35538b
redesign layout
ahuang11 May 15, 2024
65af3fc
Tweak and add serialize
ahuang11 May 15, 2024
3f4255b
Refactor
ahuang11 May 20, 2024
f1a99b2
add tests
ahuang11 May 20, 2024
c428324
mention in chat feed
ahuang11 May 20, 2024
24d31d0
fix docs and remove chat steps from public
ahuang11 May 20, 2024
d2b8ae8
Update panel/chat/feed.py
ahuang11 May 20, 2024
1fbaac6
forgot to add this notebook
ahuang11 May 20, 2024
4be9ce9
fix tests
ahuang11 May 20, 2024
36ef00a
fix more tests
ahuang11 May 20, 2024
7364487
Add methods
ahuang11 May 23, 2024
3b9f276
renames and refactor
ahuang11 May 23, 2024
d4468bb
Update docs
ahuang11 May 23, 2024
c823b69
Merge branch 'main' into add_chat_steps
ahuang11 May 29, 2024
cb69745
Fix test
ahuang11 May 30, 2024
f8143df
fix the tests
ahuang11 May 30, 2024
d8db0b9
address minor comments
ahuang11 Jun 3, 2024
519a765
Rename to append_steps, compress into steps kwarg, docs
ahuang11 Jun 3, 2024
34955d6
Add test
ahuang11 Jun 3, 2024
00bedc0
remove unused test
ahuang11 Jun 3, 2024
be7d6c0
fix example
ahuang11 Jun 3, 2024
68fb65b
address comment
ahuang11 Jun 13, 2024
6daf74e
Merge branch 'main' into add_chat_steps
ahuang11 Jun 13, 2024
b0badd7
Merge branch 'main' into add_chat_steps
philippjfr Jun 25, 2024
3963a06
Merge branch 'main' into add_chat_steps
philippjfr Jun 25, 2024
a5ae22b
Remove ChatSteps
philippjfr Jun 26, 2024
add7b7a
Adjust append logic
philippjfr Jun 26, 2024
f1e0f73
Rename to add_step
philippjfr Jun 26, 2024
032c095
Update docstrings
philippjfr Jun 26, 2024
fe3f0c1
Add tests
philippjfr Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions examples/reference/chat/ChatFeed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,77 @@
"message = chat_feed.send(\"Hello bots!\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Steps\n",
"\n",
"Intermediate steps, like chain of thoughts, can be provided through a series of [`ChatStep`](ChatStep.ipynb), which is conveniently accessible through `append_step`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"chat_feed = pn.chat.ChatFeed()\n",
"chat_feed"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with chat_feed.append_step(\"To answer the user's query, I need to first create a plan.\", title=\"Create a plan\") as step:\n",
" step.stream(\"\\n\\n...Okay the plan is to demo this!\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To append to an existing `ChatSteps`, you can specify `steps=\"append\"` instead of the default `steps=\"new\"`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"step = chat_feed.append_step(title=\"Execute the plan\", steps=\"append\", status=\"running\")\n",
"step.stream(\"\\n\\n...Executing plan...\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Or pass in an existing `ChatSteps` component."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"message = chat_feed.objects[-1]\n",
"steps = message.object\n",
"step = chat_feed.append_step(\"Holding off...\", title=\"Clean up\", status=\"pending\", steps=steps)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"See [`ChatSteps`](ChatSteps.ipynb) and [`ChatStep`](ChatStep.ipynb) for more details on how to use those components."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Loading
Loading