fix(utils.py): return optional params from groq

This commit is contained in:
Krrish Dholakia 2024-07-17 12:09:08 -07:00
parent 73bfc299f7
commit a176feeacc
2 changed files with 8 additions and 2 deletions

View file

@ -5813,6 +5813,11 @@ def convert_to_model_response_object(
if "text" in response_object:
model_response_object.text = response_object["text"]
optional_keys = ["language", "task", "duration", "words", "segments"]
for key in optional_keys: # not guaranteed to be in response
if key in response_object:
setattr(model_response_object, key, response_object[key])
if hidden_params is not None:
model_response_object._hidden_params = hidden_params
return model_response_object