Skip to content

Commit 67ed93d

Browse files
feat: add generic chat interrupts
1 parent d3b8271 commit 67ed93d

2 files changed

Lines changed: 31 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.8.31"
3+
version = "2.8.32"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/_cli/_chat/_bridge.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
from typing import Any
99
from urllib.parse import urlparse
1010

11+
from pydantic import ValidationError
12+
1113
from uipath.core.chat import (
1214
UiPathConversationEvent,
1315
UiPathConversationExchangeEndEvent,
1416
UiPathConversationExchangeEvent,
17+
UiPathConversationGenericInterruptStartEvent,
1518
UiPathConversationInterruptEndEvent,
1619
UiPathConversationInterruptEvent,
1720
UiPathConversationMessageEvent,
@@ -264,6 +267,32 @@ async def emit_interrupt_event(self, resume_trigger: UiPathResumeTrigger):
264267
"Cannot emit interrupt event: api_resume is None"
265268
)
266269

270+
# Try to parse as tool call confirmation first
271+
try:
272+
start_event = UiPathConversationToolCallConfirmationInterruptStartEvent(
273+
type="uipath_cas_tool_call_confirmation",
274+
value=UiPathConversationToolCallConfirmationValue(
275+
**resume_trigger.api_resume.request
276+
),
277+
)
278+
except Exception:
279+
logger.info(
280+
"Failed to parse as tool call confirmation, using generic interrupt"
281+
)
282+
283+
# Wrap request in JSON if it's not already a dict
284+
request_value = resume_trigger.api_resume.request
285+
if not isinstance(request_value, dict):
286+
request_value = {"value": request_value}
287+
288+
# Extract type from request
289+
interrupt_type = request_value.get("type", "uipath_cas_generic")
290+
291+
start_event = UiPathConversationGenericInterruptStartEvent(
292+
type=interrupt_type,
293+
value=request_value,
294+
)
295+
267296
interrupt_event = UiPathConversationEvent(
268297
conversation_id=self.conversation_id,
269298
exchange=UiPathConversationExchangeEvent(
@@ -272,12 +301,7 @@ async def emit_interrupt_event(self, resume_trigger: UiPathResumeTrigger):
272301
message_id=self._current_message_id,
273302
interrupt=UiPathConversationInterruptEvent(
274303
interrupt_id=self._interrupt_id,
275-
start=UiPathConversationToolCallConfirmationInterruptStartEvent(
276-
type="uipath_cas_tool_call_confirmation",
277-
value=UiPathConversationToolCallConfirmationValue(
278-
**resume_trigger.api_resume.request
279-
),
280-
),
304+
start=start_event,
281305
),
282306
),
283307
),

0 commit comments

Comments
 (0)