Skip to content

Releases: posit-dev/querychat

[py] querychat 0.5.1

23 Jan 23:06

Choose a tag to compare

New features

  • QueryChat() now supports deferred data source initialization for Shiny Core applications. Pass data_source=None 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)

[py] querychat 0.5.0

16 Jan 22:45

Choose a tag to compare

New features

  • Added support for Gradio, Dash, and Streamlit web frameworks in addition to Shiny. Import from the new submodules:
    • from querychat.gradio import QueryChat
    • from querychat.dash import QueryChat
    • from querychat.streamlit import QueryChat

Each framework's QueryChat provides .app() for quick standalone apps and .ui() for custom layouts. Install framework dependencies with pip extras: pip install querychat[gradio], pip install querychat[dash], or pip install querychat[streamlit]. (#190)

  • QueryChat() gains support for more data sources:
    • polars.LazyFrame: queries execute lazily via polars.SQLContext. In this case, .df() et al. methods will return a polars.LazyFrame. (#191)
    • ibis.Table: queries execute lazily via the Ibis backend's SQL interface (DuckDB, PostgreSQL, BigQuery, etc.). In this case, .df() et al. methods will return an ibis.Table. (#193)
    • pyarrow.Table: queries execute in-memory via duckdb. In this case, .df() et al. methods will return a pyarrow.Table. (#196)

Improvements

  • Improved typing support for return types on .df() et al. (#196)

Changes

  • DataFrameSource methods now (once again) return the input DataFrame type (e.g., pandas.DataFrame) instead of nw.DataFrame. (#196)

[py] querychat 0.4.0

14 Jan 19:52

Choose a tag to compare

Breaking Changes

  • Methods like execute_query(), get_data(), and df() now return a narwhals.DataFrame instead of a pandas.DataFrame. This allows querychat to drop its pandas dependency, and for you to use any narwhals-compatible dataframe of your choosing.
    • If this breaks existing code, note you can call .to_native() on the new dataframe value to get your pandas dataframe back.
    • Note that polars or pandas will be needed to realize a sqlalchemy connection query as a dataframe. Install with pip install querychat[pandas] or pip install querychat[polars]

New features

  • QueryChat.console() was added to launch interactive console-based chat sessions with your data source, with persistent conversation state across invocations. (#168)

  • QueryChat.client() can now create standalone querychat-enabled chat clients with configurable tools and callbacks, enabling use outside of Shiny applications. (#168)

  • The tools used in a QueryChat chatbot are now configurable. Use the new tools parameter of QueryChat() to select either or both "query" or "update" tools. Choose tools=["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.sidebar(), QueryChat.ui(), and QueryChat.server() now support an optional id parameter to create multiple chat instances from a single QueryChat object. (#172)

Improvements

  • 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)

[r] querychat 0.2.0

12 Jan 20:15
fd45cec

Choose a tag to compare

  • 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() and QueryChat$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 the engine in DataFrameSource$new() or set querychat.DataFrameSource.engine option to choose a global default. (#178)

  • QueryChat$sidebar(), QueryChat$ui(), and QueryChat$server() now support an optional id parameter to enable use within Shiny modules. When used in a module UI function, pass id = ns("your_id") where ns is the namespacing function from shiny::NS(). In the corresponding module server function, pass the unwrapped ID to QueryChat$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 QueryChat chatbot are now configurable. Use the new tools parameter of querychat() or QueryChat$new() to select either or both "query" or "update" tools. Choose tools = "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 returns NULL instead of "" (empty string) when no query has been set, aligning with the behavior of $title() for consistency. Most code using isTruthy() or similar falsy checks will continue working without changes. Code that explicitly checks sql() == "" 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_details R option or the QUERYCHAT_TOOL_DETAILS environment variable. Valid values are "expanded", "collapsed", or "default". (#137)

  • Added bookmarking support to QueryChat$server() and querychat_app(). When bookmarking is enabled (via bookmark_store = "url" or "server" in querychat_app() or $app_obj(), or via enable_bookmarking = TRUE in $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 new QueryChat$new() class is now the main entry point (instead of querychat_init()) and has methods to replace old functions (e.g., $sidebar(), $server(), etc). (#109)

    • In addition, querychat_data_source() was renamed to as_querychat_data_source(), and remains exported for a developer extension point, but users no longer have to explicitly create a data source. (#109)
  • Added prompt_template support for querychat_system_prompt(). (Thank you, @oacar! #37, #45)

  • querychat_init() now accepts a client, replacing the previous create_chat_func argument. (#60)

    The client can be:

    • an ellmer::Chat object,
    • a function that returns an ellmer::Chat object,
    • or a provider-model string, e.g. "openai/gpt-4.1", to be passed to ellmer::chat().

    If client is not provided, querychat will use

    • the querychat.client R option, which can be any of the above options,
    • the QUERYCHAT_CLIENT environment variable, which should be a provider-model string,
    • or the default model from ellmer::chat_openai().
  • querychat_server() now uses a shiny::ExtendedTask for streaming the chat response, which allows the dashboard to update and remain responsive while the chat response is streaming in. (#63)

  • querychat now requires ellmer version 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 .querychat class to the chat container and querychat_sidebar() adds a .querychat-sidebar class 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)

[py] querychat 0.3.0

10 Dec 18:12

Choose a tag to compare

Breaking Changes

  • The entire functional API (i.e., init(), sidebar(), server(), etc) has been hard deprecated in favor of a simpler OOP-based API. Namely, the new QueryChat() class is now the main entry point (instead of init()) and has methods to replace old functions (e.g., .sidebar(), .server(), etc). (#101)

  • The .sql() method now returns None instead of "" (empty string) when no query has been set, aligning with the behavior of .title() for consistency. Most code using the or operator or req() for falsy checks will continue working without changes. Code that explicitly checks sql() == "" should be updated to use falsy checks (if not sql()) or explicit null checks (if sql() is None). (#146)

New features

  • New QueryChat.app() method enables quicker/easier chatting with a dataset. (#104)

  • Enabled bookmarking by default in both .app() and .server() methods. In latter case, you'll need to also specify the bookmark_store (either in shiny.App() or shiny.express.app_opts()) for it to take effect. (#104)

  • The current SQL query and title can now be programmatically set through the .sql() and .title() methods of QueryChat(). (#98, #101)

  • New querychat.data module provides sample datasets (titanic() and tips()) to make it easier to get started without external dependencies. (#118)

  • Added a .generate_greeting() method to help you create a greeting message for your querychat bot. (#87)

  • Added querychat_reset_dashboard() tool for easily resetting the dashboard filters when asked by the user. (#81)

Improvements

  • Added rich tool UI support using shinychat development version and chatlas >= 0.11.1. (#67)

  • querychat's system prompt and tool descriptions were rewritten for clarity and future extensibility. (#90)

  • Tool detail cards can now be expanded or collapsed by default when querychat runs a query or updates the dashboard via the QUERYCHAT_TOOL_DETAILS environment variable. Valid values are "expanded", "collapsed", or "default". (#137)

[py] querychat v0.2.2

04 Sep 21:45
e46bc0f

Choose a tag to compare

  • Fixed another issue with data sources that aren't already narwhals DataFrames (#83)

[py] querychat v0.2.1

04 Sep 13:49
31f140d

Choose a tag to compare

  • Fixed an issue with the query tool when used with SQLAlchemy data sources. (@npelikan #79)

[py] querychat v0.2.0

02 Sep 15:40
53ee1f6

Choose a tag to compare

  • querychat.init() now accepts a client argument, replacing the previous create_chat_callback argument. (#60)

    The client can be:

    • a chatlas.Chat object,
    • a function that returns a chatlas.Chat object,
    • or a provider-model string, e.g. "openai/gpt-4.1", to be passed to chatlas.ChatAuto().

    If client is not provided, querychat will use the QUERYCHAT_CLIENT environment variable, which should be a provider-model string. If the envvar is not set, querychat uses OpenAI with the default model from chatlas.ChatOpenAI().

  • querychat.ui() now adds a .querychat class to the chat container and querychat.sidebar() adds a .querychat-sidebar class to the sidebar, allowing for easier customization via CSS. (#68)