Fix Pydantic TextNode validation error - convert numpy.float32 to Python float
The similarity score was being set as a numpy.float32 from SQLite distance calculations.
Pydantic expects Python native float types for the score field, causing validation errors
when querying MCPs or using chat features.
Fix: Convert similarity score to Python float using float() conversion.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bb3f468dd4
commit
c1c8dc4da0
1 changed files with 1 additions and 1 deletions
|
|
@ -56,7 +56,7 @@ class SimpleVectorRetriever:
|
|||
results["distances"][0]
|
||||
):
|
||||
# Convert distance back to similarity score (1 - distance)
|
||||
similarity = 1 - distance
|
||||
similarity = float(1 - distance) # Convert numpy float to Python float
|
||||
|
||||
node = TextNode(
|
||||
text=content,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue