Skip to content

Commit a31bd4e

Browse files
committed
feat(chat): add keys to bridge
Made-with: Cursor
2 parents 6bf8978 + 40de0d3 commit a31bd4e

File tree

25 files changed

+1436
-103
lines changed

25 files changed

+1436
-103
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[project]
22
name = "uipath"
3-
version = "2.9.9"
3+
version = "2.10.1"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"
77
dependencies = [
88
"uipath-core>=0.5.2, <0.6.0",
99
"uipath-runtime>=0.9.1, <0.10.0",
10-
"uipath-platform>=0.0.2, <0.1.0",
10+
"uipath-platform>=0.0.4, <0.1.0",
1111
"click>=8.3.1",
1212
"httpx>=0.28.1",
1313
"pyjwt>=2.10.1",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"version": "1.0",
3+
"id": "EvalLevelExpectedOutputLLMJudgeSet",
4+
"name": "Evaluation-Level expectedOutput with LLM Judge",
5+
"evaluatorRefs": [
6+
"ExactMatchEvaluator",
7+
"LLMJudgeOutputEvaluator"
8+
],
9+
"evaluations": [
10+
{
11+
"id": "eval-level-llm-judge-add",
12+
"name": "LLM Judge uses eval-level expectedOutput (addition)",
13+
"inputs": {
14+
"a": 3,
15+
"b": 7,
16+
"operator": "+"
17+
},
18+
"expectedOutput": {
19+
"result": 10.0
20+
},
21+
"expectedAgentBehavior": "The agent should correctly add the two numbers and return the result.",
22+
"evaluationCriterias": {
23+
"ExactMatchEvaluator": null,
24+
"LLMJudgeOutputEvaluator": null
25+
}
26+
},
27+
{
28+
"id": "eval-level-llm-judge-multiply",
29+
"name": "LLM Judge uses eval-level expectedOutput (multiplication)",
30+
"inputs": {
31+
"a": 6,
32+
"b": 8,
33+
"operator": "*"
34+
},
35+
"expectedOutput": {
36+
"result": 48.0
37+
},
38+
"expectedAgentBehavior": "The agent should correctly multiply the two numbers and return the result.",
39+
"evaluationCriterias": {
40+
"ExactMatchEvaluator": null,
41+
"LLMJudgeOutputEvaluator": null
42+
}
43+
}
44+
]
45+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"version": "1.0",
3+
"id": "EvalLevelExpectedOutputSet",
4+
"name": "Evaluation-Level expectedOutput Tests",
5+
"evaluatorRefs": [
6+
"ExactMatchEvaluator",
7+
"JsonSimilarityEvaluator",
8+
"ContainsEvaluator"
9+
],
10+
"evaluations": [
11+
{
12+
"id": "eval-level-null-criteria-add",
13+
"name": "Eval-level expectedOutput with null criteria (addition)",
14+
"inputs": {
15+
"a": 2,
16+
"b": 3,
17+
"operator": "+"
18+
},
19+
"expectedOutput": {
20+
"result": 5.0
21+
},
22+
"evaluationCriterias": {
23+
"ExactMatchEvaluator": null,
24+
"JsonSimilarityEvaluator": null,
25+
"ContainsEvaluator": {
26+
"searchText": "5"
27+
}
28+
}
29+
},
30+
{
31+
"id": "eval-level-null-criteria-multiply",
32+
"name": "Eval-level expectedOutput with null criteria (multiplication)",
33+
"inputs": {
34+
"a": 4,
35+
"b": 5,
36+
"operator": "*"
37+
},
38+
"expectedOutput": {
39+
"result": 20.0
40+
},
41+
"evaluationCriterias": {
42+
"ExactMatchEvaluator": null,
43+
"JsonSimilarityEvaluator": null,
44+
"ContainsEvaluator": {
45+
"searchText": "20"
46+
}
47+
}
48+
},
49+
{
50+
"id": "eval-level-per-evaluator-override",
51+
"name": "Per-evaluator expectedOutput overrides eval-level",
52+
"inputs": {
53+
"a": 10,
54+
"b": 5,
55+
"operator": "-"
56+
},
57+
"expectedOutput": {
58+
"result": 5.0
59+
},
60+
"evaluationCriterias": {
61+
"ExactMatchEvaluator": {
62+
"expectedOutput": {
63+
"result": 5.0
64+
}
65+
},
66+
"JsonSimilarityEvaluator": {
67+
"expectedOutput": {
68+
"result": 5.0
69+
}
70+
},
71+
"ContainsEvaluator": {
72+
"searchText": "5"
73+
}
74+
}
75+
},
76+
{
77+
"id": "eval-level-mixed-null-and-explicit",
78+
"name": "Mixed: some evaluators null, some explicit",
79+
"inputs": {
80+
"a": 7,
81+
"b": 3,
82+
"operator": "+"
83+
},
84+
"expectedOutput": {
85+
"result": 10.0
86+
},
87+
"evaluationCriterias": {
88+
"ExactMatchEvaluator": null,
89+
"JsonSimilarityEvaluator": {
90+
"expectedOutput": {
91+
"result": 10.0
92+
}
93+
},
94+
"ContainsEvaluator": {
95+
"searchText": "10"
96+
}
97+
}
98+
}
99+
]
100+
}

