Closed li-xiu-qi closed 1 month ago
Hi @li-xiu-qi, thanks for the PR. The error is due to using op('<=>')
instead of op('<=>', return_type=Float)
. I'd recommend using the CosineDistance
function instead.
(also, what's labeled as similarity_score
is the distance, not the similarity, so the threshold logic should be reversed)
Your opinion is valid, thank you!
I encountered an error after modifying my code. The original code was:
I modified it to:
After this change, I encountered an error. The error traceback pointed to the following method:
The error message was:
Upon debugging, I found that initially, a string vector was passed, but later, a float value was passed, causing the error. I modified the method to handle both cases:
This resolved the error, and the similarity score was returned correctly. However, I am unsure of the underlying cause of this issue.
Proposed Solution
The issue seems to be related to the inconsistent types of
value
being passed to thefrom_text
method. The method now handles both float and string inputs, ensuring compatibility. This fix should be sufficient for now, but further investigation into why the type inconsistency occurs might be necessary for a more robust solution.Please let me know if you need any further details or adjustments.