Skip to content

Commit 354ad16

Browse files
committed
feat(evals): Thread file syncer params through evaluation pipeline
1 parent 12304f3 commit 354ad16

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

src/humanloop/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ def run(
8282
dataset=dataset,
8383
evaluators=evaluators,
8484
workers=workers,
85+
use_local_files=self._use_local_files,
86+
file_syncer=self._file_syncer,
8587
)
8688

8789

src/humanloop/evals/run.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686

8787
if typing.TYPE_CHECKING:
8888
from humanloop.client import BaseHumanloop
89+
from humanloop.sync import FileSyncer
8990

9091
# Setup logging
9192
logger = logging.getLogger(__name__)
@@ -144,6 +145,8 @@ def run_eval(
144145
dataset: DatasetEvalConfig,
145146
evaluators: Optional[Sequence[EvaluatorEvalConfig]] = None,
146147
workers: int = 4,
148+
use_local_files: Optional[bool] = None,
149+
file_syncer: Optional["FileSyncer"] = None,
147150
) -> List[EvaluatorCheck]:
148151
"""
149152
Evaluate your function for a given `Dataset` and set of `Evaluators`.
@@ -158,7 +161,9 @@ def run_eval(
158161
"""
159162
evaluators_worker_pool = ThreadPoolExecutor(max_workers=workers)
160163

161-
hl_file, function_ = _get_hl_file(client=client, file_config=file)
164+
hl_file, function_ = _get_hl_file(
165+
client=client, file_config=file, file_syncer=file_syncer, use_local_files=use_local_files
166+
)
162167
# cast is safe, we can only fetch Files allowed by FileType
163168
type_ = typing.cast(FileType, hl_file.type)
164169
try:
@@ -436,7 +441,12 @@ def _safe_get_default_file_version(client: "BaseHumanloop", file_config: FileEva
436441
raise HumanloopRuntimeError("You must provide either the path or the id in your `file` config.")
437442

438443

439-
def _resolve_file(client: "BaseHumanloop", file_config: FileEvalConfig) -> tuple[EvaluatedFile, Optional[Callable]]:
444+
def _resolve_file(
445+
client: "BaseHumanloop",
446+
file_config: FileEvalConfig,
447+
file_syncer: Optional["FileSyncer"],
448+
use_local_files: Optional[bool],
449+
) -> tuple[EvaluatedFile, Optional[Callable]]:
440450
"""Resolve the File to be evaluated. Will return a FileResponse and an optional callable.
441451
442452
If the callable is null, the File will be evaluated on Humanloop. Otherwise, the File will be evaluated locally.
@@ -497,7 +507,12 @@ def _resolve_file(client: "BaseHumanloop", file_config: FileEvalConfig) -> tuple
497507
), None
498508

499509

500-
def _get_hl_file(client: "BaseHumanloop", file_config: FileEvalConfig) -> tuple[EvaluatedFile, Optional[Callable]]:
510+
def _get_hl_file(
511+
client: "BaseHumanloop",
512+
file_config: FileEvalConfig,
513+
file_syncer: Optional["FileSyncer"],
514+
use_local_files: Optional[bool],
515+
) -> tuple[EvaluatedFile, Optional[Callable]]:
501516
"""Check if the config object is valid, and resolve the File to be evaluated.
502517
503518
The callable will be null if the evaluation will happen on Humanloop runtime.
@@ -506,7 +521,12 @@ def _get_hl_file(client: "BaseHumanloop", file_config: FileEvalConfig) -> tuple[
506521
file_ = _file_or_file_inside_hl_decorator(file_config)
507522
file_ = _check_file_type(file_)
508523

509-
return _resolve_file(client=client, file_config=file_)
524+
return _resolve_file(
525+
client=client,
526+
file_config=file_,
527+
file_syncer=file_syncer,
528+
use_local_files=use_local_files,
529+
)
510530

511531

512532
def _callable_is_hl_utility(file_config: FileEvalConfig) -> bool:

0 commit comments

Comments
 (0)