src/uipath/_cli/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
from uipath._utils._logs import setup_logging
1010
from uipath._utils.constants import DOTENV_FILE
1111

12+
# Windows console uses codepages (e.g. cp1252) that can't encode Unicode
13+
# characters used by Rich spinners (Braille) and emoji output.
14+
# When piped (not a TTY), keep the system encoding so the parent process
15+
# can decode our output, but use errors="replace" to avoid write-side crashes.
16+
if sys.platform == "win32":
17+
for _stream in (sys.stdout, sys.stderr):
18+
if hasattr(_stream, "reconfigure"):
19+
if _stream.isatty():
20+
_stream.reconfigure(encoding="utf-8")
21+
else:
22+
_stream.reconfigure(errors="replace")
1223
# DO NOT ADD HEAVY IMPORTS HERE
1324
#
1425
# Every import at the top of this file runs on EVERY command.

src/uipath/_cli/_chat/_bridge.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
from typing import Any
99
from urllib.parse import urlencode, urlparse
1010

11+
from uipath._utils.constants import (
12+
ENV_FOLDER_KEY,
13+
ENV_JOB_KEY,
14+
)
1115
from uipath.core.chat import (
1216
UiPathConversationEvent,
1317
UiPathConversationExchangeEndEvent,
@@ -18,10 +22,6 @@
1822
UiPathConversationToolCallConfirmationInterruptStartEvent,
1923
UiPathConversationToolCallConfirmationValue,
2024
)
21-
from uipath._utils.constants import (
22-
ENV_FOLDER_KEY,
23-
ENV_JOB_KEY,
24-
)
2525
from uipath.core.triggers import UiPathResumeTrigger
2626
from uipath.runtime.chat import UiPathChatProtocol
2727
from uipath.runtime.context import UiPathRuntimeContext

src/uipath/_cli/cli_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ async def initialize() -> list[UiPathRuntimeSchema]:
369369

370370
if not entrypoints:
371371
console.warning(
372-
'No function entrypoints found. Add them to `uipath.json` under "functions": {"my_function": "src/main.py:main"}'
372+
'No entrypoints found. Add them to `uipath.json` under "functions" or "agents": {"my_function": "src/main.py:main"}'
373373
)
374374

375375
# Gather schemas from all discovered runtimes

src/uipath/_cli/models/uipath_json_schema.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ class UiPathJsonConfig(BaseModelWithDefaultConfig):
8989
"Each key is an entrypoint name, and each value is a path in format 'file_path:function_name'",
9090
)
9191

