diff --git a/py/core/pipes/kg/triples_extraction.py b/py/core/pipes/kg/triples_extraction.py index 69fe9c652..9037e22c3 100644 --- a/py/core/pipes/kg/triples_extraction.py +++ b/py/core/pipes/kg/triples_extraction.py @@ -289,7 +289,7 @@ async def _run_logic( # type: ignore # sort the extractions accroding to chunk_order field in metadata in ascending order extractions = sorted( - extractions, key=lambda x: x.metadata["chunk_order"] + extractions, key=lambda x: x.metadata.get("chunk_order", float('inf')) ) # group these extractions into groups of extraction_merge_count