Fix TextNode score validation - pass score during initialization
Instead of setting node.score after creation (which fails Pydantic validation),
pass the score parameter during TextNode initialization. This ensures the score
field is properly validated during object creation.
This fixes the error: 'Object has no attribute score' in chat and search endpoints.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c1c8dc4da0
commit
2a0f07f951
1 changed files with 2 additions and 2 deletions
|
|
@ -61,9 +61,9 @@ class SimpleVectorRetriever:
|
|||
node = TextNode(
|
||||
text=content,
|
||||
id_=doc_id,
|
||||
metadata=metadata
|
||||
metadata=metadata,
|
||||
score=similarity # Pass score during initialization for Pydantic validation
|
||||
)
|
||||
node.score = similarity
|
||||
nodes.append(node)
|
||||
|
||||
return nodes
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue