Skip to content

Commit

Permalink
Support 'openai/' for backwards-compatibility, removing in next release.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicovank committed Oct 9, 2024
1 parent 17379f1 commit 9cf0712
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/cwhy/cwhy.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ def main(args: argparse.Namespace) -> None:
print("==================================================")
print("CWhy")
print("==================================================")

# TODO: Remove this after issuing next release.
if "/" in args.llm:
print(
"[CWHY WARNING] CWhy went back to using the OpenAI API only (not LiteLLM).",
"[CWHY WARNING] Please specify the model name directly without any prefix.",
f"[CWHY WARNING] e.g. {args.llm[args.llm.index('/') + 1:]}.",
"[CWHY WARNING] If you were using AWS, you can specify OPENAI_BASE_URL instead.",
file=sys.stderr,
sep="\n",
)
args.llm = args.llm[args.llm.index("/") + 1 :]

try:
client = openai.OpenAI()
result = evaluate(
Expand Down
2 changes: 1 addition & 1 deletion src/cwhy/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, args: argparse.Namespace, diagnostic: str):
)
except FileNotFoundError:
print(
f"Cwhy warning: file not found: {file_name.lstrip()}",
f"[CWHY WARNING] file not found: {file_name.lstrip()}",
file=sys.stderr,
)
continue
Expand Down

0 comments on commit 9cf0712

Please sign in to comment.