Skip to content

Commit 1d3b9d0

Browse files
authored
Merge pull request #192 from UiPath/feat/eval-sw-reporter
feat: add eval progress reporter
2 parents 342edd5 + 31e2bd0 commit 1d3b9d0

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.0.133"
3+
version = "0.0.134"
44
description = "UiPath Langchain"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"
77
dependencies = [
8-
"uipath>=2.1.60, <2.2.0",
8+
"uipath>=2.1.64, <2.2.0",
99
"langgraph>=0.5.0, <0.7.0",
1010
"langchain-core>=0.3.34",
1111
"langgraph-checkpoint-sqlite>=2.0.3",

src/uipath_langchain/_cli/cli_eval.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
import asyncio
2+
import uuid
23
from typing import List, Optional
34

45
from openinference.instrumentation.langchain import (
56
LangChainInstrumentor,
67
get_current_span,
78
)
9+
from uipath._cli._evals._progress_reporter import StudioWebProgressReporter
810
from uipath._cli._evals._runtime import UiPathEvalContext, UiPathEvalRuntime
911
from uipath._cli._runtime._contracts import (
1012
UiPathRuntimeFactory,
1113
)
1214
from uipath._cli._utils._eval_set import EvalHelpers
1315
from uipath._cli.middlewares import MiddlewareResult
16+
from uipath._events._event_bus import EventBus
1417
from uipath.eval._helpers import auto_discover_entrypoint
1518

1619
from uipath_langchain._cli._runtime._context import LangGraphRuntimeContext
@@ -31,14 +34,16 @@ def langgraph_eval_middleware(
3134
should_continue=True
3235
) # Continue with normal flow if no langgraph.json
3336

34-
eval_context = UiPathEvalContext.with_defaults(**kwargs)
35-
eval_context.eval_set = eval_set or EvalHelpers.auto_discover_eval_set()
36-
eval_context.eval_ids = eval_ids
37-
3837
try:
3938
_instrument_traceable_attributes()
4039

41-
runtime_entrypoint = entrypoint or auto_discover_entrypoint()
40+
event_bus = EventBus()
41+
42+
if not kwargs.get("no_report", False):
43+
progress_reporter = StudioWebProgressReporter(
44+
spans_exporter=LangChainExporter()
45+
)
46+
asyncio.run(progress_reporter.subscribe_to_eval_runtime_events(event_bus))
4247

4348
def generate_runtime_context(
4449
context_entrypoint: str, langgraph_config: LangGraphConfig, **context_kwargs
@@ -48,6 +53,14 @@ def generate_runtime_context(
4853
context.entrypoint = context_entrypoint
4954
return context
5055

56+
runtime_entrypoint = entrypoint or auto_discover_entrypoint()
57+
58+
eval_context = UiPathEvalContext.with_defaults(
59+
entrypoint=runtime_entrypoint, execution_id=str(uuid.uuid4()), **kwargs
60+
)
61+
eval_context.eval_set = eval_set or EvalHelpers.auto_discover_eval_set()
62+
eval_context.eval_ids = eval_ids
63+
5164
runtime_factory = UiPathRuntimeFactory(
5265
LangGraphRuntime,
5366
LangGraphRuntimeContext,
@@ -65,9 +78,10 @@ def generate_runtime_context(
6578

6679
async def execute():
6780
async with UiPathEvalRuntime.from_eval_context(
68-
factory=runtime_factory, context=eval_context
81+
factory=runtime_factory, context=eval_context, event_bus=event_bus
6982
) as eval_runtime:
7083
await eval_runtime.execute()
84+
await event_bus.wait_for_all()
7185

7286
asyncio.run(execute())
7387
return MiddlewareResult(should_continue=False)

0 commit comments

Comments
 (0)