chore: skip unnecessary key checks prior to accessing a dictionary (#4497)
This commit is contained in:
parent
aa13d14019
commit
04ad46dd31
30 changed files with 45 additions and 44 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue