Skip to content

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Oct 15, 2024

With this PR, the messages parameter of Chat.ui()/chat_ui() becomes the suggested way to provide starting messages. For example:

Express
from shiny import reactive
from shiny.express import ui

chat = ui.Chat(id="chat")

chat.ui(messages=["Hello, how can I help?"])
Core
from shiny import App, ui

app_ui = ui.page_fixed(
    ui.chat_ui("chat", messages=["Hello, how are you?"]),
)

def server(input, output, session):
    pass

app = App(app_ui, server)

This PR also reverts #1593 since waiting until flush to send is not an ideal way to support dynamic UI. As a result, this PR also closes #1735.

In the next release, we should deprecate Chat(messages=...) in favor of these new parameters. Deprecating now feels premature since it's still convenient for things like system messages. But, when we move towards recommending chatlas/LangChain for managing chat state in a future release, we'll deprecate as a part of that move.

@cpsievert cpsievert force-pushed the chat-starting-messages branch from d6a349b to c9ee59c Compare October 15, 2024 18:54
@cpsievert cpsievert merged commit d0354b9 into main Oct 15, 2024
41 checks passed
@cpsievert cpsievert deleted the chat-starting-messages branch October 15, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible bug with LangGraph streaming introduced in v1.1.0 in ui.Chat()
2 participants