Skip to contents

A thin wrapper around shinychat that embeds an LLM assistant alongside the filtering panel. cb_chat_ui() renders the chat widget and cb_chat_server() wires user messages to a chat client, streaming the assistant's reply back into the widget.

Usage

cb_chat_ui(id)

cb_chat_server(id, chat, input, output, session)

Arguments

id

Module id shared by cb_chat_ui() and cb_chat_server().

chat

A chat client object exposing stream_async() (e.g. an ellmer chat), used to generate streamed responses.

input, output, session

The hosting Shiny module's reactive context objects.

Value

cb_chat_ui() returns the chat UI (a shiny.tag).

cb_chat_server() is called for its side effects (registering the message observer) and returns the observer invisibly.

Details

The chat client (chat) is created by the caller (for example with ellmer::chat_*()) and passed in, so the host application controls the model, system prompt and tools. cb_server() mounts these helpers automatically when its chat argument is supplied.