Skip to main content

An AI Chat interface for Shiny apps.

Project description

shinychat

shinychat for Python website

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())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shinychat-0.2.0.tar.gz (547.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shinychat-0.2.0-py3-none-any.whl (560.9 kB view details)

Uploaded Python 3

File details

Details for the file shinychat-0.2.0.tar.gz.

File metadata

  • Download URL: shinychat-0.2.0.tar.gz
  • Upload date:
  • Size: 547.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for shinychat-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3fa4d3673cb1d6e0a9829c09a98d015064b2feb560d4e1e267ec02ad88a949fc
MD5 4dce78fcd0f040b9f028e5fd4d0a9c15
BLAKE2b-256 b86bccf033ea407db1e0e93ad064c4189c00ae3f9fa8e6cae02f86d58112d7c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for shinychat-0.2.0.tar.gz:

Publisher: py-release.yaml on posit-dev/shinychat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shinychat-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: shinychat-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 560.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for shinychat-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49892b11ab81dbf9917d93cf9f9f52bf3e8f66a4b16eae261e2c477b08c075db
MD5 171ec4250a43b9d0b2b884034bc6ef28
BLAKE2b-256 3cbcfaf64cca02e61f66177ba6cd5bbca0aa06ecb6a9504c19022cd267f0ba50

See more details on using hashes here.

Provenance

The following attestation bundles were made for shinychat-0.2.0-py3-none-any.whl:

Publisher: py-release.yaml on posit-dev/shinychat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page