Skip to content

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Dec 17, 2024

Most importantly, this'll make it so .append_message() "just works" with chatlas' .stream() method

from chatlas import ChatAnthropic
from shiny.express import ui

chat = ui.Chat(
    id="ui_chat",
    messages=["Hi! How can I help you today?"],
)
chat.ui()

chat_model = ChatAnthropic()

@chat.on_user_submit
async def _():
    response = chat_model.stream(chat.user_input())
    await chat.append_message(response)

TODO

  • Unit test

@cpsievert cpsievert marked this pull request as draft December 17, 2024 17:44
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.

1 participant