An AI Chat interface for Shiny apps.
Project description
shinychat
Chat UI component for Shiny for Python.
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
To run this example, you'll first need to create an OpenAI API key, and set it in your environment as OPENAI_API_KEY.
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 instance, 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())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shinychat-0.1.0.tar.gz.
File metadata
- Download URL: shinychat-0.1.0.tar.gz
- Upload date:
- Size: 517.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a9134701137544ec8d4025e631cf0dc646cc62d20f2d380d252b9a096d84ef9
|
|
| MD5 |
862ec8a40bff52768cd3c1c99cdb0bd1
|
|
| BLAKE2b-256 |
2a0a84cb2f933d32aa07a1db85332b95f992ad5e05fb85cc5a8d1d4ae362db7b
|
Provenance
The following attestation bundles were made for shinychat-0.1.0.tar.gz:
Publisher:
py-release.yaml on posit-dev/shinychat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shinychat-0.1.0.tar.gz -
Subject digest:
9a9134701137544ec8d4025e631cf0dc646cc62d20f2d380d252b9a096d84ef9 - Sigstore transparency entry: 362975494
- Sigstore integration time:
-
Permalink:
posit-dev/shinychat@dfa31beb68dfd97c3c89a53c310caf4d1cf6cf64 -
Branch / Tag:
refs/tags/py/v0.1.0 - Owner: https://github.com/posit-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
py-release.yaml@dfa31beb68dfd97c3c89a53c310caf4d1cf6cf64 -
Trigger Event:
release
-
Statement type:
File details
Details for the file shinychat-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shinychat-0.1.0-py3-none-any.whl
- Upload date:
- Size: 530.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad724760dcfb001c4e47906b87fa9cde074d9a6117bd2b10f372b7d0d651e41c
|
|
| MD5 |
20d8c4a17e46f2909948f6335c5d2baf
|
|
| BLAKE2b-256 |
bb02883bc754308db9a939d9ba78948aa47d95047ac12bcff05b491d643e4755
|
Provenance
The following attestation bundles were made for shinychat-0.1.0-py3-none-any.whl:
Publisher:
py-release.yaml on posit-dev/shinychat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shinychat-0.1.0-py3-none-any.whl -
Subject digest:
ad724760dcfb001c4e47906b87fa9cde074d9a6117bd2b10f372b7d0d651e41c - Sigstore transparency entry: 362975507
- Sigstore integration time:
-
Permalink:
posit-dev/shinychat@dfa31beb68dfd97c3c89a53c310caf4d1cf6cf64 -
Branch / Tag:
refs/tags/py/v0.1.0 - Owner: https://github.com/posit-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
py-release.yaml@dfa31beb68dfd97c3c89a53c310caf4d1cf6cf64 -
Trigger Event:
release
-
Statement type: