mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
fix(utils.py): fix embedding response output parsing
This commit is contained in:
parent
227215cee2
commit
c22b71bb04
3 changed files with 102 additions and 53 deletions
|
@ -325,21 +325,8 @@ class AzureChatCompletion(BaseLLM):
|
|||
original_response=response,
|
||||
)
|
||||
|
||||
embedding_response = json.loads(response.model_dump_json())
|
||||
output_data = []
|
||||
for idx, embedding in enumerate(embedding_response["data"]):
|
||||
output_data.append(
|
||||
{
|
||||
"object": embedding["object"],
|
||||
"index": embedding["index"],
|
||||
"embedding": embedding["embedding"]
|
||||
}
|
||||
)
|
||||
model_response["object"] = "list"
|
||||
model_response["data"] = output_data
|
||||
model_response["model"] = "azure/" + model
|
||||
model_response["usage"] = embedding_response["usage"]
|
||||
return model_response
|
||||
|
||||
return convert_to_model_response_object(response_object=json.loads(response.model_dump_json()), model_response_object=model_response, response_type="embedding")
|
||||
except AzureOpenAIError as e:
|
||||
exception_mapping_worked = True
|
||||
raise e
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue