Skip to content

Commit c18ee85

Browse files
author
Andrei Bratu
committed
eval run console messages + small fix
1 parent 33c24b2 commit c18ee85

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/humanloop/evals/run.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,16 @@ def run_eval(
140140
file_exists = False
141141
try:
142142
path_ = file_.get("path")
143-
hl_file = client.files.retrieve_by_path(path=path_)
144-
if hl_file.type != type_:
145-
sys.stdout.write(
146-
f"{RED}Error in your `file` argument:\n\nThe file type {hl_file.type} does not "
147-
f"match the type of the File at {path_}: {type_}.{RESET}"
148-
)
149-
return []
150-
file_exists = True
151-
sys.stdout.write(f"{CYAN}Using the File definition from Humanloop workspace: {path_}{RESET}")
143+
if path_ is not None:
144+
hl_file = client.files.retrieve_by_path(path=path_)
145+
if hl_file.type != type_:
146+
sys.stdout.write(
147+
f"{RED}Error in your `file` argument:\n\nThe file type {type_} does not "
148+
f"match the type of the File at {path_}: {hl_file.type}.{RESET}"
149+
)
150+
return []
151+
file_exists = True
152+
sys.stdout.write(f"{CYAN}Using the File definition from Humanloop workspace: {path_}{RESET}")
152153
except ApiError as e:
153154
if e.status_code == 404:
154155
# Let's create the file
@@ -220,11 +221,13 @@ def handle_exit_signal(signum, frame):
220221
# Generate locally if a file `callable` is provided
221222
if function_ is None:
222223
# TODO: trigger run when updated API is available
223-
sys.stdout.write(f"{CYAN}\nRunning '{hl_file.name}' over the Dataset '{hl_dataset.name}'{RESET}\n")
224+
sys.stdout.write(
225+
f"{CYAN}\nRunning '{hl_file.name}' {hl_file.type.capitalize()} over the Dataset '{hl_dataset.name}'{RESET}\n"
226+
)
224227
else:
225228
# Running the evaluation locally
226229
sys.stdout.write(
227-
f"{CYAN}\nRunning '{hl_file.name}' over the Dataset '{hl_dataset.name}' using {workers} workers...{RESET}\n\n"
230+
f"{CYAN}\nRunning '{hl_file.name}' {hl_file.type.capitalize()} over the Dataset '{hl_dataset.name}' using {workers} workers...{RESET}\n\n"
228231
)
229232

230233
_PROGRESS_BAR = _SimpleProgressBar(len(hl_dataset.datapoints))

0 commit comments

Comments
 (0)