diff --git a/bigcode_eval/tasks/humanevalpack_openai.py b/bigcode_eval/tasks/humanevalpack_openai.py index 742382747..958740a24 100644 --- a/bigcode_eval/tasks/humanevalpack_openai.py +++ b/bigcode_eval/tasks/humanevalpack_openai.py @@ -37,6 +37,7 @@ def get_prompt_base(doc, language="python"): import os import openai +import litellm import jsonlines import termcolor @@ -170,7 +171,8 @@ def __call__(self, prompt: str, n: int) -> str: ] while True: try: - response = openai.ChatCompletion.create( + # Equivalent to response = openai.ChatCompletion.create( + response = litellm.completion( model=self._model, messages=messages, temperature=0.2, @@ -199,8 +201,11 @@ def __call__(self, prompt: str, n: int) -> str: with jsonlines.open(f"completions_{LANGUAGE}_humanevalexplaindescribe.jsonl", "r") as f: descriptions = [line["raw_generation"][0] for line in f] - openai.organization = os.getenv("OPENAI_ORGANIZATION") - openai.api_key = os.getenv("OPENAI_API_KEY") + # Equivalent to: + # openai.organization = os.getenv("OPENAI_ORGANIZATION") + # openai.api_key = os.getenv("OPENAI_API_KEY") + litellm.organization = os.getenv("OPENAI_ORGANIZATION") + litellm.api_key = os.getenv("OPENAI_API_KEY") samples = [s for s in load_dataset("bigcode/humanevalpack", LANGUAGE)["test"]] diff --git a/setup.py b/setup.py index cf80c7d24..663d33e7d 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ "matplotlib==3.5.2", "numpy==1.21.6", "openai==0.23.0", + "litellm==0.13.2", "pandas==1.3.5", "pandas-datareader==0.10.0", "pathlib==1.0.1",