py-shinychat 0.2.0
New features
-
New and improved UI for tool calls that occur via chatlas. As a reminder, tool call displays are enabled by setting
content="all"in chatlas'.stream()(or.stream_async()) method. See the tests under thepkg-py/tests/playwright/toolsdirectory for inspiration of what is now possible with custom tool displays via the newToolResultDisplayclass. (#107) -
Added new
message_content()andmessage_content_chunk()generic (singledispatch) functions. These functions aren't intended to be called directly by users, but instead, provide an opportunity to teachChat.append_message()/Chat.append_message_stream()to extract message contents from different types of objects. (#96) -
External links in chat messages in
chat_ui()now open in a new tab by default, with a confirmation dialog. (#120)
Bug fixes
- The chat input no longer submits incomplete text when the user has activated IME completions (e.g. while typing in Japanese or Chinese). (#85)
Deprecations
-
Numerous
Chat()features have been deprecated in preparation for future removal to simplify the API (#91)Chat(messages=...)was deprecated. Usechat.ui(messages=...)instead.Chat(tokenizer=...)was deprecated. This is only relevant for.messages(token_limits=...)which is also now deprecated.- All parameters to
.messages()were deprecated. This reflects an overall change philosophy for maintaining the conversation history sent to the LLM --Chatshould no longer be responsible for maintaining it -- another stateful object (perhaps the one provided by chatlas, LangChain, etc.) should be used instead. That said,.messages()is still useful if you want to access UI message state. - The
.transform_user_inputand.transform_assistant_responsedecorators were deprecated. Instead, transformation of input/responses should be done manually and independently ofChat. - As a result of the previous deprecations,
.user_input(transform=...)was also deprecated.
-
We consolidated the
<shiny-chat-message>and<shiny-user-message>components into a single<shiny-chat-message>component with adata-roleattribute to indicate whether it's an "assistant" or "user" message. This likely has minimal impact on your apps, other than custom styles. You should update anyshiny-user-messagerules to useshiny-chat-message[data-role="user"]. (#101)