@@ -133,11 +133,12 @@ async def handle_user_input(user_input: str):
133133        A unique identifier for the chat session. In Shiny Core, make sure this id 
134134        matches a corresponding :func:`~shiny.ui.chat_ui` call in the UI. 
135135    messages 
136-         A sequence of messages to display in the chat. Each message can be a 
137-         dictionary with a `content` and `role` key. The `content` key should contain 
138-         the message text, and the `role` key can be "assistant", "user", or "system". 
139-         Note that system messages are not actually displayed in the chat, but will 
140-         still be stored in the chat's `.messages()`. 
136+         A sequence of messages to display in the chat. Each message can be either a 
137+         string or a dictionary with `content` and `role` keys. The `content` key 
138+         should contain a string, and the `role` key can be "assistant" or "user". 
139+         Content strings are interpreted as markdown and rendered to HTML on the client. 
140+         Content may also include specially formatted **input suggestion** links (see 
141+         `.append_message_stream()` for more information). 
141142    on_error 
142143        How to handle errors that occur in response to user input. When `"unhandled"`, 
143144        the app will stop running when an error occurs. Otherwise, a notification 
@@ -498,11 +499,37 @@ async def append_message(self, message: Any) -> None:
498499            The message to append. A variety of message formats are supported including 
499500            a string, a dictionary with `content` and `role` keys, or a relevant chat 
500501            completion object from platforms like OpenAI, Anthropic, Ollama, and others. 
502+             Content strings are interpreted as markdown and rendered to HTML on the 
503+             client. Content may also include specially formatted **input suggestion** 
504+             links (see note below). 
501505
502506        Note 
503507        ---- 
508+         ``{.callout-note title="Input suggestions"} 
509+         Input suggestions are special links that send text to the user input box when 
510+         clicked (or accessed via keyboard). They can be created in the following ways: 
511+ 
512+         * `<span class='suggestion'>Suggestion text</span>`: An inline text link that 
513+             places 'Suggestion text' in the user input box when clicked. 
514+         * `<img data-suggestion='Suggestion text' src='image.jpg'>`: An image link with 
515+             the same functionality as above. 
516+         * `<span data-suggestion='Suggestion text'>Actual text</span>`: An inline text 
517+             link that places 'Suggestion text' in the user input box when clicked. 
518+ 
519+         A suggestion can also be submitted automatically by doing one of the following: 
520+ 
521+         * Adding a `submit` CSS class or a `data-suggestion-submit="true"` attribute to 
522+           the suggestion element. 
523+         * Holding the `Ctrl/Cmd` key while clicking the suggestion link. 
524+ 
525+         Note that a user may also opt-out of submitting a suggestion by holding the 
526+         `Alt/Option` key while clicking the suggestion link. 
527+         ``` 
528+ 
529+         ```{.callout-note title="Streamed messages"} 
504530        Use `.append_message_stream()` instead of this method when `stream=True` (or 
505531        similar) is specified in model's completion method. 
532+         ``` 
506533        """ 
507534        await  self ._append_message (message )
508535
@@ -546,15 +573,40 @@ async def append_message_stream(self, message: Iterable[Any] | AsyncIterable[Any
546573        Parameters 
547574        ---------- 
548575        message 
549-             An iterable or async iterable of message chunks to append. A variety of 
550-             message chunk formats are supported, including a string, a dictionary with 
551-             `content` and `role` keys, or a relevant chat completion object from 
552-             platforms like OpenAI, Anthropic, Ollama, and others. 
576+             An (async) iterable of message chunks to append. A variety of message chunk 
577+             formats are supported, including a string, a dictionary with `content` and 
578+             `role` keys, or a relevant chat completion object from platforms like 
579+             OpenAI, Anthropic, Ollama, and others. Content strings are interpreted as 
580+             markdown and rendered to HTML on the client. Content may also include 
581+             specially formatted **input suggestion** links (see note below). 
553582
554583        Note 
555584        ---- 
585+         ```{.callout-note title="Input suggestions"} 
586+         Input suggestions are special links that send text to the user input box when 
587+         clicked (or accessed via keyboard). They can be created in the following ways: 
588+ 
589+         * `<span class='suggestion'>Suggestion text</span>`: An inline text link that 
590+             places 'Suggestion text' in the user input box when clicked. 
591+         * `<img data-suggestion='Suggestion text' src='image.jpg'>`: An image link with 
592+             the same functionality as above. 
593+         * `<span data-suggestion='Suggestion text'>Actual text</span>`: An inline text 
594+             link that places 'Suggestion text' in the user input box when clicked. 
595+ 
596+         A suggestion can also be submitted automatically by doing one of the following: 
597+ 
598+         * Adding a `submit` CSS class or a `data-suggestion-submit="true"` attribute to 
599+           the suggestion element. 
600+         * Holding the `Ctrl/Cmd` key while clicking the suggestion link. 
601+ 
602+         Note that a user may also opt-out of submitting a suggestion by holding the 
603+         `Alt/Option` key while clicking the suggestion link. 
604+         ``` 
605+ 
606+         ```{.callout-note title="Streamed messages"} 
556607        Use this method (over `.append_message()`) when `stream=True` (or similar) is 
557608        specified in model's completion method. 
609+         ``` 
558610        """ 
559611
560612        message  =  _utils .wrap_async_iterable (message )
@@ -1090,9 +1142,12 @@ def chat_ui(
10901142    id 
10911143        A unique identifier for the chat UI. 
10921144    messages 
1093-         A sequence of messages to display in the chat. Each message can be either a string 
1094-         or a dictionary with a `content` and `role` key. The `content` key should contain 
1095-         the message text, and the `role` key can be "assistant" or "user". 
1145+         A sequence of messages to display in the chat. Each message can be either a 
1146+         string or a dictionary with `content` and `role` keys. The `content` key 
1147+         should contain a string, and the `role` key can be "assistant" or "user". 
1148+         Content strings are interpreted as markdown and rendered to HTML on the client. 
1149+         Content may also include specially formatted **input suggestion** links (see 
1150+         :method:`~shiny.ui.Chat.append_message_stream` for more information). 
10961151    placeholder 
10971152        Placeholder text for the chat input. 
10981153    width 
0 commit comments