mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 10:14:26 +00:00
fix(utils.py): fix embedding response object conversion
This commit is contained in:
parent
e43e1e9ab1
commit
2eb7386095
2 changed files with 4 additions and 5 deletions
|
@ -90,7 +90,7 @@ def test_embedding_caching():
|
|||
print(f"embedding2: {embedding2}")
|
||||
pytest.fail("Error occurred: Embedding caching failed")
|
||||
|
||||
# test_embedding_caching()
|
||||
test_embedding_caching()
|
||||
|
||||
|
||||
def test_embedding_caching_azure():
|
||||
|
|
|
@ -3330,10 +3330,9 @@ def convert_to_model_response_object(response_object: Optional[dict]=None, model
|
|||
index = embedding.get("index", idx),
|
||||
object=embedding.get("object", "embedding")
|
||||
)
|
||||
if isinstance(embedding_obj, EmbeddingResponse):
|
||||
embedding_data.append(embedding_obj)
|
||||
if len(embedding_data) > 0:
|
||||
model_response_object.data = embedding_data
|
||||
embedding_data.append(embedding_obj)
|
||||
|
||||
model_response_object.data = embedding_data
|
||||
|
||||
if "usage" in response_object and response_object["usage"] is not None:
|
||||
model_response_object.usage.completion_tokens = response_object["usage"].get("completion_tokens", 0) # type: ignore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue