proscenium 0.0.11__py3-none-any.whl → 0.0.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,9 +24,12 @@ def props(console: Optional[Console]) -> List[Prop]:
24
24
 
25
25
  class Admin(Character):
26
26
 
27
- def __init__(self, admin_channel_id: str):
28
- super().__init__(admin_channel_id)
29
- self.admin_channel_id = admin_channel_id
27
+ def __init__(self, channel_id: str, channel: str):
28
+ super().__init__(channel_id)
29
+ self.channel_id = channel_id
30
+ self.channel = channel
31
+
32
+ log.info("Admin handler started %s %s.", self.channel, self.channel_id)
30
33
 
31
34
  def wants_to_handle(self, channel_id: str, speaker_id: str, utterance: str) -> bool:
32
35
  return False
proscenium/bin/bot.py CHANGED
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
+ import typer
4
+ import time
3
5
  import os
4
6
  import sys
5
7
  import logging
6
- import typer
7
8
  from pathlib import Path
8
9
  from rich.console import Console
9
10
 
10
11
  from proscenium.verbs.display import header
11
12
  from proscenium.bin import production_from_config
12
- from proscenium.interfaces.slack import slack_main
13
+ from proscenium.interfaces.slack import SlackProductionProcessor
13
14
 
14
15
  logging.basicConfig(
15
16
  stream=sys.stdout,
@@ -52,7 +53,20 @@ def start(
52
53
  production.prepare_props()
53
54
  console.print("Props are up-to-date.")
54
55
 
55
- slack_main(production, config, console)
56
+ slack_admin_channel = config.get("slack", {}).get("admin_channel", None)
57
+ slack_production_processor = SlackProductionProcessor(
58
+ production,
59
+ slack_admin_channel,
60
+ console,
61
+ )
62
+
63
+ try:
64
+ while True:
65
+ time.sleep(1)
66
+ except KeyboardInterrupt:
67
+ console.print("Exiting...")
68
+
69
+ slack_production_processor.shutdown()
56
70
 
57
71
 
58
72
  if __name__ == "__main__":
@@ -1,7 +1,7 @@
1
1
  from typing import Callable
2
2
  from typing import Generator
3
+ from typing import Optional
3
4
 
4
- import time
5
5
  import logging
6
6
  import os
7
7
  from rich.console import Console
@@ -11,7 +11,6 @@ from slack_sdk.web import WebClient
11
11
  from slack_sdk.socket_mode import SocketModeClient
12
12
  from slack_sdk.socket_mode.request import SocketModeRequest
13
13
  from slack_sdk.socket_mode.response import SocketModeResponse
14
- from slack_sdk.socket_mode.listeners import SocketModeRequestListener
15
14
 
16
15
  from proscenium.core import Production
17
16
  from proscenium.core import Character
@@ -187,7 +186,7 @@ def channel_table(channels_by_id) -> Table:
187
186
  return channel_table
188
187
 
189
188
 
190
- def bot_user_id(socket_mode_client: SocketModeClient, console: Console):
189
+ def bot_user_id(socket_mode_client: SocketModeClient, console: Console) -> str:
191
190
 
192
191
  auth_response = socket_mode_client.web_client.auth_test()
193
192
 
@@ -239,113 +238,81 @@ Curtain up.
239
238
  )
240
239
 
241
240
 
242
- def listen(
243
- socket_mode_client: SocketModeClient,
244
- slack_listener: SocketModeRequestListener,
245
- user_id: str,
246
- console: Console,
247
- ):
248
- socket_mode_client.socket_mode_request_listeners.append(slack_listener)
249
-
250
- try:
251
- while True:
252
- time.sleep(1)
253
- except KeyboardInterrupt:
254
- console.print("Exiting...")
255
-
256
-
257
- def send_curtain_down(
258
- socket_mode_client: SocketModeClient, slack_admin_channel_id: str
259
- ) -> None:
260
- socket_mode_client.web_client.chat_postMessage(
261
- channel=slack_admin_channel_id,
262
- text="""Curtain down. We hope you enjoyed the show!""",
263
- )
264
-
265
-
266
- def shutdown(
267
- socket_mode_client: SocketModeClient,
268
- slack_listener: SocketModeRequestListener,
269
- user_id: str,
270
- production: Production,
271
- console: Console,
272
- ):
273
-
274
- socket_mode_client.socket_mode_request_listeners.remove(slack_listener)
275
- socket_mode_client.disconnect()
276
- console.print("Disconnected from Slack.")
277
-
278
- production.curtain()
279
-
280
- console.print("Handlers stopped.")
281
-
282
-
283
- def slack_main(
284
- production: Production,
285
- config: dict,
286
- console: Console,
287
- ) -> None:
288
-
289
- slack_app_token, slack_bot_token = get_slack_auth()
290
-
291
- socket_mode_client = connect(slack_app_token, slack_bot_token)
292
-
293
- user_id = bot_user_id(socket_mode_client, console)
294
- console.print()
295
-
296
- channels_by_id, channel_name_to_id = channel_maps(socket_mode_client)
297
- console.print(channel_table(channels_by_id))
298
- console.print()
299
-
300
- slack_admin_channel = config.get("slack", {}).get("admin_channel", None)
301
-
302
- if slack_admin_channel is None:
303
- raise ValueError(
304
- "slack.admin_channel is not set. "
305
- "Please set it to the channel name of the Proscenium admin channel."
306
- )
307
- slack_admin_channel_id = channel_name_to_id.get(slack_admin_channel, None)
308
- if slack_admin_channel_id is None:
309
- raise ValueError(
310
- f"Admin channel {slack_admin_channel} not found in subscribed channels."
241
+ class SlackProductionProcessor:
242
+
243
+ def __init__(
244
+ self,
245
+ production: Production,
246
+ slack_admin_channel: str,
247
+ console: Optional[Console] = None,
248
+ event_log: Optional[list[tuple[str, str]]] = None,
249
+ ):
250
+ self.production = production
251
+ self.console = console
252
+ self.event_log = event_log
253
+
254
+ slack_app_token, slack_bot_token = get_slack_auth()
255
+
256
+ self.socket_mode_client = connect(slack_app_token, slack_bot_token)
257
+
258
+ user_id = bot_user_id(self.socket_mode_client, console)
259
+ console.print()
260
+
261
+ channels_by_id, channel_name_to_id = channel_maps(self.socket_mode_client)
262
+ console.print(channel_table(channels_by_id))
263
+ console.print()
264
+
265
+ if slack_admin_channel is None:
266
+ raise ValueError(
267
+ "slack.admin_channel is not set. "
268
+ "Please set it to the channel name of the Proscenium admin channel."
269
+ )
270
+ slack_admin_channel_id = channel_name_to_id.get(slack_admin_channel, None)
271
+ if slack_admin_channel_id is None:
272
+ raise ValueError(
273
+ f"Admin channel {slack_admin_channel} not found in subscribed channels."
274
+ )
275
+
276
+ self.admin = Admin(slack_admin_channel_id, slack_admin_channel)
277
+
278
+ log.info("Places, please!")
279
+ channel_id_to_character = production.places(channel_name_to_id)
280
+ channel_id_to_character[slack_admin_channel_id] = self.admin
281
+
282
+ console.print(places_table(channel_id_to_character, channels_by_id))
283
+ console.print()
284
+
285
+ self.slack_listener = make_slack_listener(
286
+ user_id,
287
+ slack_admin_channel_id,
288
+ channels_by_id,
289
+ channel_id_to_character,
290
+ console,
311
291
  )
312
292
 
313
- admin = Admin(slack_admin_channel_id)
314
- log.info(
315
- "Admin handler started %s %s.", slack_admin_channel, slack_admin_channel_id
316
- )
317
-
318
- log.info("Places, please!")
319
- channel_id_to_character = production.places(channel_name_to_id)
320
- channel_id_to_character[slack_admin_channel_id] = admin
293
+ send_curtain_up(self.socket_mode_client, production, slack_admin_channel_id)
321
294
 
322
- console.print(places_table(channel_id_to_character, channels_by_id))
323
- console.print()
324
-
325
- slack_listener = make_slack_listener(
326
- user_id,
327
- slack_admin_channel_id,
328
- channels_by_id,
329
- channel_id_to_character,
330
- console,
331
- )
295
+ console.print("Starting the show. Listening for events...")
296
+ self.socket_mode_client.socket_mode_request_listeners.append(
297
+ self.slack_listener
298
+ )
332
299
 
333
- send_curtain_up(socket_mode_client, production, slack_admin_channel_id)
300
+ def shutdown(
301
+ self,
302
+ ):
303
+ self.socket_mode_client.web_client.chat_postMessage(
304
+ channel=self.admin.channel_id,
305
+ text="""Curtain down. We hope you enjoyed the show!""",
306
+ )
334
307
 
335
- console.print("Starting the show. Listening for events...")
336
- listen(
337
- socket_mode_client,
338
- slack_listener,
339
- user_id,
340
- console,
341
- )
308
+ self.socket_mode_client.socket_mode_request_listeners.remove(
309
+ self.slack_listener
310
+ )
311
+ self.socket_mode_client.disconnect()
312
+ if self.console is not None:
313
+ self.console.print("Disconnected from Slack.")
342
314
 
343
- send_curtain_down(socket_mode_client, slack_admin_channel_id)
315
+ self.production.curtain()
344
316
 
345
- shutdown(
346
- socket_mode_client,
347
- slack_listener,
348
- user_id,
349
- production,
350
- console,
351
- )
317
+ if self.console is not None:
318
+ self.console.print("Handlers stopped.")
@@ -48,23 +48,20 @@ from rich.panel import Panel
48
48
  from rich.table import Table
49
49
  from rich.text import Text
50
50
 
51
- from aisuite import Client
51
+ from aisuite import Client as AISuiteClient
52
52
  from aisuite.framework.message import ChatCompletionMessageToolCall
53
53
 
54
54
  from proscenium.verbs.display.tools import complete_with_tools_panel
55
55
 
56
56
  log = logging.getLogger(__name__)
57
57
 
58
- provider_configs = {
59
- # TODO expose this
60
- "ollama": {"timeout": 180},
61
- }
62
-
63
- client = Client(provider_configs=provider_configs)
64
-
65
58
 
66
59
  def complete_simple(
67
- model_id: str, system_prompt: str, user_prompt: str, **kwargs
60
+ chat_completion_client: AISuiteClient,
61
+ model_id: str,
62
+ system_prompt: str,
63
+ user_prompt: str,
64
+ **kwargs,
68
65
  ) -> str:
69
66
 
70
67
  console = kwargs.pop("console", None)
@@ -96,7 +93,7 @@ model_id: {model_id}
96
93
  )
97
94
  console.print(call_panel)
98
95
 
99
- response = client.chat.completions.create(
96
+ response = chat_completion_client.chat.completions.create(
100
97
  model=model_id, messages=messages, **kwargs
101
98
  )
102
99
  response = response.choices[0].message.content
@@ -152,6 +149,7 @@ def evaluate_tool_calls(tool_call_message, tool_map: dict) -> list[dict]:
152
149
 
153
150
 
154
151
  def complete_for_tool_applications(
152
+ chat_completion_client: AISuiteClient,
155
153
  model_id: str,
156
154
  messages: list,
157
155
  tool_desc_list: list,
@@ -169,7 +167,7 @@ def complete_for_tool_applications(
169
167
  )
170
168
  console.print(panel)
171
169
 
172
- response = client.chat.completions.create(
170
+ response = chat_completion_client.chat.completions.create(
173
171
  model=model_id,
174
172
  messages=messages,
175
173
  temperature=temperature,
@@ -180,6 +178,7 @@ def complete_for_tool_applications(
180
178
 
181
179
 
182
180
  def complete_with_tool_results(
181
+ chat_completion_client: AISuiteClient,
183
182
  model_id: str,
184
183
  messages: list,
185
184
  tool_call_message: dict,
@@ -202,7 +201,7 @@ def complete_with_tool_results(
202
201
  )
203
202
  console.print(panel)
204
203
 
205
- response = client.chat.completions.create(
204
+ response = chat_completion_client.chat.completions.create(
206
205
  model=model_id,
207
206
  messages=messages,
208
207
  )
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proscenium
3
- Version: 0.0.11
4
- Summary: Frame AI Agents
3
+ Version: 0.0.13
4
+ Summary: Declare Collaborative, Asynchronous Human To Agent Interactions
5
5
  Author-email: Adam Pingel <oss@pingel.org>
6
6
  License-Expression: Apache-2.0
7
7
  Requires-Python: >=3.11
@@ -20,11 +20,13 @@ Requires-Dist: click>=8.2.0; extra == "test"
20
20
  Requires-Dist: pytest>=8.3.5; extra == "test"
21
21
  Requires-Dist: neo4j>=5.28.1; extra == "test"
22
22
  Requires-Dist: gofannon>=0.25.13; extra == "test"
23
- Requires-Dist: lapidarist>=0.0.2; extra == "test"
23
+ Requires-Dist: lapidarist>=0.0.4; extra == "test"
24
24
  Dynamic: license-file
25
25
 
26
26
  # Proscenium
27
27
 
28
+ [![PyPI version](https://img.shields.io/pypi/v/proscenium.svg)](https://pypi.org/project/proscenium/)
29
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/proscenium)](https://pypi.org/project/proscenium/)
28
30
  [![CI](https://github.com/The-AI-Alliance/proscenium/actions/workflows/pytest.yml/badge.svg)](https://github.com/The-AI-Alliance/proscenium/actions/workflows/pytest.yml)
29
31
  [![PyPI](https://img.shields.io/pypi/v/proscenium)](https://pypi.org/project/proscenium/)
30
32
  [![License](https://img.shields.io/github/license/The-AI-Alliance/proscenium)](https://github.com/The-AI-Alliance/proscenium/tree/main?tab=Apache-2.0-1-ov-file#readme)
@@ -33,8 +35,6 @@ Dynamic: license-file
33
35
 
34
36
  Proscenium is a small, experimental library of composable glue that allows for succinct construction of enterprise AI applications. It was started in February 2025 and is still in early development.
35
37
 
36
- Currently, proscenium development prioritizes support for domains where the creation and use of structured data is critical.
37
-
38
38
  See the [website](https://the-ai-alliance.github.io/proscenium/) for quickstart info, goals, and other links.
39
39
 
40
40
  To find the Proscenium community, see the [discussions](https://github.com/The-AI-Alliance/proscenium/discussions)
@@ -1,26 +1,26 @@
1
1
  proscenium/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
2
- proscenium/admin/__init__.py,sha256=GqGrkf7NOm3inuo67xszkARXZYKDsDs2jHuZh1tF4n0,924
2
+ proscenium/admin/__init__.py,sha256=31XUp83v7oCEXTeJb-GgnIitfs2EWovr3QJOewZ0zSg,1026
3
3
  proscenium/bin/__init__.py,sha256=ThVsDG6BmnZ86gYaZLGMDcNmR6fVwBLJG3k_JawfzOY,1160
4
- proscenium/bin/bot.py,sha256=kdZBe1SGM-S3-QSN-DM-_UnGwe6W5D32s-dTuczIPCU,1358
4
+ proscenium/bin/bot.py,sha256=cuHj2-ldPXGRf75Ts_J_y4WfDgTB49iN3sNmnoKKFus,1713
5
5
  proscenium/core/__init__.py,sha256=aSUqPMn2LjZ0C_l9Tx6yqqlfCzM7oSljZxHosJyjlLU,4335
6
6
  proscenium/interfaces/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
7
- proscenium/interfaces/slack.py,sha256=wjkdhqAHgISxdNG5Pwo-8_QIyQf76X7b-0WwZfNabI8,10600
7
+ proscenium/interfaces/slack.py,sha256=zfj1D4O6ucVdw6HFnBIMGAbZUb5XK17c-57une42C48,10205
8
8
  proscenium/patterns/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
9
9
  proscenium/patterns/graph_rag.py,sha256=1HH1xdlAA6ypvYdP4dWFm-KXrGPUmm0T4qIdAU8mgvE,1763
10
10
  proscenium/patterns/rag.py,sha256=iNPL7i8zfhEGIZAI7FjAs5yKgN1iV_E-PcJiQFrm7lE,2310
11
11
  proscenium/patterns/tools.py,sha256=f2CD6f7CYiSs0Tm1Ff1sOL5Ti6DqJ5HQvMI7NmIgqNs,1740
12
12
  proscenium/util/__init__.py,sha256=FC1hjA37VvmVpF9-OlYNp9TjArH6etr6KiAvF9t_6lI,679
13
13
  proscenium/verbs/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
14
- proscenium/verbs/complete.py,sha256=Y1T49OfAV7K8p0DMzE4aVqtkgVfjUqb6IeOazzdYGow,5071
14
+ proscenium/verbs/complete.py,sha256=oRvIt6NR9yhzEHpT1BRKAmf05hVXI91v83A-7OSo-zs,5147
15
15
  proscenium/verbs/display.py,sha256=hHFmktyJtjYLi4I1-8HUfmsuoMTIxc6JFfczASBsCbI,260
16
16
  proscenium/verbs/invoke.py,sha256=-Bk7Pp0EEwRTS0MJUlViZeUNo8wxnDKJj5q78KU4CdM,339
17
17
  proscenium/verbs/remember.py,sha256=Hh9BDRAYf7MGeMD4MzU73p6Q28KrSiLWPx4GjTW1amQ,296
18
18
  proscenium/verbs/display/__init__.py,sha256=GXuvaMld8tzfJGngHdwVT-YLnuRmW2G0pMdti9Vj53s,238
19
19
  proscenium/verbs/display/chat.py,sha256=2THBUdhG3cIIVZOnJ_AMYL4nWXKFG2cuSkX6wkm48yQ,1148
20
20
  proscenium/verbs/display/tools.py,sha256=eR5g-r7MGKFZY0qg-ndkW3p0mfbupV0UaAUFqJPfnNM,1491
21
- proscenium-0.0.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
22
- proscenium-0.0.11.dist-info/METADATA,sha256=wVnK3-0GveteN4CZ4JbmD2ytWZoBu7h8JoZ28ZUdl4w,2102
23
- proscenium-0.0.11.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
24
- proscenium-0.0.11.dist-info/entry_points.txt,sha256=bbrDWv4WKIx9UROGXcyH0eo40F8SNpDQKvXxoE8BTHI,58
25
- proscenium-0.0.11.dist-info/top_level.txt,sha256=aiTgQy73e21wnSSxM5iICXmXT3zldN8cFKeXpvJ5Xx4,11
26
- proscenium-0.0.11.dist-info/RECORD,,
21
+ proscenium-0.0.13.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
22
+ proscenium-0.0.13.dist-info/METADATA,sha256=50Uqw56v2u2hdl8onbJWYfXSqPMgSdK_0Y6djW68OrA,2229
23
+ proscenium-0.0.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ proscenium-0.0.13.dist-info/entry_points.txt,sha256=bbrDWv4WKIx9UROGXcyH0eo40F8SNpDQKvXxoE8BTHI,58
25
+ proscenium-0.0.13.dist-info/top_level.txt,sha256=aiTgQy73e21wnSSxM5iICXmXT3zldN8cFKeXpvJ5Xx4,11
26
+ proscenium-0.0.13.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5