Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix specifying API arguments from the CLI #1505

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions evals/cli/oaieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def run(args: OaiEvalArguments, registry: Optional[Registry] = None) -> str:
# If the user provided an argument to --completion_args, parse it into a dict here, to be passed to the completion_fn creation **kwargs
completion_args = args.completion_args.split(",")
additonal_completion_args = {k: v for k, v in (kv.split("=") for kv in completion_args if kv)}
# if the user provides temperature, transform that into a number:
if "temperature" in additonal_completion_args:
additonal_completion_args["temperature"] = float(additonal_completion_args["temperature"])

completion_fns = args.completion_fn.split(",")
completion_fn_instances = [
Expand Down
4 changes: 2 additions & 2 deletions evals/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def make_completion_fn(
n_ctx = n_ctx_from_model_name(name)

if is_chat_model(name):
return OpenAIChatCompletionFn(model=name, n_ctx=n_ctx, **kwargs)
return OpenAIChatCompletionFn(model=name, n_ctx=n_ctx, extra_options=kwargs)
elif name in self.api_model_ids:
return OpenAICompletionFn(model=name, n_ctx=n_ctx, **kwargs)
return OpenAICompletionFn(model=name, n_ctx=n_ctx, extra_options=kwargs)

# No match, so try to find a completion-fn-id in the registry
spec = self.get_completion_fn(name)
Expand Down