92+
agents: dict[str, str] = Field(
93+
default_factory=dict,
94+
description="Entrypoint definitions for agent scripts. "
95+
"Each key is an entrypoint name, and each value is a path in format 'file_path:agent_name'",
96+
)
97+
9298
def to_json_string(self, indent: int = 2) -> str:
9399
"""Export to JSON string with proper formatting."""
94100
return self.model_dump_json(
@@ -110,6 +116,7 @@ def create_default(cls) -> "UiPathJsonConfig":
110116
include_uv_lock=True,
111117
),
112118
functions={},
119+
agents={},
113120
)
114121

115122
@classmethod

src/uipath/agent/models/agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ class AgentContextSettings(BaseCfg):
361361
query: AgentContextQuerySetting = Field(
362362
default_factory=lambda: AgentContextQuerySetting(variant="dynamic")
363363
)
364-
folder_path_prefix: Optional[Union[Dict[str, Any], AgentContextValueSetting]] = (
365-
Field(None, alias="folderPathPrefix")
364+
folder_path_prefix: Optional[AgentContextQuerySetting] = Field(
365+
None, alias="folderPathPrefix"
366366
)
367-
file_extension: Optional[Union[Dict[str, Any], AgentContextValueSetting]] = Field(
367+
file_extension: Optional[AgentContextValueSetting] = Field(
368368
None, alias="fileExtension"
369369
)
370370
citation_mode: Optional[AgentContextValueSetting] = Field(

src/uipath/agent/react/conversational_prompts.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,26 @@ class PromptUserSettings(BaseModel):
8383
- Any information drawn from Context Grounding documents.
8484
8585
CITATION FORMAT (self-closing tag after each sentence with cited information):
86-
<uip:cite title="Document Title" reference="https://url" page_number="1"/>
86+
- Web results: <uip:cite title="Document Title" url="https://url"/>
87+
- Context Grounding: <uip:cite title="Document Title" reference="https://url" page_number="1"/>
8788
8889
TOOL RESULT PATTERNS REQUIRING CITATION:
8990
Tool results containing these fields indicate citable sources:
90-
- Web results: "url", "title" fields -> use title and url attributes
91-
- Context Grounding: objects with "reference", "source", "page_number" -> use title (from source), reference, page_number attributes
91+
- Web results: "url", "title" fields -> use url, title attributes
92+
- Context Grounding: objects with "reference", "source", "page_number" -> use reference, title (from source), page_number attributes
9293
9394
RULES:
9495
- Place citation tag immediately after the sentence containing the cited fact
9596
- title attribute is required (truncate to 48 chars if needed)
9697
- For web results: use title and url attributes
9798
- For context grounding: use title, reference, and page_number attributes
9899
- Never include citations in tool inputs
100+
- Do not mix attributes between citation types: web results use only title/url, context grounding uses only title/reference/page_number
101+
- Do not add a space before the citation tag
99102
100103
EXAMPLES OF CORRECT USAGE:
101-
AI adoption is growing rapidly. <uip:cite title="Industry Study" url="https://example.com/study"/>
102-
The procedure requires manager approval. <uip:cite title="Policy Manual v2.pdf" reference="https://docs.example.com/ref" page_number="15"/>
104+
AI adoption is growing rapidly.<uip:cite title="Industry Study" url="https://example.com/study"/>
105+
The procedure requires manager approval.<uip:cite title="Policy Manual v2.pdf" reference="https://docs.example.com/ref" page_number="15"/>
103106
104107
CRITICAL ERRORS TO AVOID:
105108
<uip:cite/> (missing attributes)

src/uipath/eval/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def migrate_evaluation_item(
152152
evaluation.conversational_inputs
153153
)
154154
evaluation.inputs["messages"] = [
155-
message.model_dump(by_alias=True)
155+
message.model_dump(by_alias=True, exclude_none=True)
156156
for message in conversational_messages_input
157157
]
158158

@@ -163,7 +163,7 @@ def migrate_evaluation_item(
163163
evaluation.expected_output[
164164
"uipath__agent_response_messages"
165165
] = [
166-
message.model_dump(by_alias=True)
166+
message.model_dump(by_alias=True, exclude_none=True)
167167
for message in conversational_messages_expected_output
168168
]
169169

0 commit comments

Comments
 (0)