From e3c31917a09a594303d819a51b0b5141bf8a46cc Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Sat, 2 Sep 2023 13:52:35 -0700 Subject: [PATCH] v0 litellm --- autopr/actions/prompt.py | 3 ++- pyproject.toml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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"