fix(utils.py): fix reordering of items for cached embeddings

ensures cached embedding item is returned in correct order
This commit is contained in:
Krrish Dholakia 2024-04-08 12:17:57 -07:00
parent 28e4706bfd
commit 48bfc45cb0
3 changed files with 53 additions and 1 deletions

View file

@ -3174,7 +3174,13 @@ def client(original_function):
for val in non_null_list:
idx, cr = val # (idx, cr) tuple
if cr is not None:
final_embedding_cached_response.data[idx] = cr
final_embedding_cached_response.data[idx] = (
Embedding(
embedding=cr["embedding"],
index=idx,
object="embedding",
)
)
if len(remaining_list) == 0:
# LOG SUCCESS
cache_hit = True