unstructured2graph: derive entity workspace instead of hardcoding "base"#241
Merged
Conversation
connect_chunks_to_entities was called with the literal "base", which is just LightRAG's default-workspace fallback duplicated as a magic string. Add an entity_workspace param (default None) that auto-derives the resolved value from lightrag_wrapper.get_lightrag().chunk_entity_relation_graph.workspace, falling back to "base" with a logged warning if that ever fails. Fixes #235
…ace-resolution # Conflicts: # unstructured2graph/src/unstructured2graph/loaders.py # unstructured2graph/tests/test_loaders.py
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.
Summary
connect_chunks_to_entities(memgraph, "Chunk", "base")hardcoded"base", which is just LightRAG's private default-workspace fallback (MEMGRAPH_WORKSPACEenv var -> constructorworkspace=->"base") duplicated as a magic string. If a caller ever customizes the workspace (multi-tenant graph), entity-to-chunk linking silently breaks -- noMENTIONED_INedges, no error.entity_workspace: str | None = Nonetofrom_unstructured. WhenNone, it auto-derives the live value vialightrag_wrapper.get_lightrag().chunk_entity_relation_graph.workspace, with a try/except fallback to"base"(logged) if that attribute ever moves.Test plan
entity_workspaceoverride is passed through untouched."base"with a warning when auto-derive raises.pytest tests/test_loaders.pypasses.Closes #235