Skip to content

Commit 8ec1f77

Browse files
chore: test well-known interrupt model for chat
1 parent 485957d commit 8ec1f77

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/uipath/_cli/_chat/_bridge.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
"""Chat bridge implementations for conversational agents."""
22

33
import asyncio
4+
import datetime
45
import json
56
import logging
67
import os
78
import uuid
9+
from datetime import timezone
810
from typing import Any
911
from urllib.parse import urlparse
1012

@@ -14,7 +16,7 @@
1416
UiPathConversationExchangeEvent,
1517
UiPathConversationInterruptEvent,
1618
UiPathConversationInterruptStartEvent,
17-
UiPathConversationMessageEvent,
19+
UiPathConversationMessageEvent, UiPathConversationMessageStartEvent,
1820
)
1921
from uipath.runtime import UiPathRuntimeResult
2022
from uipath.runtime.chat import UiPathChatProtocol
@@ -244,17 +246,26 @@ async def emit_interrupt_event(self, runtime_result: UiPathRuntimeResult):
244246
try:
245247
self._interrupt_id = str(uuid.uuid4())
246248

249+
value = {
250+
"toolCallId": str(uuid.uuid4()),
251+
"toolName": "test-tool",
252+
"inputSchema": {"type": "object", "properties": {"test-property": {"type":"string"}}},
253+
"inputValue": {"test-property": "test-input-value"},
254+
}
255+
247256
interrupt_event = UiPathConversationEvent(
248257
conversation_id=self.conversation_id,
249258
exchange=UiPathConversationExchangeEvent(
250259
exchange_id=self.exchange_id,
251260
message=UiPathConversationMessageEvent(
252-
message_id=self._current_message_id,
261+
start=UiPathConversationMessageStartEvent(
262+
role="assistant", timestamp= (datetime.now(timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z"))),
263+
message_id=str(uuid.uuid4()),
253264
interrupt=UiPathConversationInterruptEvent(
254265
interrupt_id=self._interrupt_id,
255266
start=UiPathConversationInterruptStartEvent(
256-
type="coded-agent-interrupt",
257-
value=runtime_result.output,
267+
type="uipath_cas_tool_call_confirmation",
268+
value=value,
258269
),
259270
),
260271
),
@@ -278,6 +289,7 @@ async def wait_for_resume(self) -> dict[str, Any]:
278289
Returns:
279290
Resume data from the interrupt end event
280291
"""
292+
#return {"decisions": [{"type": "approve"}]}
281293
return {}
282294

283295
@property

0 commit comments

Comments
 (0)