querychat 0.2.0
The update tool now requires that the SQL query returns all columns from the original data source, ensuring that the dashboard can display the complete data frame after filtering or sorting. If the query does not return all columns, an informative error message will be provided. (#180)
Obvious SQL keywords that lead to data modification (e.g.,
INSERT,UPDATE,DELETE,DROP, etc.) are now prohibited in queries run via the query tool or update tool, to prevent accidental data changes. If such keywords are detected, an informative error message will be provided. (#180)querychat()andQueryChat$new()now use either duckdb or{SQLite}for the in-memory database backend for data frames, depending on which package is installed. If both are installed, duckdb will be preferred. You can explicitly choose theengineinDataFrameSource$new()or setquerychat.DataFrameSource.engineoption to choose a global default. (#178)QueryChat$sidebar(),QueryChat$ui(), andQueryChat$server()now support an optionalidparameter to enable use within Shiny modules. When used in a module UI function, passid = ns("your_id")wherensis the namespacing function fromshiny::NS(). In the corresponding module server function, pass the unwrapped ID toQueryChat$server(id = "your_id"). This enables multiple independent QueryChat instances from the same QueryChat object. (#172)QueryChat$client()can now create standalone querychat-enabled chat clients with configurable tools and callbacks, enabling use outside of Shiny applications. (#168)QueryChat$console()was added to launch interactive console-based chat sessions with your data source, with persistent conversation state across invocations. (#168)The tools used in a
QueryChatchatbot are now configurable. Use the newtoolsparameter ofquerychat()orQueryChat$new()to select either or both"query"or"update"tools. Choosetools = "update"if you only want QueryChat to be able to update the dashboard (useful when you want to be 100% certain that the LLM will not see any raw data). (#168)querychat_app()will now only automatically clean up the data source if QueryChat creates the data source internally from a data frame. (#164)Breaking change: The
$sql()method now returnsNULLinstead of""(empty string) when no query has been set, aligning with the behavior of$title()for consistency. Most code usingisTruthy()or similar falsy checks will continue working without changes. Code that explicitly checkssql() == ""should be updated to use falsy checks (e.g.,!isTruthy(sql())) or explicit null checks (is.null(sql())). (#146)Tool detail cards can now be expanded or collapsed by default when querychat runs a query or updates the dashboard via the
querychat.tool_detailsR option or theQUERYCHAT_TOOL_DETAILSenvironment variable. Valid values are"expanded","collapsed", or"default". (#137)Added bookmarking support to
QueryChat$server()andquerychat_app(). When bookmarking is enabled (viabookmark_store = "url"or"server"inquerychat_app()or$app_obj(), or viaenable_bookmarking = TRUEin$server()), the chat state (including current query, title, and chat history) will be saved and restored with Shiny bookmarks. (#107)-
Nearly the entire functional API (i.e.,
querychat_init(),querychat_sidebar(),querychat_server(), etc) has been hard deprecated in favor of a simpler OOP-based API. Namely, the newQueryChat$new()class is now the main entry point (instead ofquerychat_init()) and has methods to replace old functions (e.g.,$sidebar(),$server(), etc). (#109)- In addition,
querychat_data_source()was renamed toas_querychat_data_source(), and remains exported for a developer extension point, but users no longer have to explicitly create a data source. (#109)
- In addition,
Added
prompt_templatesupport forquerychat_system_prompt(). (Thank you, @oacar! #37, #45)-
querychat_init()now accepts aclient, replacing the previouscreate_chat_funcargument. (#60)The
clientcan be:- an
ellmer::Chatobject, - a function that returns an
ellmer::Chatobject, - or a provider-model string, e.g.
"openai/gpt-4.1", to be passed toellmer::chat().
If
clientis not provided, querychat will use- the
querychat.clientR option, which can be any of the above options, - the
QUERYCHAT_CLIENTenvironment variable, which should be a provider-model string, - or the default model from
ellmer::chat_openai().
- an
querychat_server()now uses ashiny::ExtendedTaskfor streaming the chat response, which allows the dashboard to update and remain responsive while the chat response is streaming in. (#63)querychat now requires
ellmerversion 0.3.0 or later and uses rich tool cards for dashboard updates and database queries. (#65)New
querychat_app()function lets you quickly launch a Shiny app with a querychat chat interface. (#66)querychat_ui()now adds a.querychatclass to the chat container andquerychat_sidebar()adds a.querychat-sidebarclass to the sidebar, allowing for easier customization via CSS. (#68)querychat now uses a separate tool to reset the dashboard. (#80)
querychat_greeting()can be used to generate a greeting message for your querychat bot. (#87)querychat’s system prompt and tool descriptions were rewritten for clarity and future extensibility. (#90)
