Skip to content

Commit 87b0fc5

Browse files
committed
fix: name change nits
1 parent 4d8b645 commit 87b0fc5

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

src/uipath_langchain/agent/tools/tool_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ async def _afunc(state: AgentGraphState) -> OutputType:
291291

292292

293293
class ConversationalToolRunnableCallable(RunnableCallable):
294-
"""Preserves a reference to the underlying BaseTool for conversational HITL confirmation."""
294+
"""Preserves a reference to the underlying BaseTool for conversational tool confirmation."""
295295

296296
def __init__(self, *, func: Any, afunc: Any, name: str, tool: BaseTool):
297297
super().__init__(func=func, afunc=afunc, name=name)

src/uipath_langchain/runtime/messages.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, runtime_id: str, storage: UiPathRuntimeStorageProtocol | None
5959
self.runtime_id = runtime_id
6060
self.storage = storage
6161
self.current_message: AIMessageChunk | AIMessage
62-
self.tool_confirmation_schemas: dict[str, Any] = {}
62+
self.tools_requiring_confirmation: dict[str, Any] = {}
6363
self.seen_message_ids: set[str] = set()
6464
self._storage_lock = asyncio.Lock()
6565
self._citation_stream_processor = CitationStreamProcessor()
@@ -320,6 +320,7 @@ async def map_ai_message_chunk_to_events(
320320

321321
events: list[UiPathConversationMessageEvent] = []
322322

323+
# For every new message_id, start a new message
323324
if message.id not in self.seen_message_ids:
324325
self.current_message = message
325326
self.seen_message_ids.add(message.id)
@@ -338,6 +339,7 @@ async def map_ai_message_chunk_to_events(
338339
self._chunk_to_message_event(message.id, chunk)
339340
)
340341
case "tool_call_chunk":
342+
# Accumulate the message chunk. Note that we assume no interweaving of AIMessage and AIMessageChunks for a given message.
341343
# Skip the first chunk — it's already assigned as current_message above,
342344
# so accumulating it with itself would duplicate fields via string concat
343345
# (e.g. tool name "search_web" becomes "search_websearch_web").
@@ -431,9 +433,9 @@ async def map_current_message_to_start_tool_call_events(self):
431433

432434
tool_name = tool_call["name"]
433435
require_confirmation = (
434-
tool_name in self.tool_confirmation_schemas
436+
tool_name in self.tools_requiring_confirmation
435437
)
436-
input_schema = self.tool_confirmation_schemas.get(tool_name)
438+
input_schema = self.tools_requiring_confirmation.get(tool_name)
437439
events.append(
438440
self.map_tool_call_to_tool_call_start_event(
439441
self.current_message.id,

src/uipath_langchain/runtime/runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(
6565
self.entrypoint: str | None = entrypoint
6666
self.callbacks: list[BaseCallbackHandler] = callbacks or []
6767
self.chat = UiPathChatMessagesMapper(self.runtime_id, storage)
68-
self.chat.tool_confirmation_schemas = self._get_tool_confirmation_info()
68+
self.chat.tools_requiring_confirmation = self._get_tool_confirmation_info()
6969
self._middleware_node_names: set[str] = self._detect_middleware_nodes()
7070

7171
async def execute(

tests/runtime/test_chat_message_mapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,7 @@ async def test_confirmation_tool_has_requires_confirmation_metadata(self):
20192019
storage = create_mock_storage()
20202020
storage.get_value.return_value = {}
20212021
mapper = UiPathChatMessagesMapper("test-runtime", storage)
2022-
mapper.tool_confirmation_schemas = {"confirm_tool": {}}
2022+
mapper.tools_requiring_confirmation = {"confirm_tool": {}}
20232023

20242024
first_chunk = AIMessageChunk(
20252025
content="",
@@ -2053,7 +2053,7 @@ async def test_normal_tool_has_no_confirmation_metadata(self):
20532053
storage = create_mock_storage()
20542054
storage.get_value.return_value = {}
20552055
mapper = UiPathChatMessagesMapper("test-runtime", storage)
2056-
mapper.tool_confirmation_schemas = {"other_tool": {}}
2056+
mapper.tools_requiring_confirmation = {"other_tool": {}}
20572057

20582058
first_chunk = AIMessageChunk(
20592059
content="",
@@ -2086,7 +2086,7 @@ async def test_mixed_tools_only_confirmation_has_metadata(self):
20862086
storage = create_mock_storage()
20872087
storage.get_value.return_value = {}
20882088
mapper = UiPathChatMessagesMapper("test-runtime", storage)
2089-
mapper.tool_confirmation_schemas = {"confirm_tool": {}}
2089+
mapper.tools_requiring_confirmation = {"confirm_tool": {}}
20902090

20912091
first_chunk = AIMessageChunk(
20922092
content="",

tests/runtime/test_tool_confirmation_discovery.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,20 @@ def test_discovers_confirmation_tool_through_wrapper(self):
7070
graph = _compile_graph_with_wrapped_tools([_ConfirmableTool(), _NormalTool()])
7171
runtime = UiPathLangGraphRuntime(graph)
7272

73-
schemas = runtime.chat.tool_confirmation_schemas
73+
schemas = runtime.chat.tools_requiring_confirmation
7474
assert "needs_confirmation" in schemas
7575
assert "no_confirmation" not in schemas
7676

7777
def test_schema_contains_input_properties(self):
7878
graph = _compile_graph_with_wrapped_tools([_ConfirmableTool()])
7979
runtime = UiPathLangGraphRuntime(graph)
8080

81-
schema = runtime.chat.tool_confirmation_schemas["needs_confirmation"]
81+
schema = runtime.chat.tools_requiring_confirmation["needs_confirmation"]
8282
assert "properties" in schema
8383
assert "query" in schema["properties"]
8484

8585
def test_empty_when_no_confirmation_tools(self):
8686
graph = _compile_graph_with_wrapped_tools([_NormalTool()])
8787
runtime = UiPathLangGraphRuntime(graph)
8888

89-
assert runtime.chat.tool_confirmation_schemas == {}
89+
assert runtime.chat.tools_requiring_confirmation == {}

0 commit comments

Comments
 (0)