Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Ensure consistent float type for cached embedding return values (#10185)

kazuya-awano2d6865d42125
diff --git a/api/core/rag/embedding/cached_embedding.py b/api/core/rag/embedding/cached_embedding.py
index 1157c5c8e44..fc8e0440c33 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