You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/uipath_langchain/runtime/messages.py
+1-32Lines changed: 1 addition & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -110,9 +110,8 @@ def _map_messages_internal(
110
110
self, messages: list[UiPathConversationMessage]
111
111
) ->list[BaseMessage]:
112
112
"""
113
-
Converts UiPathConversationMessage list to LangChain messages (UserMessage/AIMessage/ToolMessage list).
113
+
Converts UiPathConversationMessage list to LangChain messages (UserMessage/AIMessage list).
114
114
- All content parts are combined into content_blocks
115
-
- Tool calls are converted to LangChain ToolCall format, with results stored as ToolMessage
116
115
- Metadata includes message_id, role, timestamps
117
116
"""
118
117
converted_messages: list[BaseMessage] = []
@@ -179,7 +178,6 @@ def _map_messages_internal(
179
178
elifrole=="assistant":
180
179
# Convert tool calls to LangChain format
181
180
tool_calls: list[ToolCall] = []
182
-
tool_messages: list[ToolMessage] = []
183
181
ifuipath_message.tool_calls:
184
182
foruipath_tool_callinuipath_message.tool_calls:
185
183
tool_call=ToolCall(
@@ -189,34 +187,6 @@ def _map_messages_internal(
189
187
)
190
188
tool_calls.append(tool_call)
191
189
192
-
tool_call_output= (
193
-
uipath_tool_call.result.output
194
-
ifuipath_tool_call.result
195
-
elseNone
196
-
)
197
-
tool_call_status= (
198
-
"success"
199
-
ifuipath_tool_call.result
200
-
andnotuipath_tool_call.result.is_error
201
-
else"error"
202
-
)
203
-
204
-
# Serialize output to string if needed
205
-
iftool_call_outputisNone:
206
-
content=""
207
-
elifisinstance(tool_call_output, str):
208
-
content=tool_call_output
209
-
else:
210
-
content=json.dumps(tool_call_output)
211
-
212
-
tool_messages.append(
213
-
ToolMessage(
214
-
content=content,
215
-
status=tool_call_status,
216
-
tool_call_id=uipath_tool_call.tool_call_id,
217
-
)
218
-
)
219
-
220
190
# Ideally we pass in content_blocks here rather than string content, but when doing so, OpenAI errors unless a msg_ prefix is used for content-block IDs.
221
191
# When needed, we can switch to content_blocks but need to work out a common ID strategy across models for the content-block IDs.
0 commit comments