refactor(openai.py): making it compatible for openai v1

BREAKING CHANGE:
This commit is contained in:
Krrish Dholakia 2023-11-11 15:32:14 -08:00
parent a861dd69c9
commit a5ec85b1f2
12 changed files with 622 additions and 370 deletions

View file

@ -1,16 +1,21 @@
## This is a template base class to be used for adding new LLM providers via API calls
import litellm
import requests, certifi, ssl
import httpx, certifi, ssl
class BaseLLM:
_client_session = None
def create_client_session(self):
if litellm.client_session:
session = litellm.client_session
_client_session = litellm.client_session
else:
session = requests.Session()
return session
_client_session = httpx.Client(timeout=600)
return _client_session
def __exit__(self):
if hasattr(self, '_client_session'):
self._client_session.close()
def validate_environment(self): # set up the environment required to run the model
pass