Skip to content

Commit 25af326

Browse files
committed
chore(pkg-py): Update conventions in example apps
1 parent 2c1f24f commit 25af326

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

pkg-py/examples/app-database-sqlite.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22

33
import chatlas
4-
import querychat as qc
4+
import querychat
55
from seaborn import load_dataset
66
from shiny import App, render, ui
77
from sqlalchemy import create_engine
@@ -29,7 +29,7 @@ def use_github_models(system_prompt: str) -> chatlas.Chat:
2929
system_prompt=system_prompt,
3030
)
3131

32-
querychat_config = qc.init(
32+
qc_config = querychat.init(
3333
engine,
3434
"titanic",
3535
greeting=greeting,
@@ -40,7 +40,7 @@ def use_github_models(system_prompt: str) -> chatlas.Chat:
4040
# Create UI
4141
app_ui = ui.page_sidebar(
4242
# 2. Place the chat component in the sidebar
43-
qc.sidebar("chat"),
43+
querychat.sidebar("chat"),
4444
# Main panel with data viewer
4545
ui.card(
4646
ui.output_data_frame("data_table"),
@@ -55,13 +55,13 @@ def use_github_models(system_prompt: str) -> chatlas.Chat:
5555
# Define server logic
5656
def server(input, output, session):
5757
# 3. Initialize querychat server with the config from step 1
58-
chat = qc.server("chat", querychat_config)
58+
qc = querychat.server("chat", qc_config)
5959

6060
# 4. Display the filtered dataframe
6161
@render.data_frame
6262
def data_table():
63-
# Access filtered data via chat.df() reactive
64-
return chat["df"]()
63+
# Access filtered data via qc.df() reactive
64+
return qc.df()
6565

6666

6767
# Create Shiny app

pkg-py/examples/app-dataframe-pandas.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22

33
import chatlas
4-
import querychat as qc
4+
import querychat
55
from seaborn import load_dataset
66
from shiny import App, render, ui
77

@@ -20,7 +20,7 @@ def use_github_models(system_prompt: str) -> chatlas.Chat:
2020
system_prompt=system_prompt,
2121
)
2222

23-
querychat_config = qc.init(
23+
qc_config = querychat.init(
2424
titanic,
2525
"titanic",
2626
greeting=greeting,
@@ -31,7 +31,7 @@ def use_github_models(system_prompt: str) -> chatlas.Chat:
3131
# Create UI
3232
app_ui = ui.page_sidebar(
3333
# 2. Place the chat component in the sidebar
34-
qc.sidebar("chat"),
34+
querychat.sidebar("chat"),
3535
# Main panel with data viewer
3636
ui.card(
3737
ui.output_data_frame("data_table"),
@@ -46,13 +46,13 @@ def use_github_models(system_prompt: str) -> chatlas.Chat:
4646
# Define server logic
4747
def server(input, output, session):
4848
# 3. Initialize querychat server with the config from step 1
49-
chat = qc.server("chat", querychat_config)
49+
qc = querychat.server("chat", qc_config)
5050

5151
# 4. Display the filtered dataframe
5252
@render.data_frame
5353
def data_table():
5454
# Access filtered data via chat.df() reactive
55-
return chat.df()
55+
return qc.df()
5656

5757

5858
# Create Shiny app

pkg-py/examples/app.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from seaborn import load_dataset
33
from shiny import App, render, ui
44

5-
import querychat as qc
5+
import querychat
66

77
titanic = load_dataset("titanic")
88

@@ -20,18 +20,18 @@ def use_github_models(system_prompt: str) -> chatlas.Chat:
2020
)
2121

2222

23-
querychat_config = qc.init(
23+
qc_config = querychat.init(
2424
data_source=titanic,
2525
table_name="titanic",
2626
client=use_github_models,
2727
)
2828

2929
# Create UI
3030
app_ui = ui.page_sidebar(
31-
# 2. Use qc.sidebar(id) in a ui.page_sidebar.
32-
# Alternatively, use qc.ui(id) elsewhere if you don't want your
31+
# 2. Use querychat.sidebar(id) in a ui.page_sidebar.
32+
# Alternatively, use querychat.ui(id) elsewhere if you don't want your
3333
# chat interface to live in a sidebar.
34-
qc.sidebar("chat"),
34+
querychat.sidebar("chat"),
3535
ui.card(
3636
ui.card_header("Titanic Data"),
3737
ui.output_data_frame("data_table"),
@@ -45,13 +45,13 @@ def use_github_models(system_prompt: str) -> chatlas.Chat:
4545
# Define server logic
4646
def server(input, output, session):
4747
# 3. Create a querychat object using the config from step 1.
48-
chat = qc.server("chat", querychat_config)
48+
qc = querychat.server("chat", qc_config)
4949

5050
# 4. Use the filtered/sorted data frame anywhere you wish, via the
5151
# chat.df() reactive.
5252
@render.data_frame
5353
def data_table():
54-
return chat.df()
54+
return qc.df()
5555

5656

5757
# Create Shiny app

0 commit comments

Comments
 (0)