unique_toolkit 2026.30.0.dev1__py3-none-any.whl → 2026.30.0.dev3__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.
- unique_toolkit/experimental/integrations/openai/streaming/event_routing/responses/code_interpreter_event_handler.py +55 -31
- unique_toolkit/language_model/infos.py +2 -2
- {unique_toolkit-2026.30.0.dev1.dist-info → unique_toolkit-2026.30.0.dev3.dist-info}/METADATA +1 -1
- {unique_toolkit-2026.30.0.dev1.dist-info → unique_toolkit-2026.30.0.dev3.dist-info}/RECORD +5 -5
- {unique_toolkit-2026.30.0.dev1.dist-info → unique_toolkit-2026.30.0.dev3.dist-info}/WHEEL +0 -0
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"""EventHandler for code interpreter call events — pure state accumulator.
|
|
2
2
|
|
|
3
|
-
The event handler consumes OpenAI Responses code-interpreter events
|
|
4
|
-
|
|
5
|
-
progress
|
|
6
|
-
|
|
7
|
-
:class:`
|
|
3
|
+
The event handler consumes OpenAI Responses code-interpreter lifecycle events
|
|
4
|
+
(``in_progress`` / ``interpreting`` / ``completed``; ``delta`` and ``code.done``
|
|
5
|
+
carry no displayed progress and are ignored) and keeps a per-``correlation_id``
|
|
6
|
+
``(status, text)`` fingerprint to suppress duplicate progress updates; each
|
|
7
|
+
genuine transition is published as an :class:`ActivityProgressUpdate` on the
|
|
8
|
+
event-handler-owned :class:`TypedEventBus` (:attr:`activity_bus`).
|
|
9
|
+
|
|
10
|
+
Each call surfaces as two correlation ids, mirroring the orchestrator's normal
|
|
11
|
+
tool-call display: a one-shot "Triggered Tool Calls" summary published under
|
|
12
|
+
``{item_id}-triggered`` on the ``in_progress`` event, and the "Code Execution"
|
|
13
|
+
detail published under ``item_id`` on every lifecycle transition.
|
|
8
14
|
|
|
9
15
|
All SDK I/O (``MessageLog`` create/update, ``Message`` modify) lives in
|
|
10
16
|
subscribers reacting to the outer-bus :class:`ActivityProgress` event
|
|
@@ -56,8 +62,12 @@ class ResponsesCodeInterpreterEventHandler:
|
|
|
56
62
|
|
|
57
63
|
Publishes :class:`ActivityProgressUpdate` on its own
|
|
58
64
|
:class:`TypedEventBus` (accessible via :attr:`activity_bus`) for
|
|
59
|
-
every genuine state transition, deduplicated by a per-``
|
|
60
|
-
``(status, text)`` fingerprint.
|
|
65
|
+
every genuine state transition, deduplicated by a per-``correlation_id``
|
|
66
|
+
``(status, text)`` fingerprint. Lifecycle events (``in_progress`` /
|
|
67
|
+
``interpreting`` / ``completed``) drive the ``item_id`` detail update;
|
|
68
|
+
the ``in_progress`` event additionally emits a one-shot "Triggered Tool
|
|
69
|
+
Calls" summary under ``{item_id}-triggered``. ``delta`` and ``code.done``
|
|
70
|
+
events are ignored.
|
|
61
71
|
"""
|
|
62
72
|
|
|
63
73
|
def __init__(self) -> None:
|
|
@@ -70,35 +80,49 @@ class ResponsesCodeInterpreterEventHandler:
|
|
|
70
80
|
return self._activity_bus
|
|
71
81
|
|
|
72
82
|
async def on_code_interpreter_event(self, event: CodeInterpreterCallEvent) -> None:
|
|
73
|
-
"""Map one OpenAI CI event to
|
|
74
|
-
|
|
75
|
-
if
|
|
76
|
-
text_update = "Code interpreter call completed"
|
|
77
|
-
status = "COMPLETED"
|
|
78
|
-
elif isinstance(event, ResponseCodeInterpreterCallCompletedEvent):
|
|
79
|
-
text_update = "Code interpreter call completed"
|
|
80
|
-
status = "COMPLETED"
|
|
81
|
-
elif isinstance(event, ResponseCodeInterpreterCallCodeDeltaEvent):
|
|
82
|
-
text_update = "Code interpreter call in progress"
|
|
83
|
-
status = "RUNNING"
|
|
84
|
-
elif isinstance(event, ResponseCodeInterpreterCallInProgressEvent):
|
|
85
|
-
text_update = "Code interpreter call in progress"
|
|
86
|
-
status = "RUNNING"
|
|
87
|
-
else: # ResponseCodeInterpreterCallInterpretingEvent
|
|
88
|
-
text_update = "Code interpreter call interpreting"
|
|
89
|
-
status = "RUNNING"
|
|
90
|
-
|
|
91
|
-
item_id = event.item_id
|
|
92
|
-
fingerprint = (status, text_update)
|
|
93
|
-
if self._last_by_item.get(item_id) == fingerprint:
|
|
83
|
+
"""Map one OpenAI CI event to its progress update publishes."""
|
|
84
|
+
progress = self._progress_for_event(event)
|
|
85
|
+
if progress is None:
|
|
94
86
|
return
|
|
95
|
-
|
|
87
|
+
status, text_update = progress
|
|
96
88
|
|
|
89
|
+
if event.type == "response.code_interpreter_call.in_progress":
|
|
90
|
+
await self._publish_if_changed(
|
|
91
|
+
f"{event.item_id}-triggered",
|
|
92
|
+
"COMPLETED",
|
|
93
|
+
"**Triggered Tool Calls:**\n - Code Execution",
|
|
94
|
+
)
|
|
95
|
+
await self._publish_if_changed(event.item_id, status, text_update)
|
|
96
|
+
|
|
97
|
+
@staticmethod
|
|
98
|
+
def _build_code_execution_message(message: str) -> str:
|
|
99
|
+
return f"**Code Execution**\n {message}".strip()
|
|
100
|
+
|
|
101
|
+
def _progress_for_event(
|
|
102
|
+
self, event: CodeInterpreterCallEvent
|
|
103
|
+
) -> tuple[ActivityStatus, str] | None:
|
|
104
|
+
"""Decode a CI event into its ``(status, text)``, or ``None`` to ignore it."""
|
|
105
|
+
if event.type == "response.code_interpreter_call.completed":
|
|
106
|
+
return "COMPLETED", self._build_code_execution_message("")
|
|
107
|
+
if event.type == "response.code_interpreter_call.in_progress":
|
|
108
|
+
return "RUNNING", self._build_code_execution_message("Writing Code")
|
|
109
|
+
if event.type == "response.code_interpreter_call.interpreting":
|
|
110
|
+
return "RUNNING", self._build_code_execution_message("Executing Code")
|
|
111
|
+
return None
|
|
112
|
+
|
|
113
|
+
async def _publish_if_changed(
|
|
114
|
+
self, correlation_id: str, status: ActivityStatus, text: str
|
|
115
|
+
) -> None:
|
|
116
|
+
"""Publish a progress update unless its ``(status, text)`` is unchanged."""
|
|
117
|
+
fingerprint = (status, text)
|
|
118
|
+
if self._last_by_item.get(correlation_id) == fingerprint:
|
|
119
|
+
return
|
|
120
|
+
self._last_by_item[correlation_id] = fingerprint
|
|
97
121
|
await self._activity_bus.publish_and_wait_async(
|
|
98
122
|
ActivityProgressUpdate(
|
|
99
|
-
correlation_id=
|
|
123
|
+
correlation_id=correlation_id,
|
|
100
124
|
status=status,
|
|
101
|
-
text=
|
|
125
|
+
text=text,
|
|
102
126
|
)
|
|
103
127
|
)
|
|
104
128
|
|
|
@@ -2738,8 +2738,8 @@ class LanguageModelInfo(BaseModel):
|
|
|
2738
2738
|
ModelCapabilities.STREAMING,
|
|
2739
2739
|
],
|
|
2740
2740
|
token_limits=LanguageModelTokenLimits(
|
|
2741
|
-
token_limit_input=
|
|
2742
|
-
),
|
|
2741
|
+
token_limit_input=256_000, token_limit_output=128_000
|
|
2742
|
+
), # GLM-5.2 supports up to a 1_000_000 token context window. Together AI is supporting however only up to 256_000 tokens.
|
|
2743
2743
|
published_at=date(2026, 1, 1),
|
|
2744
2744
|
supported_reasoning_efforts=[],
|
|
2745
2745
|
)
|
{unique_toolkit-2026.30.0.dev1.dist-info → unique_toolkit-2026.30.0.dev3.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: unique-toolkit
|
|
3
|
-
Version: 2026.30.0.
|
|
3
|
+
Version: 2026.30.0.dev3
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Cedric Klinkert, Martin Fadler, Sadique Sheik, Fabian Schläpfer, Pascal Hauri, Ejiroghene Oki-Peter, Rami Azouz, Ricardo Visini, Sanzio Monti
|
|
6
6
|
Author-email: Cedric Klinkert <cedric.klinkert@unique.ch>, Martin Fadler <martin.fadler@unique.ch>, Sadique Sheik <sadique@unique.ch>, Fabian Schläpfer <fabian@unique.ch>, Pascal Hauri <pascal@unique.ch>, Ejiroghene Oki-Peter <oki-peter.ejiroghene@unique.ai>, Rami Azouz <rami.ext@unique.ch>, Ricardo Visini <ricardo.visini@unique.ch>, Sanzio Monti <sanzio.monti@unique.ai>
|
|
@@ -329,7 +329,7 @@ unique_toolkit/experimental/integrations/openai/streaming/event_routing/protocol
|
|
|
329
329
|
unique_toolkit/experimental/integrations/openai/streaming/event_routing/protocols/chat_completions.py,sha256=BZogC4EO6BFP-enXOJ535gUB8-US9mshRhXNDCfrs_E,1522
|
|
330
330
|
unique_toolkit/experimental/integrations/openai/streaming/event_routing/protocols/responses.py,sha256=bM5qSZjJOTWQyPDUPyMasMwZ-Wu7LQKR64OcKVpUY5E,3294
|
|
331
331
|
unique_toolkit/experimental/integrations/openai/streaming/event_routing/responses/__init__.py,sha256=-8Ey_srOpxX4B_HJhh27h4nZaNC6Y4mk5o8wSLelPwA,847
|
|
332
|
-
unique_toolkit/experimental/integrations/openai/streaming/event_routing/responses/code_interpreter_event_handler.py,sha256=
|
|
332
|
+
unique_toolkit/experimental/integrations/openai/streaming/event_routing/responses/code_interpreter_event_handler.py,sha256=3WFT-zuVCrTP01riJY9uuu5U8-tmFUD-XYTZYDrGx4w,6013
|
|
333
333
|
unique_toolkit/experimental/integrations/openai/streaming/event_routing/responses/complete_with_references.py,sha256=rVcIY7CLPJUVWJrtZDZR5RLd3MnuXbsyL-FdpXoVcjQ,26126
|
|
334
334
|
unique_toolkit/experimental/integrations/openai/streaming/event_routing/responses/completed_event_handler.py,sha256=N_ZO79XbKSHvUqQFxWsEvCc6w5kglcP4oTq-uRz5w34,1475
|
|
335
335
|
unique_toolkit/experimental/integrations/openai/streaming/event_routing/responses/stream_event_router.py,sha256=hvQHDPmfYD-ZDRR5W079TFYEgQ-vhIGMNRyagiG6RzM,8280
|
|
@@ -381,7 +381,7 @@ unique_toolkit/language_model/builder.py,sha256=KwBzsD6-fvQnB4p2I7M-5Tk6j4tmQ973
|
|
|
381
381
|
unique_toolkit/language_model/constants.py,sha256=B-topqW0r83dkC_25DeQfnPk3n53qzIHUCBS7YJ0-1U,119
|
|
382
382
|
unique_toolkit/language_model/default_language_model.py,sha256=mcyuFs_V6tp52C8xJSHiEHO4kFGj6xed1gvozvCRD7k,1181
|
|
383
383
|
unique_toolkit/language_model/functions.py,sha256=iTxCpcavUp1kAitJi16SIL33Y442aWKWH4W2qPpLfts,23054
|
|
384
|
-
unique_toolkit/language_model/infos.py,sha256=
|
|
384
|
+
unique_toolkit/language_model/infos.py,sha256=q1SLAffrJDK56xD6dgcgZ-m_0g6uO9pvYPtUx18pEGk,136590
|
|
385
385
|
unique_toolkit/language_model/prompt.py,sha256=JSawaLjQg3VR-E2fK8engFyJnNdk21zaO8pPIodzN4Q,3991
|
|
386
386
|
unique_toolkit/language_model/reference.py,sha256=T3wr2jP_uRg5wKVIbKqLbxJlcgxfbZQGq3XdjbQ2kSo,6984
|
|
387
387
|
unique_toolkit/language_model/schemas.py,sha256=JZbIT3w1cj5fKrYaQ55X7sjXmCo6i_GqgJ198V3RXSg,29474
|
|
@@ -406,6 +406,6 @@ unique_toolkit/short_term_memory/service.py,sha256=2JMBEBn6GoyK-a0xvdcWpPft-3C74
|
|
|
406
406
|
unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
407
407
|
unique_toolkit/smart_rules/compile.py,sha256=vRe0aMJWuVIK-VsqomgxQImzke7MDmwgSxxJfYCa7zw,1386
|
|
408
408
|
unique_toolkit/test_utilities/events.py,sha256=FLrhMh0A_mQutAUjoD0FdMcVQ4Gq31r35OVGzRjvLro,6760
|
|
409
|
-
unique_toolkit-2026.30.0.
|
|
410
|
-
unique_toolkit-2026.30.0.
|
|
411
|
-
unique_toolkit-2026.30.0.
|
|
409
|
+
unique_toolkit-2026.30.0.dev3.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
410
|
+
unique_toolkit-2026.30.0.dev3.dist-info/METADATA,sha256=Um_hksszph6NyBJB57I6C7BbcJ60MK4xteal7vJNNm0,7426
|
|
411
|
+
unique_toolkit-2026.30.0.dev3.dist-info/RECORD,,
|
|
File without changes
|