uipath-langchain 0.0.127__py3-none-any.whl → 0.0.129__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 +0 -13
- uipath_langchain/_cli/cli_eval.py +68 -0
- uipath_langchain/_cli/cli_run.py +14 -44
- uipath_langchain/middlewares.py +2 -0
- {uipath_langchain-0.0.127.dist-info → uipath_langchain-0.0.129.dist-info}/METADATA +2 -2
- {uipath_langchain-0.0.127.dist-info → uipath_langchain-0.0.129.dist-info}/RECORD +9 -8
- {uipath_langchain-0.0.127.dist-info → uipath_langchain-0.0.129.dist-info}/WHEEL +0 -0
- {uipath_langchain-0.0.127.dist-info → uipath_langchain-0.0.129.dist-info}/entry_points.txt +0 -0
- {uipath_langchain-0.0.127.dist-info → uipath_langchain-0.0.129.dist-info}/licenses/LICENSE +0 -0
|
@@ -50,8 +50,6 @@ class LangGraphRuntime(UiPathBaseRuntime):
|
|
|
50
50
|
"""
|
|
51
51
|
_instrument_traceable_attributes()
|
|
52
52
|
|
|
53
|
-
await self.validate()
|
|
54
|
-
|
|
55
53
|
if self.context.state_graph is None:
|
|
56
54
|
return None
|
|
57
55
|
|
|
@@ -196,17 +194,6 @@ class LangGraphRuntime(UiPathBaseRuntime):
|
|
|
196
194
|
async def validate(self) -> None:
|
|
197
195
|
"""Validate runtime inputs."""
|
|
198
196
|
"""Load and validate the graph configuration ."""
|
|
199
|
-
try:
|
|
200
|
-
if self.context.input:
|
|
201
|
-
self.context.input_json = json.loads(self.context.input)
|
|
202
|
-
except json.JSONDecodeError as e:
|
|
203
|
-
raise LangGraphRuntimeError(
|
|
204
|
-
"INPUT_INVALID_JSON",
|
|
205
|
-
"Invalid JSON input",
|
|
206
|
-
"The input data is not valid JSON.",
|
|
207
|
-
UiPathErrorCategory.USER,
|
|
208
|
-
) from e
|
|
209
|
-
|
|
210
197
|
if self.context.langgraph_config is None:
|
|
211
198
|
self.context.langgraph_config = LangGraphConfig()
|
|
212
199
|
if not self.context.langgraph_config.exists:
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from os import environ as env
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from uipath._cli._evals._runtime import UiPathEvalContext, UiPathEvalRuntime
|
|
6
|
+
from uipath._cli._runtime._contracts import (
|
|
7
|
+
UiPathRuntimeFactory,
|
|
8
|
+
)
|
|
9
|
+
from uipath._cli._utils._eval_set import EvalHelpers
|
|
10
|
+
from uipath._cli.middlewares import MiddlewareResult
|
|
11
|
+
from uipath.eval._helpers import auto_discover_entrypoint
|
|
12
|
+
|
|
13
|
+
from uipath_langchain._cli._runtime._context import LangGraphRuntimeContext
|
|
14
|
+
from uipath_langchain._cli._runtime._runtime import LangGraphRuntime
|
|
15
|
+
from uipath_langchain._cli._utils._graph import LangGraphConfig
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def langgraph_eval_middleware(
|
|
19
|
+
entrypoint: Optional[str], eval_set: Optional[str], eval_ids: List[str], **kwargs
|
|
20
|
+
) -> MiddlewareResult:
|
|
21
|
+
# Add default env variables
|
|
22
|
+
env["UIPATH_REQUESTING_PRODUCT"] = "uipath-python-sdk"
|
|
23
|
+
env["UIPATH_REQUESTING_FEATURE"] = "langgraph-agent"
|
|
24
|
+
|
|
25
|
+
config = LangGraphConfig()
|
|
26
|
+
if not config.exists:
|
|
27
|
+
return MiddlewareResult(
|
|
28
|
+
should_continue=True
|
|
29
|
+
) # Continue with normal flow if no langgraph.json
|
|
30
|
+
|
|
31
|
+
eval_context = UiPathEvalContext.with_defaults(**kwargs)
|
|
32
|
+
eval_context.eval_set = eval_set or EvalHelpers.auto_discover_eval_set()
|
|
33
|
+
eval_context.eval_ids = eval_ids
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
runtime_entrypoint = entrypoint or auto_discover_entrypoint()
|
|
37
|
+
|
|
38
|
+
def generate_runtime_context(
|
|
39
|
+
context_entrypoint: str, langgraph_config: LangGraphConfig, **context_kwargs
|
|
40
|
+
) -> LangGraphRuntimeContext:
|
|
41
|
+
context = LangGraphRuntimeContext.with_defaults(**context_kwargs)
|
|
42
|
+
context.langgraph_config = langgraph_config
|
|
43
|
+
context.entrypoint = context_entrypoint
|
|
44
|
+
return context
|
|
45
|
+
|
|
46
|
+
runtime_factory = UiPathRuntimeFactory(
|
|
47
|
+
LangGraphRuntime,
|
|
48
|
+
LangGraphRuntimeContext,
|
|
49
|
+
context_generator=lambda **context_kwargs: generate_runtime_context(
|
|
50
|
+
context_entrypoint=runtime_entrypoint,
|
|
51
|
+
langgraph_config=config,
|
|
52
|
+
**context_kwargs,
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
async def execute():
|
|
57
|
+
async with UiPathEvalRuntime.from_eval_context(
|
|
58
|
+
factory=runtime_factory, context=eval_context
|
|
59
|
+
) as eval_runtime:
|
|
60
|
+
await eval_runtime.execute()
|
|
61
|
+
|
|
62
|
+
asyncio.run(execute())
|
|
63
|
+
return MiddlewareResult(should_continue=False)
|
|
64
|
+
|
|
65
|
+
except Exception as e:
|
|
66
|
+
return MiddlewareResult(
|
|
67
|
+
should_continue=False, error_message=f"Error running evaluation: {str(e)}"
|
|
68
|
+
)
|
uipath_langchain/_cli/cli_run.py
CHANGED
|
@@ -3,22 +3,20 @@ import os
|
|
|
3
3
|
from os import environ as env
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
|
-
from dotenv import load_dotenv
|
|
7
|
-
from uipath._cli._runtime._contracts import UiPathTraceContext
|
|
8
6
|
from uipath._cli.middlewares import MiddlewareResult
|
|
9
7
|
|
|
10
|
-
from ._runtime._context import LangGraphRuntimeContext
|
|
11
8
|
from ._runtime._exception import LangGraphRuntimeError
|
|
12
|
-
from ._runtime._runtime import
|
|
9
|
+
from ._runtime._runtime import ( # type: ignore[attr-defined]
|
|
10
|
+
LangGraphRuntime,
|
|
11
|
+
LangGraphRuntimeContext,
|
|
12
|
+
)
|
|
13
13
|
from ._utils._graph import LangGraphConfig
|
|
14
14
|
|
|
15
|
-
load_dotenv()
|
|
16
|
-
|
|
17
15
|
|
|
18
16
|
def langgraph_run_middleware(
|
|
19
17
|
entrypoint: Optional[str], input: Optional[str], resume: bool, **kwargs
|
|
20
18
|
) -> MiddlewareResult:
|
|
21
|
-
"""Middleware to handle
|
|
19
|
+
"""Middleware to handle LangGraph execution"""
|
|
22
20
|
config = LangGraphConfig()
|
|
23
21
|
if not config.exists:
|
|
24
22
|
return MiddlewareResult(
|
|
@@ -26,45 +24,17 @@ def langgraph_run_middleware(
|
|
|
26
24
|
) # Continue with normal flow if no langgraph.json
|
|
27
25
|
|
|
28
26
|
try:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
tracing = bool_map[tracing.lower()]
|
|
33
|
-
|
|
34
|
-
async def execute():
|
|
35
|
-
context: LangGraphRuntimeContext = LangGraphRuntimeContext.from_config(
|
|
36
|
-
env.get("UIPATH_CONFIG_PATH", "uipath.json"), **kwargs
|
|
37
|
-
)
|
|
38
|
-
context.entrypoint = entrypoint
|
|
39
|
-
context.input = input
|
|
40
|
-
context.resume = resume
|
|
41
|
-
context.langgraph_config = config
|
|
42
|
-
context.debug = kwargs.get("debug", False)
|
|
43
|
-
context.logs_min_level = env.get("LOG_LEVEL", "INFO")
|
|
44
|
-
context.job_id = env.get("UIPATH_JOB_KEY", None)
|
|
45
|
-
context.execution_id = env.get("UIPATH_JOB_KEY", None)
|
|
46
|
-
context.trace_id = env.get("UIPATH_TRACE_ID")
|
|
47
|
-
context.is_eval_run = kwargs.get("is_eval_run", False)
|
|
48
|
-
context.tracing_enabled = tracing
|
|
49
|
-
context.input_file = kwargs.get("input_file", None)
|
|
50
|
-
context.execution_output_file = kwargs.get("execution_output_file", None)
|
|
51
|
-
context.trace_context = UiPathTraceContext(
|
|
52
|
-
enabled=tracing,
|
|
53
|
-
trace_id=env.get("UIPATH_TRACE_ID"),
|
|
54
|
-
parent_span_id=env.get("UIPATH_PARENT_SPAN_ID"),
|
|
55
|
-
root_span_id=env.get("UIPATH_ROOT_SPAN_ID"),
|
|
56
|
-
job_id=env.get("UIPATH_JOB_KEY"),
|
|
57
|
-
org_id=env.get("UIPATH_ORGANIZATION_ID"),
|
|
58
|
-
tenant_id=env.get("UIPATH_TENANT_ID"),
|
|
59
|
-
process_key=env.get("UIPATH_PROCESS_UUID"),
|
|
60
|
-
folder_key=env.get("UIPATH_FOLDER_KEY"),
|
|
61
|
-
)
|
|
62
|
-
context.langsmith_tracing_enabled = env.get("LANGSMITH_TRACING", False)
|
|
27
|
+
# Add default env variables
|
|
28
|
+
env["UIPATH_REQUESTING_PRODUCT"] = "uipath-python-sdk"
|
|
29
|
+
env["UIPATH_REQUESTING_FEATURE"] = "langgraph-agent"
|
|
63
30
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
31
|
+
context = LangGraphRuntimeContext.with_defaults(**kwargs)
|
|
32
|
+
context.langgraph_config = config
|
|
33
|
+
context.entrypoint = entrypoint
|
|
34
|
+
context.input = input
|
|
35
|
+
context.resume = resume
|
|
67
36
|
|
|
37
|
+
async def execute():
|
|
68
38
|
async with LangGraphRuntime.from_context(context) as runtime:
|
|
69
39
|
if context.resume is False and context.job_id is None:
|
|
70
40
|
# Delete the previous graph state file at debug time
|
uipath_langchain/middlewares.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from uipath._cli.middlewares import Middlewares
|
|
2
2
|
|
|
3
3
|
from ._cli.cli_dev import langgraph_dev_middleware
|
|
4
|
+
from ._cli.cli_eval import langgraph_eval_middleware
|
|
4
5
|
from ._cli.cli_init import langgraph_init_middleware
|
|
5
6
|
from ._cli.cli_new import langgraph_new_middleware
|
|
6
7
|
from ._cli.cli_run import langgraph_run_middleware
|
|
@@ -12,3 +13,4 @@ def register_middleware():
|
|
|
12
13
|
Middlewares.register("run", langgraph_run_middleware)
|
|
13
14
|
Middlewares.register("new", langgraph_new_middleware)
|
|
14
15
|
Middlewares.register("dev", langgraph_dev_middleware)
|
|
16
|
+
Middlewares.register("eval", langgraph_eval_middleware)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uipath-langchain
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.129
|
|
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.
|
|
28
|
+
Requires-Dist: uipath<2.2.0,>=2.1.46
|
|
29
29
|
Provides-Extra: langchain
|
|
30
30
|
Description-Content-Type: text/markdown
|
|
31
31
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
uipath_langchain/__init__.py,sha256=VBrvQn7d3nuOdN7zEnV2_S-uhmkjgEIlXiFVeZxZakQ,80
|
|
2
|
-
uipath_langchain/middlewares.py,sha256=
|
|
2
|
+
uipath_langchain/middlewares.py,sha256=6ljfbtWekrYc5G9KWDLSaViJ1DVIaNM-4qeB1BfHywE,731
|
|
3
3
|
uipath_langchain/_cli/__init__.py,sha256=juqd9PbXs4yg45zMJ7BHAOPQjb7sgEbWE9InBtGZhfo,24
|
|
4
4
|
uipath_langchain/_cli/cli_dev.py,sha256=VlI8qgCw-63I97tp_9lbXs-CVcNSjpd2sC13YNZAIuU,1401
|
|
5
|
+
uipath_langchain/_cli/cli_eval.py,sha256=eGhvenAKJDdt9zIYWO7k01zJ7T1tGte7a6zz06iO6cw,2539
|
|
5
6
|
uipath_langchain/_cli/cli_init.py,sha256=xhxJ8tuMSrVUNHvltgyPpOrvgMA-wq9shHeYYwvHILs,8199
|
|
6
7
|
uipath_langchain/_cli/cli_new.py,sha256=dL8-Rri6u67ZZdbb4nT38A5xD_Q3fVnG0UK9VSeKaqg,2563
|
|
7
|
-
uipath_langchain/_cli/cli_run.py,sha256=
|
|
8
|
+
uipath_langchain/_cli/cli_run.py,sha256=FT4ilVCBNSYllB-wS6__0E0fWKlrQEhO9N74wNHPffs,2056
|
|
8
9
|
uipath_langchain/_cli/_runtime/_context.py,sha256=yyzYJDmk2fkH4T5gm4cLGRyXtjLESrpzHBT9euqluTA,817
|
|
9
10
|
uipath_langchain/_cli/_runtime/_conversation.py,sha256=S1KTx_q-La7ikPRT3nBcIp8t-J9CF0QB0DCduQIIB28,11149
|
|
10
11
|
uipath_langchain/_cli/_runtime/_exception.py,sha256=USKkLYkG-dzjX3fEiMMOHnVUpiXJs_xF0OQXCCOvbYM,546
|
|
11
12
|
uipath_langchain/_cli/_runtime/_input.py,sha256=3IKrZR9xmxYg6l_1TbFpaLOWPDvK8d3nSKIHPGEEGzE,5715
|
|
12
13
|
uipath_langchain/_cli/_runtime/_output.py,sha256=yJOZPWv2FRUJWv1NRs9JmpB4QMTDXu8jrxoaKrfJvzw,9078
|
|
13
|
-
uipath_langchain/_cli/_runtime/_runtime.py,sha256=
|
|
14
|
+
uipath_langchain/_cli/_runtime/_runtime.py,sha256=ai-r6cYp4YbJqGhxWGvL68BHtJGhYhAZF-MEhKT7ceY,14955
|
|
14
15
|
uipath_langchain/_cli/_templates/langgraph.json.template,sha256=eeh391Gta_hoRgaNaZ58nW1LNvCVXA7hlAH6l7Veous,107
|
|
15
16
|
uipath_langchain/_cli/_templates/main.py.template,sha256=nMJQIYPlRk90iANfNVpkJ2EQX20Dxsyq92-BucEz_UM,1189
|
|
16
17
|
uipath_langchain/_cli/_utils/_graph.py,sha256=JPShHNl0UQvl4AdjLIqLpNt_JAjpWH9WWF22Gs47Xew,7445
|
|
@@ -32,8 +33,8 @@ uipath_langchain/tracers/_instrument_traceable.py,sha256=0e841zVzcPWjOGtmBx0GeHb
|
|
|
32
33
|
uipath_langchain/tracers/_utils.py,sha256=JOT1tKMdvqjMDtj2WbmbOWMeMlTXBWavxWpogX7KlRA,1543
|
|
33
34
|
uipath_langchain/vectorstores/__init__.py,sha256=w8qs1P548ud1aIcVA_QhBgf_jZDrRMK5Lono78yA8cs,114
|
|
34
35
|
uipath_langchain/vectorstores/context_grounding_vectorstore.py,sha256=TncIXG-YsUlO0R5ZYzWsM-Dj1SVCZbzmo2LraVxXelc,9559
|
|
35
|
-
uipath_langchain-0.0.
|
|
36
|
-
uipath_langchain-0.0.
|
|
37
|
-
uipath_langchain-0.0.
|
|
38
|
-
uipath_langchain-0.0.
|
|
39
|
-
uipath_langchain-0.0.
|
|
36
|
+
uipath_langchain-0.0.129.dist-info/METADATA,sha256=w_AyKGzo76g4G8qXMmZfMiikhaB1-QMJ-qn7G-GDvwA,4235
|
|
37
|
+
uipath_langchain-0.0.129.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
38
|
+
uipath_langchain-0.0.129.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
|
|
39
|
+
uipath_langchain-0.0.129.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
|
|
40
|
+
uipath_langchain-0.0.129.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|