-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprotocol.py
More file actions
56 lines (42 loc) · 1.41 KB
/
protocol.py
File metadata and controls
56 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""Abstract conversation bridge interface."""
from typing import Any, Protocol
from uipath.core.chat import (
UiPathConversationMessageEvent,
)
from uipath.core.triggers import UiPathResumeTrigger
class UiPathChatProtocol(Protocol):
"""Abstract interface for chat communication.
Implementations: WebSocket, etc.
"""
async def connect(self) -> None:
"""Establish connection to chat service."""
...
async def disconnect(self) -> None:
"""Close connection and send exchange end event."""
...
async def emit_message_event(
self, message_event: UiPathConversationMessageEvent
) -> None:
"""Wrap and send a message event.
Args:
message_event: UiPathConversationMessageEvent to wrap and send
"""
...
async def emit_interrupt_event(
self,
resume_trigger: UiPathResumeTrigger,
) -> None:
"""Wrap and send an interrupt event.
Args:
resume_trigger: UiPathResumeTrigger to wrap and send
"""
...
async def emit_exchange_end_event(self) -> None:
"""Send an exchange end event."""
...
async def emit_exchange_error_event(self, error: Exception) -> None:
"""Emit an exchange error event."""
...
async def wait_for_resume(self) -> dict[str, Any]:
"""Wait for the interrupt_end event to be received."""
...