Skip to content

[r] querychat 0.3.0

Choose a tag to compare

@cpsievert cpsievert released this 01 Jun 22:48
· 22 commits to main since this release
9bb3a53

New features

  • Added a new "visualize" tool that lets querychat render interactive charts inline in the chat. When enabled (via tools = c("filter", "query", "visualize")), the LLM can answer questions with charts by writing ggsql (SQL with a VISUALISE clause) instead of only tables. Charts can be expanded to fullscreen and their underlying query inspected. Requires the ggsql package and bslib >= 0.11.0. (#224)

  • Added stream cancellation support. A stop button now appears during LLM streaming, allowing users to cancel in-progress responses by clicking it or pressing Escape. Cancellation is enabled by default and can be disabled via enable_cancel = FALSE in the UI. (#241)

  • Added support for Snowflake Semantic Views. When connected to Snowflake via DBI, querychat automatically discovers available Semantic Views and includes their definitions in the system prompt. This helps the LLM generate correct queries using the SEMANTIC_VIEW() table function with certified business metrics and dimensions. (#200)

  • QueryChat$new() now supports deferred data source. Pass data_source = NULL at initialization time, then provide the actual data source via the data_source parameter of $server() or by setting the $data_source property. This enables use cases where the data source depends on session-specific authentication or per-user database connections. (#202)

  • QueryChat$server() now accepts a client parameter for session-scoped chat client overrides. This enables Posit Connect managed OAuth workflows where API credentials are only available inside the Shiny server function. The client spec is stored lazily at construction time and resolved only when needed, so QueryChat$new(NULL, "table") no longer requires an API key. (#205)

Improvements

  • The query tool result card now starts collapsed by default. Users can still expand it to see the SQL query and results. Set QUERYCHAT_TOOL_DETAILS=expanded (or options(querychat.tool_details = "expanded")) to restore the previous behavior. (#239)

  • Query suggestions generated by the LLM now render reliably as clickable cards in the chat. (#236, #238)

  • The tools parameter now uses "filter" as the preferred name (instead of "update") for the dashboard-filtering tool group. The default is now c("filter", "query"). The legacy name "update" is still accepted everywhere. (#222)

  • When a custom prompt_template is provided that doesn't contain Mustache references to {{schema}}, the expensive get_schema() call is now skipped entirely. This allows users with large databases to avoid slow startup by providing their own prompt that includes schema information inline (or omits it). (#208)

Bug fixes

  • DBISource now uses database-agnostic SQL for column and type detection, replacing LIMIT syntax with WHERE 1=0 and dbFetch(n=1). This fixes compatibility with SQL Server and other databases that don't support LIMIT. (#112, #197)