From c1c8dc4da06328c67bc0a32b52f6d0f367cf17fb Mon Sep 17 00:00:00 2001 From: Bob Roberts Date: Mon, 27 Oct 2025 20:09:43 -0500 Subject: [PATCH] Fix Pydantic TextNode validation error - convert numpy.float32 to Python float MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/core/rag_engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/rag_engine.py b/app/core/rag_engine.py index 4953b01..e5b12e2 100644 --- a/app/core/rag_engine.py +++ b/app/core/rag_engine.py @@ -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,