Open
Conversation
c5c8f6e to
34a41da
Compare
34a41da to
a21712c
Compare
cpsievert
commented
Mar 3, 2026
a21712c to
05687d5
Compare
05687d5 to
8f33d70
Compare
8f33d70 to
a3bdcbd
Compare
a3bdcbd to
3e15610
Compare
3e15610 to
ac299be
Compare
1450755 to
a711326
Compare
a711326 to
8696fca
Compare
8696fca to
db264dd
Compare
db264dd to
5a7e9de
Compare
Integrate main's deferred client initialization (#207) and narwhals version constraint (#218) with the ggsql visualization feature branch. Extended _create_session_client with visualize_query parameter and updated stub session test to match eager client construction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chatlas 0.16.0 added stream_content as a new abstract method on Provider, causing DummyProvider instantiation to fail in CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shallow copy + nested attribute mutation was modifying the original chart's sub-specs through shared references, violating the function's documented contract. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
narwhals.stable.v1.from_native wraps ibis Tables as DataFrame (not LazyFrame), so the isinstance(nw_df, nw.LazyFrame) check was False and collect() was never called, causing 'IbisLazyFrame has no attribute to_polars'. Delegate to as_narwhals() which already handles ibis correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…identifiers Snowflake uppercases unquoted identifiers, causing case mismatches when ggsql validates VISUALISE column references against DuckDB results. Replace the generic casing note with explicit wrong/correct examples instructing the LLM to alias uppercase columns to lowercase in SELECT. Borrowed from ggsqlbot's proven prompt pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Snowflake uppercases all unquoted identifiers, so columns come back as AVG_INTEREST_RATE even when the LLM writes AS avg_interest_rate. Since ggsql validates VISUALISE column references case-sensitively and DuckDB is case-insensitive, lowercasing the DataFrame columns before registering ensures the LLM's lowercase references always match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gadenbuie
reviewed
Apr 17, 2026
Contributor
gadenbuie
left a comment
There was a problem hiding this comment.
Looking great! I have a few high-level comments at the design and integration layers; I did not review the Python code in detail but I scanned the changes and nothing jumped out at me in that area.
Comment on lines
+13
to
+23
| #def app_ui(request): | ||
| # return ui.page_fillable( | ||
| # qc.ui(), | ||
| # ) | ||
| # | ||
| # | ||
| #def server(input, output, session): | ||
| # qc.server(enable_bookmarking=True) | ||
| # | ||
| # | ||
| #app = App(app_ui, server, bookmark_store="url") |
Contributor
There was a problem hiding this comment.
Is this left here intentionally?
Contributor
Author
There was a problem hiding this comment.
Good catch. I had been using this for testing and forgot to make it more user facing. I've just kept it basic for now and using Shiny Express.
Adds truncate_error() in _utils to cap error strings sent to the LLM, stripping schema dumps and applying a hard character limit. Wired into all tool error catch blocks in tools.py and _viz_tools.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updates syntax guide for ggsql v0.2.4 breaking changes: rect→tile, linear merged into rule, array syntax to parentheses, updated text aesthetics. Fixes pre-existing errors (invalid position fill, nonexistent density stacking). Bumps ggsql dependency to >=0.2.4. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Addresses PR feedback that "visualize_query" sounds like it might provide a visual representation of a query rather than visualizing data. Renames across source, prompts, docs, examples, and tests: - Tool name: querychat_visualize_query → querychat_visualize - Functions: tool_visualize_query → tool_visualize - Types: VisualizeQueryData → VisualizeData, VisualizeQueryResult → VisualizeResult - Template var: has_tool_visualize_query → has_tool_visualize - Prompt file: tool-visualize-query.md → tool-visualize.md - User-facing string: "visualize_query" → "visualize" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
LLM was generating trailing commas in LABEL clauses causing parse errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restores the title + description + usage guidance convention in tool-query.md and tool-update-dashboard.md, keeping new additions like the collapsed parameter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
de20a94 to
231e3ef
Compare
Adds title/description/when-to-use/constraints to tool-visualize.md following the same convention as the other tool prompts. Removes duplicated routing and error recovery guidance from the system prompt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests now check for "Avoid redundant expanded results" instead of removed headings/content that moved to tool-visualize.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds null mapping, rect/errorbar geoms, subtitle/caption labels, lollipop/ridgeline examples, scale oob setting, and facet panel filtering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in
visualizetool to querychat's Python package, enabling LLM-generated data visualizations via ggsql. When enabled, the LLM can write ggsql queries (SQL +VISUALISEclause) that are executed and rendered as interactive Altair charts inline in the chat.Usage
Install
This installs the optional dependencies:
ggsql,altair,shinywidgets, andvl-convert-python.Example app
The
visualizetool is opt-in — include it in thetoolstuple alongside"query"and/or"update"to enable it.What it looks like
Charts render inline in the chat with a collapsible footer showing the ggsql query (with syntax highlighting), a copy button, and save options:
Key changes
visualizetool (opt-in viatools=("query", "visualize")): The LLM writes a full ggsql query, which is executed against the data source and rendered as an Altair chart._viz_ggsql.py): Uses DataSource for SQL execution (preserving database pushdown), then feeds results into ggsql for VISUALISE processing → Altair chart._viz_altair_widget.py): CustomAltairWidgetfor rendering charts directly in the chat stream, with JS/CSS assets for interactive display.docs/visualize.qmd) with examples and screenshots.