Content-Length: 1830 | pFad | http://github.com/postgresml/postgresml/pull/1112.patch
thub.com
From def9fb934b04879956ae5fd2b1b95df79885df27 Mon Sep 17 00:00:00 2001
From: ishaan-jaff
Date: Sat, 21 Oct 2023 17:44:20 -0700
Subject: [PATCH 1/2] v0 add litellm
---
pgml-apps/pgml-chat/pgml_chat/main.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pgml-apps/pgml-chat/pgml_chat/main.py b/pgml-apps/pgml-chat/pgml_chat/main.py
index 4b731b8bc..1ebc46cb8 100644
--- a/pgml-apps/pgml-chat/pgml_chat/main.py
+++ b/pgml-apps/pgml-chat/pgml_chat/main.py
@@ -10,6 +10,7 @@
import argparse
from time import time
import openai
+import litellm
import signal
import ast
@@ -120,9 +121,9 @@ async def upsert_documents(folder: str) -> int:
async def generate_response(
messages, openai_api_key, temperature=0.7, max_tokens=256, top_p=0.9
):
- openai.api_key = openai_api_key
+ litellm.api_key = openai_api_key
log.debug("Generating response from OpenAI API: " + str(messages))
- response = openai.ChatCompletion.create(
+ response = litellm.completion(
model="gpt-3.5-turbo",
messages=messages,
temperature=temperature,
From d6defceabdd8c8b6a15ccf54bdbc570749c650e6 Mon Sep 17 00:00:00 2001
From: ishaan-jaff
Date: Sat, 21 Oct 2023 17:45:13 -0700
Subject: [PATCH 2/2] add litellm to pyproject
---
pgml-apps/pgml-chat/pyproject.toml | 1 +
1 file changed, 1 insertion(+)
diff --git a/pgml-apps/pgml-chat/pyproject.toml b/pgml-apps/pgml-chat/pyproject.toml
index 10f9c95e9..20cb6327b 100644
--- a/pgml-apps/pgml-chat/pyproject.toml
+++ b/pgml-apps/pgml-chat/pyproject.toml
@@ -10,6 +10,7 @@ packages = [{include = "pgml_chat"}]
[tool.poetry.dependencies]
python = ">=3.8,<4.0"
openai = "^0.27.8"
+litellm = "^0.11.1"
rich = "^13.4.2"
pgml = "^0.9.0"
python-dotenv = "^1.0.0"
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/postgresml/postgresml/pull/1112.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy