Merge pull request #985 from estill01/patch-1

Enable setting default `model` value for `LiteLLM`, `Chat`, `Completions`
This commit is contained in:
Krish Dholakia 2023-12-09 13:59:00 -08:00 committed by GitHub
commit cc4a1d2603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -99,17 +99,18 @@ class Chat():
def __init__(self, params):
self.params = params
self.completions = Completions(self.params)
class Completions():
def __init__(self, params):
self.params = params
def create(self, model, messages, **kwargs):
def create(self, messages, model=None, **kwargs):
for k, v in kwargs.items():
self.params[k] = v
model = model or self.params.get('model')
response = completion(model=model, messages=messages, **self.params)
return response
return response
@client
async def acompletion(*args, **kwargs):