Skip to content

Commit 9e7f556

Browse files
author
Andrei Bratu
authored
Flow complete fix (#42)
1 parent a652d9e commit 9e7f556

File tree

20 files changed

+442
-381
lines changed

20 files changed

+442
-381
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ __pycache__/
44
poetry.toml
55
.ruff_cache/
66
.vscode
7-
.env
7+
.env

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[project]
2+
name = "humanloop"
3+
14
[tool.poetry]
25
name = "humanloop"
36
version = "0.8.22"

src/humanloop/client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
from opentelemetry.trace import Tracer
1111

1212
from humanloop.core.client_wrapper import SyncClientWrapper
13-
from humanloop.decorators.types import DecoratorPromptKernelRequestParams
13+
from humanloop.utilities.types import DecoratorPromptKernelRequestParams
1414
from humanloop.eval_utils.context import EVALUATION_CONTEXT_VARIABLE_NAME, EvaluationContext
1515

1616
from humanloop.eval_utils import log_with_evaluation_context, run_eval
1717
from humanloop.eval_utils.types import Dataset, Evaluator, EvaluatorCheck, File
1818

1919
from humanloop.base_client import AsyncBaseHumanloop, BaseHumanloop
20-
from humanloop.decorators.flow import flow as flow_decorator_factory
21-
from humanloop.decorators.prompt import prompt as prompt_decorator_factory
22-
from humanloop.decorators.tool import tool as tool_decorator_factory
20+
from humanloop.utilities.flow import flow as flow_decorator_factory
21+
from humanloop.utilities.prompt import prompt as prompt_decorator_factory
22+
from humanloop.utilities.tool import tool as tool_decorator_factory
2323
from humanloop.environment import HumanloopEnvironment
2424
from humanloop.evaluations.client import EvaluationsClient
2525
from humanloop.otel import instrument_provider
@@ -49,7 +49,6 @@ def run(
4949
name: Optional[str],
5050
dataset: Dataset,
5151
evaluators: Optional[Sequence[Evaluator]] = None,
52-
# logs: typing.Sequence[dict] | None = None,
5352
workers: int = 4,
5453
) -> List[EvaluatorCheck]:
5554
"""Evaluate your function for a given `Dataset` and set of `Evaluators`.

src/humanloop/eval_utils/run.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,6 @@ def increment(self):
212212
sys.stderr.write("\n")
213213

214214

215-
# Module-level so it can be shared by threads.
216-
_PROGRESS_BAR: Optional[_SimpleProgressBar] = None
217-
218-
219215
def run_eval(
220216
client: "BaseHumanloop",
221217
file: File,
@@ -236,7 +232,6 @@ def run_eval(
236232
:param workers: the number of threads to process datapoints using your function concurrently.
237233
:return: per Evaluator checks.
238234
"""
239-
global _PROGRESS_BAR
240235

241236
if hasattr(file["callable"], "file"):
242237
# When the decorator inside `file` is a decorated function,

src/humanloop/otel/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
from typing import Optional, TypedDict
2-
31
from opentelemetry.sdk.trace import TracerProvider
4-
from typing_extensions import NotRequired
52

63
from humanloop.otel.helpers import module_is_installed
74

@@ -41,12 +38,3 @@ def instrument_provider(provider: TracerProvider):
4138
from opentelemetry.instrumentation.bedrock import BedrockInstrumentor
4239

4340
BedrockInstrumentor().instrument(tracer_provider=provider)
44-
45-
46-
class FlowContext(TypedDict):
47-
trace_id: NotRequired[str]
48-
trace_parent_id: NotRequired[Optional[int]]
49-
is_flow_log: NotRequired[bool]
50-
51-
52-
TRACE_FLOW_CONTEXT: dict[int, FlowContext] = {}

src/humanloop/otel/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
HUMANLOOP_LOG_KEY = "humanloop.log"
55
HUMANLOOP_FILE_TYPE_KEY = "humanloop.file.type"
66
HUMANLOOP_PATH_KEY = "humanloop.file.path"
7+
# Required for the exporter to know when to mark the Flow Log as complete
8+
HUMANLOOP_FLOW_PREREQUISITES_KEY = "humanloop.flow.prerequisites"

0 commit comments

Comments
 (0)