From 1b8155b1f8aecd36ff7dc1d4644c8da5db7b7406 Mon Sep 17 00:00:00 2001 From: octo-patch Date: Mon, 20 Apr 2026 11:08:13 +0800 Subject: [PATCH] fix: remove trailing comma wrapping triples in tuple in _invoke (fixes #743) In the synchronous _invoke method of SchemaFreeExtractor, the result of triples_extraction was accidentally wrapped in a 1-element tuple due to a trailing comma: triples = (self.triples_extraction(passage, filtered_entities),) When assemble_sub_graph_with_triples iterates for tri in triples, it would receive the whole list of triples as a single element (not individual triples), causing the len(tri) != 3 check to discard every relationship. The async _ainvoke path was unaffected because it used asyncio.gather. Fix: remove the trailing comma so triples holds the list directly. --- kag/builder/component/extractor/schema_free_extractor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kag/builder/component/extractor/schema_free_extractor.py b/kag/builder/component/extractor/schema_free_extractor.py index 6890adc2f..d33b04012 100644 --- a/kag/builder/component/extractor/schema_free_extractor.py +++ b/kag/builder/component/extractor/schema_free_extractor.py @@ -512,7 +512,7 @@ def _invoke(self, input: Input, **kwargs) -> List[Output]: {k: v for k, v in ent.items() if k in ["name", "category"]} for ent in entities ] - triples = (self.triples_extraction(passage, filtered_entities),) + triples = self.triples_extraction(passage, filtered_entities) std_entities = self.named_entity_standardization(passage, filtered_entities) self.append_official_name(entities, std_entities) self.assemble_sub_graph(sub_graph, input, entities, triples)