diff --git a/autopr/actions/prompt.py b/autopr/actions/prompt.py index 5fb49862..bc882c61 100644 --- a/autopr/actions/prompt.py +++ b/autopr/actions/prompt.py @@ -5,6 +5,7 @@ from typing import Any, Optional, Literal import openai +from litellm import acompletion import openai.error import tenacity from pydantic import BaseModel @@ -175,7 +176,7 @@ def build_prompt_and_instructions(self, inputs: Inputs) -> tuple[str, str]: ) async def invoke_openai(self, inputs: Inputs, prompt: str, instructions: str) -> str: self.log.info("Invoking OpenAI API...") - result = await openai.ChatCompletion.acreate( + result = await acompletion( messages=[ { "role": "system", diff --git a/pyproject.toml b/pyproject.toml index 6ac5c511..b872fed4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ pyyaml = "^6.0" tiktoken = "^0.4.0" jinja2 = "^3.1.2" openai = "^0.27.9" +litellm = "^0.1.400" [tool.poetry.group.test.dependencies] pyright = "^1.1.306"