From 9cf07129a9b78cea45236d5a5287d261aa28ea76 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 9 Oct 2024 14:25:58 -0400 Subject: [PATCH] Support 'openai/' for backwards-compatibility, removing in next release. --- src/cwhy/cwhy.py | 13 +++++++++++++ src/cwhy/prompts.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cwhy/cwhy.py b/src/cwhy/cwhy.py index c3fafc8..ebc8f0a 100755 --- a/src/cwhy/cwhy.py +++ b/src/cwhy/cwhy.py @@ -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( diff --git a/src/cwhy/prompts.py b/src/cwhy/prompts.py index 458f10a..e11bac7 100644 --- a/src/cwhy/prompts.py +++ b/src/cwhy/prompts.py @@ -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