Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-core"
version = "0.2.3"
version = "0.2.4"
description = "UiPath Core abstractions"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
10 changes: 8 additions & 2 deletions src/uipath/core/chat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@
UiPathConversationExchangeStartEvent,
)
from .interrupt import (
UiPathConversationInterruptEndEvent,
InterruptTypeEnum,
UiPathConversationGenericInterruptStart,
UiPathConversationInterruptEvent,
UiPathConversationInterruptStartEvent,
UiPathConversationToolCallConfirmationInterruptStart,
UiPathConversationToolCallConfirmationValue,
)
from .message import (
UiPathConversationMessage,
Expand Down Expand Up @@ -122,9 +125,12 @@
"UiPathConversationMessageEvent",
"UiPathConversationMessage",
# Interrupt
"InterruptTypeEnum",
"UiPathConversationInterruptStartEvent",
"UiPathConversationInterruptEndEvent",
"UiPathConversationInterruptEvent",
"UiPathConversationToolCallConfirmationValue",
"UiPathConversationToolCallConfirmationInterruptStart",
"UiPathConversationGenericInterruptStart",
# Content
"UiPathConversationContentPartChunkEvent",
"UiPathConversationContentPartStartEvent",
Expand Down
44 changes: 34 additions & 10 deletions src/uipath/core/chat/interrupt.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
"""Interrupt events for human-in-the-loop patterns."""

from typing import Any
from enum import Enum
from typing import Any, Literal, Union

from pydantic import BaseModel, ConfigDict, Field


class UiPathConversationInterruptStartEvent(BaseModel):
"""Signals the start of an interrupt - a pause point where the agent needs external input."""
class InterruptTypeEnum(str, Enum):
"""Enum of known interrupt types."""

TOOL_CALL_CONFIRMATION = "uipath_cas_tool_call_confirmation"


class UiPathConversationToolCallConfirmationValue(BaseModel):
"""Schema for tool call confirmation interrupt value."""

tool_call_id: str = Field(..., alias="toolCallId")
tool_name: str = Field(..., alias="toolName")
input_schema: Any = Field(..., alias="inputSchema")
input_value: Any | None = Field(None, alias="inputValue")

model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)


class UiPathConversationToolCallConfirmationInterruptStart(BaseModel):
"""Tool call confirmation interrupt start event with strong typing."""

type: Literal["uipath_cas_tool_call_confirmation"]
value: UiPathConversationToolCallConfirmationValue

model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)


class UiPathConversationGenericInterruptStart(BaseModel):
"""Generic interrupt start event for custom interrupt types."""

type: str
value: Any

model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)


class UiPathConversationInterruptEndEvent(BaseModel):
"""Signals the interrupt end event with the provided value."""

# Can be any type
model_config = ConfigDict(
validate_by_name=True, validate_by_alias=True, extra="allow"
)
UiPathConversationInterruptStartEvent = Union[
UiPathConversationToolCallConfirmationInterruptStart,
UiPathConversationGenericInterruptStart,
]


class UiPathConversationInterruptEvent(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.