An AI Chat interface for Shiny apps.
Project Links
Meta
Author: Joe Cheng, Carson Sievert, Garrick Aden-Buie
Requires Python: >=3.10
Classifiers
shinychat
Chat UI component for Shiny for Python.
Note: shinychat is automatically installed with Shiny for Python and available as shiny.ui.Chat and shiny.express.ui.Chat. For complete instructions about creating chatbots please see the Shiny for Python documentation.
Installation
You can install shinychat from PyPI with:
uv pip install shinychat
Or, install the development version of shinychat from GitHub with:
uv pip install git+https://github.com/posit-dev/shinychat.git
Example
from shiny.express import render, ui
from shinychat.express import Chat
# Set some Shiny page options
ui.page_opts(title="Hello Chat")
# Create a chat component, with an initial message
chat = Chat(
id="chat",
messages=[
{"content": "Hello! How can I help you today?", "role": "assistant"},
],
)
# Display the chat
chat.ui()
# Define a callback to run when the user submits a message
@chat.on_user_submit
async def handle_user_input(user_input: str):
await chat.append_message(f"You said: {user_input}")
"Message state:"
@render.code
def message_state():
return str(chat.messages())
0.2.9
Feb 09, 2026
0.2.8
Sep 11, 2025
0.2.7
Sep 11, 2025
0.2.6
Sep 11, 2025
0.2.5
Sep 11, 2025
0.2.4
Sep 10, 2025
0.2.3
Sep 10, 2025
0.2.2
Sep 10, 2025
0.2.1
Sep 10, 2025
0.2.0
Sep 10, 2025
0.1.0
Aug 07, 2025
0.0.1a2
Jun 03, 2025
0.0.1a1
Jun 03, 2025
0.0.1a0
Jun 03, 2025