Skip to content

Conversation

@cpsievert
Copy link
Contributor

@cpsievert cpsievert commented Nov 12, 2025

The PR deprecates essentially the entire current (functional) API in favor of a class-based approach (namely QueryChat). The new API looks something like this:

Express

from seaborn import load_dataset
from shiny.express import render, ui
from querychat.express import QueryChat

titanic = load_dataset("titanic")

qc = QueryChat(titanic, "titanic")
qc.sidebar("chat")

with ui.card(fill=True):
    with ui.card_header():
        @render.text
        def title():
            return qc.title() or "Titanic Dataset"

    @render.data_frame
    def data_table():
        return qc.df()

Core

from seaborn import load_dataset
from shiny import App, render, ui
from querychat import QueryChat

titanic = load_dataset("titanic")

qc = QueryChat(titanic, "titanic")

app_ui = ui.page_fluid(
    qc.sidebar(),
    ui.output_data_frame("data_table"),
)

def server(input, output, session):
    qc.server()

    @render.data_frame
    def data_table():
        return qc.df()


app = App(app_ui, server)

Closes #97

TODO

  • Update reference/examples/docs (maybe in follow up PR)?

@cpsievert cpsievert changed the title feat(pkg-py): First pass at new QueryChat() API feat(pkg-py): First pass at new QueryChat() API Nov 12, 2025
@cpsievert cpsievert requested a review from Copilot November 13, 2025 16:27

This comment was marked as resolved.

Co-authored-by: Copilot <[email protected]>
@cpsievert cpsievert requested a review from gadenbuie November 13, 2025 16:35
@cpsievert cpsievert marked this pull request as ready for review November 13, 2025 16:36
gadenbuie

This comment was marked as resolved.

@cpsievert

This comment was marked as outdated.

@gadenbuie

This comment was marked as resolved.

This comment was marked as resolved.

Copy link
Contributor

@gadenbuie gadenbuie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started reviewing but have talked myself into thinking we should do a clean break API change rather than try to maintain the older functions in a deprecated state. (See #101 (comment))

@cpsievert cpsievert changed the title feat(pkg-py): First pass at new QueryChat() API feat(pkg-py): Add new QueryChat() API; hard deprecate old API Nov 14, 2025
@cpsievert cpsievert requested a review from Copilot November 14, 2025 23:20

This comment was marked as off-topic.

Copy link
Contributor

@gadenbuie gadenbuie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, very excited to see this land! Just a couple of tiny things before merging

@cpsievert cpsievert merged commit 3c2bbf8 into main Nov 18, 2025
6 checks passed
@cpsievert cpsievert deleted the feat/py-new-api branch November 18, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit Python API

3 participants