chore: skip unnecessary key checks prior to accessing a dictionary (#4497)
This commit is contained in:
@@ -143,7 +143,7 @@ class KnowledgeRetrievalNode(BaseNode):
|
||||
if all_documents:
|
||||
document_score_list = {}
|
||||
for item in all_documents:
|
||||
if 'score' in item.metadata and item.metadata['score']:
|
||||
if item.metadata.get('score'):
|
||||
document_score_list[item.metadata['doc_id']] = item.metadata['score']
|
||||
|
||||
index_node_ids = [document.metadata['doc_id'] for document in all_documents]
|
||||
|
Reference in New Issue
Block a user