Skip to content
Open
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
71 changes: 68 additions & 3 deletions src/uipath/agent/models/agent.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost all properties should not be optional. they are required.

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,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 @@ -397,12 +399,75 @@ class AgentIntegrationToolProperties(BaseResourceProperties):
)


class AgentInternalToolProperties(BaseResourceProperties):
"""Agent internal tool properties model."""
class AgentInternalDeepRagSettings(BaseCfg):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be sub class based on context_type value (Annotated/Union)

"""Agent internal DeepRAG tool settings model."""

context_type: str = Field(..., alias="contextType")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be an enum

index_name: Optional[str] = Field(None, alias="indexName")
folder_path: Optional[str] = Field(None, alias="folderPath")
Comment on lines +406 to +407

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not supporting deeprag with index mode as internal tool atm. only JIT/Attachments for now for DeepRAG Internal tool

query: Optional[AgentContextQuerySetting] = Field(None)
folder_path_prefix: Optional[AgentContextQuerySetting] = Field(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FolderPathPrefixSettings

None, alias="folderPathPrefix"
)
citation_mode: Optional[AgentContextValueSetting] = Field(
None, alias="citationMode"
)
file_extension: Optional[AgentContextValueSetting] = Field(
None, alias="fileExtension"
)
Comment on lines +412 to +417

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AgentContextValueSetting has Any type for value. Do not use Any anywhere and type everything. including enums (string or int).



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

context_type: str = Field(..., alias="contextType")
index_name: Optional[str] = Field(None, alias="indexName")
folder_path: Optional[str] = Field(None, alias="folderPath")
Comment on lines +420 to +425

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments as above

query: Optional[str] = Field(None)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not string. it should be a model with variant and value and description

folder_path_prefix: Optional[str] = Field(None, alias="folderPathPrefix")
file_extension: Optional[str] = Field(None, alias="fileExtension")
use_web_search_grounding: bool = Field(
default=False, alias="useWebSearchGrounding"
)
output_columns: Optional[List[AgentContextOutputColumn]] = Field(
None, alias="outputColumns"
)


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 BatchTransform 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 AgentIntegrationToolResourceConfig(BaseAgentToolResourceConfig):
Expand Down
Loading