Skip to content
Merged
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"
version = "2.6.31"
version = "2.6.32"
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
122 changes: 116 additions & 6 deletions src/uipath/agent/models/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class AgentInternalToolType(str, Enum):
"""Agent internal tool type enumeration."""

ANALYZE_FILES = "analyze-attachments"
DEEP_RAG = "deep-rag"
BATCH_TRANSFORM = "batch-transform"


class AgentEscalationRecipientType(str, Enum):
Expand Down Expand Up @@ -120,6 +122,33 @@ class TextTokenType(str, Enum):
EXPRESSION = "expression"


class CitationMode(str, Enum):
"""Citation mode enumeration."""

INLINE = "Inline"
SKIP = "Skip"


class DeepRagFileExtension(str, Enum):
"""File extension enumeration for DeepRAG."""

PDF = "pdf"
TXT = "txt"


class BatchTransformFileExtension(str, Enum):
"""File extension enumeration for Batch Transform."""

CSV = "csv"


class BatchTransformWebSearchGrounding(str, Enum):
"""Batch Transform web search grounding enumeration."""

ENABLED = "Enabled"
DISABLED = "Disabled"


class BaseCfg(BaseModel):
"""Base configuration model with common settings."""

Expand Down Expand Up @@ -236,9 +265,9 @@ class AgentUnknownResourceConfig(BaseAgentResourceConfig):
class AgentContextQuerySetting(BaseCfg):
"""Agent context query setting model."""

value: str | None = Field(None)
description: str | None = Field(None)
variant: str | None = Field(None)
value: str | None = Field(default=None)
description: str | None = Field(default=None)
variant: str | None = Field(default=None)


class AgentContextValueSetting(BaseCfg):
Expand All @@ -247,6 +276,30 @@ class AgentContextValueSetting(BaseCfg):
value: Any = Field(...)


class DeepRagCitationModeSetting(BaseCfg):
"""DeepRAG citation mode setting model."""

value: CitationMode = Field(...)


class DeepRagFileExtensionSetting(BaseCfg):
"""DeepRAG file extension setting model."""

value: DeepRagFileExtension = Field(...)


class BatchTransformFileExtensionSetting(BaseCfg):
"""Batch Transform file extension setting model."""

value: BatchTransformFileExtension = Field(...)


class BatchTransformWebSearchGroundingSetting(BaseCfg):
"""DeepRAG file extension setting model."""

value: BatchTransformWebSearchGrounding = Field(...)


class AgentContextOutputColumn(BaseCfg):
"""Agent context output column model."""

Expand Down Expand Up @@ -607,11 +660,68 @@ class AgentIntegrationToolProperties(BaseResourceProperties):
)


class AgentInternalToolProperties(BaseResourceProperties):
"""Agent internal tool properties model."""
class AgentInternalAnalyzeFilesToolProperties(BaseResourceProperties):
"""Agent internal analyze files tool properties model."""

tool_type: Literal[AgentInternalToolType.ANALYZE_FILES] = Field(
..., alias="toolType"
alias="toolType", default=AgentInternalToolType.ANALYZE_FILES, frozen=True
)


class AgentInternalDeepRagToolProperties(BaseResourceProperties):
"""Agent internal DeepRAG tool properties model."""

tool_type: Literal[AgentInternalToolType.DEEP_RAG] = Field(
alias="toolType", default=AgentInternalToolType.DEEP_RAG, frozen=True
)
settings: AgentInternalDeepRagSettings = Field(..., alias="settings")


class AgentInternalBatchTransformToolProperties(BaseResourceProperties):
"""Agent internal Batch Tranform tool properties model."""

tool_type: Literal[AgentInternalToolType.BATCH_TRANSFORM] = Field(
alias="toolType", default=AgentInternalToolType.BATCH_TRANSFORM, frozen=True
)
settings: AgentInternalBatchTransformSettings = Field(..., alias="settings")


AgentInternalToolProperties = Annotated[
Union[
AgentInternalAnalyzeFilesToolProperties,
AgentInternalDeepRagToolProperties,
AgentInternalBatchTransformToolProperties,
],
Field(discriminator="tool_type"),
]


class AgentInternalDeepRagSettings(BaseCfg):
"""Agent internal DeepRAG tool settings model."""

context_type: str = Field(..., alias="contextType")
query: AgentContextQuerySetting = Field(...)
folder_path_prefix: AgentContextQuerySetting | None = Field(
default=None, alias="folderPathPrefix"
)
citation_mode: DeepRagCitationModeSetting = Field(..., alias="citationMode")
file_extension: DeepRagFileExtensionSetting = Field(..., alias="fileExtension")


class AgentInternalBatchTransformSettings(BaseCfg):
"""Agent internal Batch Transform tool settings model."""

context_type: str = Field(..., alias="contextType")
query: AgentContextQuerySetting = Field(...)
folder_path_prefix: AgentContextQuerySetting | None = Field(
default=None, alias="folderPathPrefix"
)
file_extension: BatchTransformFileExtensionSetting = Field(
..., alias="fileExtension"
)
output_columns: List[AgentContextOutputColumn] = Field(..., alias="outputColumns")
web_search_grounding: BatchTransformWebSearchGroundingSetting = Field(
..., alias="webSearchGrounding"
)


Expand Down
22 changes: 20 additions & 2 deletions src/uipath/platform/common/interrupt_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,21 @@ class CreateDeepRag(BaseModel):
"""Model representing a Deep RAG task creation."""

name: str
index_name: Annotated[str, Field(max_length=512)]
index_name: Annotated[str, Field(max_length=512)] | None = None
index_id: Annotated[str, Field(max_length=512)] | None = None
prompt: Annotated[str, Field(max_length=250000)]
glob_pattern: Annotated[str, Field(max_length=512, default="*")] = "**"
citation_mode: CitationMode = CitationMode.SKIP
index_folder_key: str | None = None
index_folder_path: str | None = None
is_ephemeral_index: bool | None = None

@model_validator(mode="after")
def validate_ephemeral_index_requires_index_id(self) -> "CreateDeepRag":
"""Validate that if it is an ephemeral index that it is using index id."""
if self.is_ephemeral_index is True and self.index_id is None:
raise ValueError("Index id must be provided for an ephemeral index")
return self


class WaitDeepRag(BaseModel):
Expand Down Expand Up @@ -120,7 +129,8 @@ class CreateBatchTransform(BaseModel):
"""Model representing a Batch Transform task creation."""

name: str
index_name: str
index_name: str | None = None
index_id: Annotated[str, Field(max_length=512)] | None = None
prompt: Annotated[str, Field(max_length=250000)]
output_columns: list[BatchTransformOutputColumn]
storage_bucket_folder_path_prefix: Annotated[str | None, Field(max_length=512)] = (
Expand All @@ -130,6 +140,14 @@ class CreateBatchTransform(BaseModel):
destination_path: str
index_folder_key: str | None = None
index_folder_path: str | None = None
is_ephemeral_index: bool | None = None

@model_validator(mode="after")
def validate_ephemeral_index_requires_index_id(self) -> "CreateBatchTransform":
"""Validate that if it is an ephemeral index that it is using index id."""
if self.is_ephemeral_index is True and self.index_id is None:
raise ValueError("Index id must be provided for an ephemeral index")
return self


class WaitBatchTransform(BaseModel):
Expand Down
Loading
Loading