fix: remove trailing comma that wrapped triples result in tuple in _invoke#745
Open
octo-patch wants to merge 1 commit intoOpenSPG:masterfrom
Open
fix: remove trailing comma that wrapped triples result in tuple in _invoke#745octo-patch wants to merge 1 commit intoOpenSPG:masterfrom
octo-patch wants to merge 1 commit intoOpenSPG:masterfrom
Conversation
…OpenSPG#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.
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.
Fixes #743
Problem
In the synchronous
_invokemethod ofSchemaFreeExtractor, the result oftriples_extractionwas accidentally wrapped in a 1-element tuple due to a trailing comma:When
assemble_sub_graph_with_triplesiteratesfor tri in triples:, it received the entire list of triples as a single element rather than iterating individual triples. The checkif tri is None or len(tri) != 3:then always skipped this element (since the list length is not 3), causing all relationships to be silently dropped in synchronous extraction mode.The async
_ainvokepath was unaffected because it usesasyncio.gather, which unpacks results correctly intotriplesdirectly.Solution
Remove the trailing comma so
triplesholds the list returned bytriples_extractiondirectly:Testing
The fix aligns the synchronous
_invokebehavior with the async_ainvokepath, which already worked correctly. The one-character change (removing the trailing comma) is the minimal fix needed.