Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
parent
95a7e50137
commit
463fbe2680
5 changed files with 18 additions and 4 deletions
|
|
@ -116,6 +116,8 @@ class CacheEmbedding(Embeddings):
|
|||
|
||||
embedding_results = embedding_result.embeddings[0]
|
||||
embedding_results = (embedding_results / np.linalg.norm(embedding_results)).tolist()
|
||||
if np.isnan(embedding_results).any():
|
||||
raise ValueError("Normalized embedding is nan please try again")
|
||||
except Exception as ex:
|
||||
if dify_config.DEBUG:
|
||||
logging.exception(f"Failed to embed query text '{text[:10]}...({len(text)} chars)'")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue