uipath-langchain 0.0.126__py3-none-any.whl → 0.0.127__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of uipath-langchain might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  import uuid
2
2
  from datetime import datetime
3
- from typing import Optional
3
+ from typing import Any, Dict, List, Optional
4
4
 
5
5
  from langchain_core.messages import (
6
6
  AIMessage,
@@ -16,6 +16,7 @@ from uipath.agent.conversation import (
16
16
  UiPathConversationContentPartStartEvent,
17
17
  UiPathConversationEvent,
18
18
  UiPathConversationExchangeEvent,
19
+ UiPathConversationMessage,
19
20
  UiPathConversationMessageEndEvent,
20
21
  UiPathConversationMessageEvent,
21
22
  UiPathConversationMessageStartEvent,
@@ -58,6 +59,47 @@ def _extract_text(content) -> str:
58
59
  return str(content or "")
59
60
 
60
61
 
62
+ def uipath_to_human_messages(
63
+ uipath_msg: UiPathConversationMessage,
64
+ ) -> List[HumanMessage]:
65
+ """
66
+ Converts a UiPathConversationMessage into a list of HumanMessages for LangGraph.
67
+ Supports multimodal content parts (text, external content) and preserves metadata.
68
+ """
69
+ human_messages = []
70
+
71
+ # Loop over each content part
72
+ if uipath_msg.content_parts:
73
+ for part in uipath_msg.content_parts:
74
+ data = part.data
75
+ content = ""
76
+ metadata: Dict[str, Any] = {
77
+ "message_id": uipath_msg.message_id,
78
+ "content_part_id": part.content_part_id,
79
+ "mime_type": part.mime_type,
80
+ "created_at": uipath_msg.created_at,
81
+ "updated_at": uipath_msg.updated_at,
82
+ }
83
+
84
+ if isinstance(data, UiPathInlineValue):
85
+ content = str(data.inline)
86
+
87
+ # Append a HumanMessage for this content part
88
+ human_messages.append(HumanMessage(content=content, metadata=metadata))
89
+
90
+ # Handle the case where there are no content parts
91
+ else:
92
+ metadata = {
93
+ "message_id": uipath_msg.message_id,
94
+ "role": uipath_msg.role,
95
+ "created_at": uipath_msg.created_at,
96
+ "updated_at": uipath_msg.updated_at,
97
+ }
98
+ human_messages.append(HumanMessage(content="", metadata=metadata))
99
+
100
+ return human_messages
101
+
102
+
61
103
  def map_message(
62
104
  message: BaseMessage,
63
105
  exchange_id: Optional[str] = None,
@@ -12,6 +12,7 @@ from uipath._cli._runtime._contracts import (
12
12
  from uipath._cli._runtime._hitl import HitlReader
13
13
 
14
14
  from ._context import LangGraphRuntimeContext
15
+ from ._conversation import uipath_to_human_messages
15
16
  from ._exception import LangGraphRuntimeError
16
17
 
17
18
  logger = logging.getLogger(__name__)
@@ -58,6 +59,10 @@ class LangGraphInputProcessor:
58
59
  logger.debug(f"Resumed: {self.context.resume} Input: {self.context.input_json}")
59
60
 
60
61
  if not self.context.resume:
62
+ if self.context.input_message:
63
+ return {
64
+ "messages": uipath_to_human_messages(self.context.input_message)
65
+ }
61
66
  return self.context.input_json
62
67
 
63
68
  if self.context.input_json:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath-langchain
3
- Version: 0.0.126
3
+ Version: 0.0.127
4
4
  Summary: UiPath Langchain
5
5
  Project-URL: Homepage, https://uipath.com
6
6
  Project-URL: Repository, https://github.com/UiPath/uipath-langchain-python
@@ -25,7 +25,7 @@ Requires-Dist: openai>=1.65.5
25
25
  Requires-Dist: openinference-instrumentation-langchain>=0.1.50
26
26
  Requires-Dist: pydantic-settings>=2.6.0
27
27
  Requires-Dist: python-dotenv>=1.0.1
28
- Requires-Dist: uipath<2.2.0,>=2.1.38
28
+ Requires-Dist: uipath<2.2.0,>=2.1.41
29
29
  Provides-Extra: langchain
30
30
  Description-Content-Type: text/markdown
31
31
 
@@ -6,9 +6,9 @@ uipath_langchain/_cli/cli_init.py,sha256=xhxJ8tuMSrVUNHvltgyPpOrvgMA-wq9shHeYYwv
6
6
  uipath_langchain/_cli/cli_new.py,sha256=dL8-Rri6u67ZZdbb4nT38A5xD_Q3fVnG0UK9VSeKaqg,2563
7
7
  uipath_langchain/_cli/cli_run.py,sha256=R-cUi3lO3Qd4ysTXD7PW4sa1RsB427v_Y6xUQxWijfQ,3725
8
8
  uipath_langchain/_cli/_runtime/_context.py,sha256=yyzYJDmk2fkH4T5gm4cLGRyXtjLESrpzHBT9euqluTA,817
9
- uipath_langchain/_cli/_runtime/_conversation.py,sha256=qobBjb3PEDRQVhrcy8vUXXuzBneELqwphDAU7xEUOqA,9683
9
+ uipath_langchain/_cli/_runtime/_conversation.py,sha256=S1KTx_q-La7ikPRT3nBcIp8t-J9CF0QB0DCduQIIB28,11149
10
10
  uipath_langchain/_cli/_runtime/_exception.py,sha256=USKkLYkG-dzjX3fEiMMOHnVUpiXJs_xF0OQXCCOvbYM,546
11
- uipath_langchain/_cli/_runtime/_input.py,sha256=vZ8vfVxvPSaPWmIPghvNx1VRKzbalHsKUMBPiKDvJWM,5492
11
+ uipath_langchain/_cli/_runtime/_input.py,sha256=3IKrZR9xmxYg6l_1TbFpaLOWPDvK8d3nSKIHPGEEGzE,5715
12
12
  uipath_langchain/_cli/_runtime/_output.py,sha256=yJOZPWv2FRUJWv1NRs9JmpB4QMTDXu8jrxoaKrfJvzw,9078
13
13
  uipath_langchain/_cli/_runtime/_runtime.py,sha256=9X_8YEny238V1sTb4cjkpd6J69DYQWo6eYVH9kA9gEQ,15383
14
14
  uipath_langchain/_cli/_templates/langgraph.json.template,sha256=eeh391Gta_hoRgaNaZ58nW1LNvCVXA7hlAH6l7Veous,107
@@ -32,8 +32,8 @@ uipath_langchain/tracers/_instrument_traceable.py,sha256=0e841zVzcPWjOGtmBx0GeHb
32
32
  uipath_langchain/tracers/_utils.py,sha256=JOT1tKMdvqjMDtj2WbmbOWMeMlTXBWavxWpogX7KlRA,1543
33
33
  uipath_langchain/vectorstores/__init__.py,sha256=w8qs1P548ud1aIcVA_QhBgf_jZDrRMK5Lono78yA8cs,114
34
34
  uipath_langchain/vectorstores/context_grounding_vectorstore.py,sha256=TncIXG-YsUlO0R5ZYzWsM-Dj1SVCZbzmo2LraVxXelc,9559
35
- uipath_langchain-0.0.126.dist-info/METADATA,sha256=rzCwILV0ipPfMnQks58Uh3J2KVNeb9F7FmymzJG0plo,4235
36
- uipath_langchain-0.0.126.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
37
- uipath_langchain-0.0.126.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
38
- uipath_langchain-0.0.126.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
39
- uipath_langchain-0.0.126.dist-info/RECORD,,
35
+ uipath_langchain-0.0.127.dist-info/METADATA,sha256=-pkEhqb6QF5H9pH-3TVabaJmMZcsWrd-sAH6EMlPhpg,4235
36
+ uipath_langchain-0.0.127.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
37
+ uipath_langchain-0.0.127.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
38
+ uipath_langchain-0.0.127.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
39
+ uipath_langchain-0.0.127.dist-info/RECORD,,