Skip to content

Commit 605ed38

Browse files
committed
Make client an attribute
1 parent a2d4156 commit 605ed38

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

pkg-py/src/querychat/_querychat.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def __init__(
140140
client2 = copy.deepcopy(client)
141141
client2.set_turns([])
142142
client2.system_prompt = prompt
143-
self._client = client2
143+
self.client = client2
144144

145145
# Populated when ._server() gets called (in an active session)
146146
self._server_values: ModServerResult | None = None
@@ -314,7 +314,7 @@ def _server(self, *, enable_bookmarking: bool = False) -> None:
314314
self.id,
315315
data_source=self._data_source,
316316
greeting=self.greeting,
317-
client=self._client,
317+
client=self.client,
318318
enable_bookmarking=enable_bookmarking,
319319
)
320320

@@ -445,28 +445,11 @@ def generate_greeting(self, *, echo: Literal["none", "output"] = "none"):
445445
The greeting string (in Markdown format).
446446
447447
"""
448-
client = copy.deepcopy(self._client)
448+
client = copy.deepcopy(self.client)
449449
client.set_turns([])
450450
prompt = "Please give me a friendly greeting. Include a few sample prompts in a two-level bulleted list."
451451
return str(client.chat(prompt, echo=echo))
452452

453-
@property
454-
def client(self):
455-
"""
456-
Obtain the underlying chat client.
457-
458-
If called before `.server()`, this returns the base client provided at
459-
initialization. If called after `.server()`, this returns the session-specific
460-
client used for the active Shiny session.
461-
462-
Returns
463-
-------
464-
:
465-
None
466-
467-
"""
468-
return self._client
469-
470453
@property
471454
def data_source(self):
472455
"""

0 commit comments

Comments
 (0)