fix: filter None chunk results in graph merge_batch_data - #69
Merged
yifanfeng97 merged 2 commits intoAug 12, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In one-stage extraction, the single-chunk path does:
with_structured_output(method="function_calling")can returnNonewhen the model emits no tool call.merge_batch_data([None])then falls through to the tuple branch and hitsassert len(data_list_or_tuple) == 2, raisingAssertionErrorinstead of degrading gracefully. (The multi-chunkbatchpath already filters None via_filter_none_results; the single-chunk path did not.)This affects
AutoGraph,AutoHypergraph, and the three specialized graphs (AutoTemporalGraph,AutoSpatialGraph,AutoSpatioTemporalGraph), which all inheritmerge_batch_data.Fix
Filter
Noneentries from the list form at the top ofmerge_batch_data(ingraph.pyandhypergraph.py— the only two definitions). An all-Nonelist returns an empty graph. The tuple form ((nodes_lists, edges_lists)) is a tuple, not a list, so it's unaffected. Fixing this one chokepoint covers all five graph types.Tests
merge_batch_data([None])returns an empty graph/hypergraph instead of raising, for bothAutoGraphandAutoHypergraph. Both fail withAssertionErroron the pre-fix code.ruff check/ruff format --checkonhyperextractclean.