From 8934ce2fd521646f9ec82308b5b4f2dad1848958 Mon Sep 17 00:00:00 2001 From: kazuya-awano Date: Sat, 2 Nov 2024 08:23:06 +0900 Subject: [PATCH] fix: change return value to float when using cache --- api/core/rag/embedding/cached_embedding.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/core/rag/embedding/cached_embedding.py b/api/core/rag/embedding/cached_embedding.py index b3e93ce760..9a17c42cdf 100644 --- a/api/core/rag/embedding/cached_embedding.py +++ b/api/core/rag/embedding/cached_embedding.py @@ -102,7 +102,8 @@ class CacheEmbedding(Embeddings): embedding = redis_client.get(embedding_cache_key) if embedding: redis_client.expire(embedding_cache_key, 600) - return list(np.frombuffer(base64.b64decode(embedding), dtype="float")) + decoded_embedding = np.frombuffer(base64.b64decode(embedding), dtype="float") + return [float(x) for x in decoded_embedding] try: embedding_result = self._model_instance.invoke_text_embedding( texts=[text], user=self._user, input_type=EmbeddingInputType.QUERY