Skip to content

Commit 425bb6a

Browse files
committed
test: fix analyze-files tool tests
1 parent ffff174 commit 425bb6a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/uipath_langchain/agent/tools/internal_tools/analyze_files_tool.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,16 @@ async def tool_fn(**kwargs: Any):
205205
if not files:
206206
return {"analysisResult": "No attachments provided to analyze."}
207207

208-
client = UiPath()
208+
client: UiPath | None = None
209209
policy: dict[str, Any] | None = None
210210
try:
211+
client = UiPath()
211212
policy = await client.automation_ops.get_deployed_policy_async()
212213
except Exception:
213214
logger.exception("Failed to fetch deployed policy")
214215

215216
pii_result: PiiDetectionResponse | None = None
216-
if is_pii_policy_enabled(policy):
217+
if client is not None and is_pii_policy_enabled(policy):
217218
try:
218219
analysis_task, files, pii_result = await _apply_pii_masking(
219220
client, policy, analysis_task, files

0 commit comments

Comments
 (0)