feat(pkg-py): add ggsql visualization tool#201
Merged
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
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>
- Divide height by row count for facet and concat specs (previously each cell got the full usable height, causing vertical overflow) - Handle row/column grid facets by counting distinct values per facet field from the DataFrame - Infer wrapping facet row count from data when columns is set
- Import IntoFrameT from narwhals directly instead of re-export via _datasource - Import GREETING_PROMPT from _querychat_core where it's defined and exported - Add type: ignore[arg-type] for DataFrame.__getitem__ returning Series | DataFrame - Add pyright: ignore[reportPrivateImportUsage] for dash dcc components
6 tasks
cpsievert
added a commit
that referenced
this pull request
Apr 28, 2026
Port of the Python ggsql visualization feature (#201) to the R package. Adds an opt-in `visualize` tool that enables LLM-generated data visualizations via ggsql. When enabled, the LLM writes ggsql queries (SQL + VISUALISE clause) that are executed and rendered as interactive charts inline in the chat using ggsql's native Shiny bindings.
2 tasks
cpsievert
added a commit
that referenced
this pull request
Apr 30, 2026
Port of the Python ggsql visualization feature (#201) to the R package. Adds an opt-in `visualize` tool that enables LLM-generated data visualizations via ggsql. When enabled, the LLM writes ggsql queries (SQL + VISUALISE clause) that are executed and rendered as interactive charts inline in the chat using ggsql's native Shiny bindings.
cpsievert
added a commit
that referenced
this pull request
Apr 30, 2026
Port of the Python ggsql visualization feature (#201) to the R package. Adds an opt-in `visualize` tool that enables LLM-generated data visualizations via ggsql. When enabled, the LLM writes ggsql queries (SQL + VISUALISE clause) that are executed and rendered as interactive charts inline in the chat using ggsql's native Shiny bindings.
cpsievert
added a commit
that referenced
this pull request
May 4, 2026
Add a new Visualizations vignette, a Data visualization section to the Tools vignette, a navbar entry in pkgdown, and a mention in the README, mirroring the documentation added for the Python package in PR #201.
cpsievert
added a commit
that referenced
this pull request
May 4, 2026
Add a new Visualizations vignette, a Data visualization section to the Tools vignette, a navbar entry in pkgdown, and a mention in the README, mirroring the documentation added for the Python package in PR #201.
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.