implement deployment id

This commit is contained in:
Paul Gauthier 2023-12-05 11:31:17 -08:00
parent bf03f43b44
commit b107db98fa
8 changed files with 21 additions and 13 deletions

View file

@ -28,10 +28,15 @@ CACHE = None
f"{details.get('exception','Exception')}\nRetry in {details['wait']:.1f} seconds."
),
)
def send_with_retries(client, model_name, messages, functions, stream):
def send_with_retries(client, model, messages, functions, stream):
if not client:
raise ValueError("No openai client provided")
if model.deployment_id:
model_name = model.deployment_id
else:
model_name = model.name
kwargs = dict(
model=model_name,
messages=messages,
@ -57,11 +62,11 @@ def send_with_retries(client, model_name, messages, functions, stream):
return hash_object, res
def simple_send_with_retries(client, model_name, messages):
def simple_send_with_retries(client, model, messages):
try:
_hash, response = send_with_retries(
client=client,
model_name=model_name,
model=model,
messages=messages,
functions=None,
stream=False,