Skip to content

Commit 63442e1

Browse files
[BFCL] Add Validation for Model Names (#1008)
Throw clear error messages when model name is unknown/invalid.
1 parent 61f8a4f commit 63442e1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

berkeley-function-call-leaderboard/bfcl/_llm_response_generation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,13 @@ def main(args):
276276
all_test_entries_involved,
277277
) = get_involved_test_entries(args.test_category, args.run_ids)
278278

279+
for model_name in args.model:
280+
if model_name not in HANDLER_MAP:
281+
raise ValueError(
282+
f"Unknown model_name '{model_name}'.\n"
283+
"• For officially supported models, please refer to `SUPPORTED_MODELS.md`.\n"
284+
"• For running new models, please refer to `README.md` and `CONTRIBUTING.md`."
285+
)
279286
print(f"Generating results for {args.model}")
280287
if args.run_ids:
281288
print("Running specific test cases. Ignoring `--test-category` argument.")

berkeley-function-call-leaderboard/bfcl/eval_checker/eval_runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ def main(model, test_categories, result_dir, score_dir):
488488
if model:
489489
model_names = []
490490
for model_name in model:
491+
if model_name not in HANDLER_MAP:
492+
raise ValueError(f"Invalid model name '{model_name}'.")
491493
# Runner takes in the model name that contains "_", instead of "/", for the sake of file path issues.
492494
# This is differnet than the model name format that the generation script "openfunctions_evaluation.py" takes in (where the name contains "/").
493495
# We patch it here to avoid confusing the user.

0 commit comments

Comments
 (0)