uipath-langchain 0.0.145__py3-none-any.whl → 0.0.146__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.
- uipath_langchain/_cli/_runtime/_runtime.py +3 -3
- uipath_langchain/_cli/_utils/_schema.py +65 -13
- uipath_langchain/_cli/cli_init.py +10 -3
- {uipath_langchain-0.0.145.dist-info → uipath_langchain-0.0.146.dist-info}/METADATA +1 -1
- {uipath_langchain-0.0.145.dist-info → uipath_langchain-0.0.146.dist-info}/RECORD +8 -8
- {uipath_langchain-0.0.145.dist-info → uipath_langchain-0.0.146.dist-info}/WHEEL +0 -0
- {uipath_langchain-0.0.145.dist-info → uipath_langchain-0.0.146.dist-info}/entry_points.txt +0 -0
- {uipath_langchain-0.0.145.dist-info → uipath_langchain-0.0.146.dist-info}/licenses/LICENSE +0 -0
|
@@ -490,14 +490,14 @@ class LangGraphScriptRuntime(LangGraphRuntime):
|
|
|
490
490
|
"""Get entrypoint for this LangGraph runtime."""
|
|
491
491
|
graph = await self.resolver()
|
|
492
492
|
compiled_graph = graph.compile()
|
|
493
|
-
|
|
493
|
+
schema_details = generate_schema_from_graph(compiled_graph)
|
|
494
494
|
|
|
495
495
|
return Entrypoint(
|
|
496
496
|
file_path=self.context.entrypoint, # type: ignore[call-arg]
|
|
497
497
|
unique_id=str(uuid4()),
|
|
498
498
|
type="agent",
|
|
499
|
-
input=schema["input"],
|
|
500
|
-
output=schema["output"],
|
|
499
|
+
input=schema_details.schema["input"],
|
|
500
|
+
output=schema_details.schema["output"],
|
|
501
501
|
)
|
|
502
502
|
|
|
503
503
|
async def cleanup(self) -> None:
|
|
@@ -1,27 +1,73 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
1
2
|
from typing import Any, Dict
|
|
2
3
|
|
|
3
4
|
from langgraph.graph.state import CompiledStateGraph
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
@dataclass
|
|
8
|
+
class SchemaDetails:
|
|
9
|
+
schema: dict[str, Any]
|
|
10
|
+
has_input_circular_dependency: bool
|
|
11
|
+
has_output_circular_dependency: bool
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def resolve_refs(schema, root=None, visited=None):
|
|
15
|
+
"""Recursively resolves $ref references in a JSON schema, handling circular references.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
tuple: (resolved_schema, has_circular_dependency)
|
|
19
|
+
"""
|
|
8
20
|
if root is None:
|
|
9
|
-
root = schema
|
|
21
|
+
root = schema
|
|
22
|
+
|
|
23
|
+
if visited is None:
|
|
24
|
+
visited = set()
|
|
25
|
+
|
|
26
|
+
has_circular = False
|
|
10
27
|
|
|
11
28
|
if isinstance(schema, dict):
|
|
12
29
|
if "$ref" in schema:
|
|
13
|
-
ref_path = schema["$ref"]
|
|
30
|
+
ref_path = schema["$ref"]
|
|
31
|
+
|
|
32
|
+
if ref_path in visited:
|
|
33
|
+
# Circular dependency detected
|
|
34
|
+
return {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"description": f"Circular reference to {ref_path}",
|
|
37
|
+
}, True
|
|
38
|
+
|
|
39
|
+
visited.add(ref_path)
|
|
40
|
+
|
|
41
|
+
# Resolve the reference
|
|
42
|
+
ref_parts = ref_path.lstrip("#/").split("/")
|
|
14
43
|
ref_schema = root
|
|
15
|
-
for part in
|
|
44
|
+
for part in ref_parts:
|
|
16
45
|
ref_schema = ref_schema.get(part, {})
|
|
17
|
-
return resolve_refs(ref_schema, root)
|
|
18
46
|
|
|
19
|
-
|
|
47
|
+
result, circular = resolve_refs(ref_schema, root, visited)
|
|
48
|
+
has_circular = has_circular or circular
|
|
49
|
+
|
|
50
|
+
# Remove from visited after resolution (allows the same ref in different branches)
|
|
51
|
+
visited.discard(ref_path)
|
|
52
|
+
|
|
53
|
+
return result, has_circular
|
|
54
|
+
|
|
55
|
+
resolved_dict = {}
|
|
56
|
+
for k, v in schema.items():
|
|
57
|
+
resolved_value, circular = resolve_refs(v, root, visited)
|
|
58
|
+
resolved_dict[k] = resolved_value
|
|
59
|
+
has_circular = has_circular or circular
|
|
60
|
+
return resolved_dict, has_circular
|
|
20
61
|
|
|
21
62
|
elif isinstance(schema, list):
|
|
22
|
-
|
|
63
|
+
resolved_list = []
|
|
64
|
+
for item in schema:
|
|
65
|
+
resolved_item, circular = resolve_refs(item, root, visited)
|
|
66
|
+
resolved_list.append(resolved_item)
|
|
67
|
+
has_circular = has_circular or circular
|
|
68
|
+
return resolved_list, has_circular
|
|
23
69
|
|
|
24
|
-
return schema
|
|
70
|
+
return schema, False
|
|
25
71
|
|
|
26
72
|
|
|
27
73
|
def process_nullable_types(
|
|
@@ -45,8 +91,10 @@ def process_nullable_types(
|
|
|
45
91
|
|
|
46
92
|
def generate_schema_from_graph(
|
|
47
93
|
graph: CompiledStateGraph[Any, Any, Any],
|
|
48
|
-
) ->
|
|
94
|
+
) -> SchemaDetails:
|
|
49
95
|
"""Extract input/output schema from a LangGraph graph"""
|
|
96
|
+
input_circular_dependency = False
|
|
97
|
+
output_circular_dependency = False
|
|
50
98
|
schema = {
|
|
51
99
|
"input": {"type": "object", "properties": {}, "required": []},
|
|
52
100
|
"output": {"type": "object", "properties": {}, "required": []},
|
|
@@ -55,7 +103,9 @@ def generate_schema_from_graph(
|
|
|
55
103
|
if hasattr(graph, "input_schema"):
|
|
56
104
|
if hasattr(graph.input_schema, "model_json_schema"):
|
|
57
105
|
input_schema = graph.input_schema.model_json_schema()
|
|
58
|
-
unpacked_ref_def_properties = resolve_refs(
|
|
106
|
+
unpacked_ref_def_properties, input_circular_dependency = resolve_refs(
|
|
107
|
+
input_schema
|
|
108
|
+
)
|
|
59
109
|
|
|
60
110
|
# Process the schema to handle nullable types
|
|
61
111
|
processed_properties = process_nullable_types(
|
|
@@ -70,7 +120,9 @@ def generate_schema_from_graph(
|
|
|
70
120
|
if hasattr(graph, "output_schema"):
|
|
71
121
|
if hasattr(graph.output_schema, "model_json_schema"):
|
|
72
122
|
output_schema = graph.output_schema.model_json_schema()
|
|
73
|
-
unpacked_ref_def_properties = resolve_refs(
|
|
123
|
+
unpacked_ref_def_properties, output_circular_dependency = resolve_refs(
|
|
124
|
+
output_schema
|
|
125
|
+
)
|
|
74
126
|
|
|
75
127
|
# Process the schema to handle nullable types
|
|
76
128
|
processed_properties = process_nullable_types(
|
|
@@ -82,4 +134,4 @@ def generate_schema_from_graph(
|
|
|
82
134
|
"required", []
|
|
83
135
|
)
|
|
84
136
|
|
|
85
|
-
return schema
|
|
137
|
+
return SchemaDetails(schema, input_circular_dependency, output_circular_dependency)
|
|
@@ -175,7 +175,7 @@ async def langgraph_init_middleware_async(
|
|
|
175
175
|
else loaded_graph
|
|
176
176
|
)
|
|
177
177
|
compiled_graph = state_graph.compile()
|
|
178
|
-
|
|
178
|
+
schema_details = generate_schema_from_graph(compiled_graph)
|
|
179
179
|
|
|
180
180
|
mermaids[graph.name] = compiled_graph.get_graph(xray=1).draw_mermaid()
|
|
181
181
|
|
|
@@ -197,11 +197,17 @@ async def langgraph_init_middleware_async(
|
|
|
197
197
|
"filePath": graph.name,
|
|
198
198
|
"uniqueId": str(uuid.uuid4()),
|
|
199
199
|
"type": "agent",
|
|
200
|
-
"input":
|
|
201
|
-
"output":
|
|
200
|
+
"input": schema_details.schema["input"],
|
|
201
|
+
"output": schema_details.schema["output"],
|
|
202
202
|
}
|
|
203
203
|
entrypoints.append(new_entrypoint)
|
|
204
204
|
|
|
205
|
+
warning_circular_deps = f" schema of graph '{graph.name}' contains circular dependencies. Some types might not be correctly inferred."
|
|
206
|
+
if schema_details.has_input_circular_dependency:
|
|
207
|
+
console.warning("Input" + warning_circular_deps)
|
|
208
|
+
if schema_details.has_output_circular_dependency:
|
|
209
|
+
console.warning("Output" + warning_circular_deps)
|
|
210
|
+
|
|
205
211
|
except Exception as e:
|
|
206
212
|
console.error(f"Error during graph load: {e}")
|
|
207
213
|
return MiddlewareResult(
|
|
@@ -243,6 +249,7 @@ async def langgraph_init_middleware_async(
|
|
|
243
249
|
should_continue=False,
|
|
244
250
|
should_include_stacktrace=True,
|
|
245
251
|
)
|
|
252
|
+
|
|
246
253
|
console.success(f"Created {click.style(config_path, fg='cyan')} file.")
|
|
247
254
|
|
|
248
255
|
generate_agents_md_files(options)
|
|
@@ -6,7 +6,7 @@ uipath_langchain/_cli/__init__.py,sha256=juqd9PbXs4yg45zMJ7BHAOPQjb7sgEbWE9InBtG
|
|
|
6
6
|
uipath_langchain/_cli/cli_debug.py,sha256=zaB-W3_29FsCqF-YZ3EsayyxC957tg4tOjdcdX8ew-M,3311
|
|
7
7
|
uipath_langchain/_cli/cli_dev.py,sha256=l3XFHrh-0OUFJq3zLMKuzedJAluGQBIZQTHP1KWOmpw,1725
|
|
8
8
|
uipath_langchain/_cli/cli_eval.py,sha256=Z1EYFObD0n-lfXfvjq4ejnrWQJrRrNktSxNPDE7QqSc,3529
|
|
9
|
-
uipath_langchain/_cli/cli_init.py,sha256=
|
|
9
|
+
uipath_langchain/_cli/cli_init.py,sha256=RtX3NMLgHj2gKNRKv2HW7iBI5gMrl7ZpkG6uV_f_arg,10145
|
|
10
10
|
uipath_langchain/_cli/cli_new.py,sha256=KKLxCzz7cDQ__rRr_a496IHWlSQXhmrBNgmKHnXAnTY,2336
|
|
11
11
|
uipath_langchain/_cli/cli_run.py,sha256=DIsAKsbQ8gTRz44q9ZV3jBjrbM8bhS6lEQ3dd4joDFU,3712
|
|
12
12
|
uipath_langchain/_cli/_runtime/_context.py,sha256=mjmGEogKiO8tUV878BgV9rFIeA9MCmEH6hgs5W_dm4g,328
|
|
@@ -15,11 +15,11 @@ uipath_langchain/_cli/_runtime/_exception.py,sha256=xHKeu8njByiMcObbggyZk0cXYXX5
|
|
|
15
15
|
uipath_langchain/_cli/_runtime/_graph_resolver.py,sha256=c-JrsX7rx_CflDPfKhz9q-PgBrgI2IOBcYwiffwddh8,5457
|
|
16
16
|
uipath_langchain/_cli/_runtime/_input.py,sha256=HAJUxjNmOg9q7l_ebF1AzIKL5_ysXyjk1bWXHsjhEPI,5761
|
|
17
17
|
uipath_langchain/_cli/_runtime/_output.py,sha256=2VvdW4olv7Vd0c4grtTQazXxfBbcuocgSSP6V2P8uHE,4887
|
|
18
|
-
uipath_langchain/_cli/_runtime/_runtime.py,sha256=
|
|
18
|
+
uipath_langchain/_cli/_runtime/_runtime.py,sha256=Cur3WdbIkDs60peF57QzaKl2YHP8-WBfpLXhTVLU_3c,19267
|
|
19
19
|
uipath_langchain/_cli/_templates/langgraph.json.template,sha256=eeh391Gta_hoRgaNaZ58nW1LNvCVXA7hlAH6l7Veous,107
|
|
20
20
|
uipath_langchain/_cli/_templates/main.py.template,sha256=GpSblGH2hwS9ibqQmX2iB2nsmOA5zDfEEF4ChLiMxbQ,875
|
|
21
21
|
uipath_langchain/_cli/_utils/_graph.py,sha256=nMJWy8FmaD9rqPUY2lHc5uVpUzbXD1RO12uJnhe0kdo,6803
|
|
22
|
-
uipath_langchain/_cli/_utils/_schema.py,sha256=
|
|
22
|
+
uipath_langchain/_cli/_utils/_schema.py,sha256=y0w0fADLxeOO-AipkhLJ7AX7azY6vmEIyBDzwaxUAPk,4716
|
|
23
23
|
uipath_langchain/_resources/AGENTS.md,sha256=5VmIfaQ6H91VxInnxFmJklURXeWIIQpGQTYBEmvvoVA,1060
|
|
24
24
|
uipath_langchain/_resources/REQUIRED_STRUCTURE.md,sha256=BRmWWFtM0qNXj5uumALVxq9h6pifJDGh5NzuyctuH1Q,2569
|
|
25
25
|
uipath_langchain/_tracing/__init__.py,sha256=C2dRvQ2ynxCmyICgE-rJHimWKEcFRME_o9gfX84Mb3Y,123
|
|
@@ -57,8 +57,8 @@ uipath_langchain/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
57
57
|
uipath_langchain/tools/preconfigured.py,sha256=SyvrLrM1kezZxVVytgScVO8nBfVYfFGobWjY7erzsYU,7490
|
|
58
58
|
uipath_langchain/vectorstores/__init__.py,sha256=w8qs1P548ud1aIcVA_QhBgf_jZDrRMK5Lono78yA8cs,114
|
|
59
59
|
uipath_langchain/vectorstores/context_grounding_vectorstore.py,sha256=TncIXG-YsUlO0R5ZYzWsM-Dj1SVCZbzmo2LraVxXelc,9559
|
|
60
|
-
uipath_langchain-0.0.
|
|
61
|
-
uipath_langchain-0.0.
|
|
62
|
-
uipath_langchain-0.0.
|
|
63
|
-
uipath_langchain-0.0.
|
|
64
|
-
uipath_langchain-0.0.
|
|
60
|
+
uipath_langchain-0.0.146.dist-info/METADATA,sha256=7u2FwmZLCfShij8MzNjH3-B3pVxqerwV99nGRAwVGSM,4276
|
|
61
|
+
uipath_langchain-0.0.146.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
62
|
+
uipath_langchain-0.0.146.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
|
|
63
|
+
uipath_langchain-0.0.146.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
|
|
64
|
+
uipath_langchain-0.0.146.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|