mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
refactor(openai.py): making it compatible for openai v1
BREAKING CHANGE:
This commit is contained in:
parent
833c38edeb
commit
d3323ba637
12 changed files with 622 additions and 370 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue