Content-Length: 1251 | pFad | http://github.com/postgresml/postgresml/pull/1112.diff

thub.com 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, 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"








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgresml/postgresml/pull/1112.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy