Skip to content

unstructured2graph: derive entity workspace instead of hardcoding "base"#241

Merged
antejavor merged 2 commits into
mainfrom
fix/235-entity-workspace-resolution
Jul 23, 2026
Merged

unstructured2graph: derive entity workspace instead of hardcoding "base"#241
antejavor merged 2 commits into
mainfrom
fix/235-entity-workspace-resolution

Conversation

@antejavor

Copy link
Copy Markdown
Contributor

Summary

  • connect_chunks_to_entities(memgraph, "Chunk", "base") hardcoded "base", which is just LightRAG's private default-workspace fallback (MEMGRAPH_WORKSPACE env var -> constructor workspace= -> "base") duplicated as a magic string. If a caller ever customizes the workspace (multi-tenant graph), entity-to-chunk linking silently breaks -- no MENTIONED_IN edges, no error.
  • Added entity_workspace: str | None = None to from_unstructured. When None, it auto-derives the live value via lightrag_wrapper.get_lightrag().chunk_entity_relation_graph.workspace, with a try/except fallback to "base" (logged) if that attribute ever moves.

Test plan

  • Explicit entity_workspace override is passed through untouched.
  • Auto-derives from the wrapper's resolved LightRAG workspace when not provided.
  • Falls back to "base" with a warning when auto-derive raises.
  • pytest tests/test_loaders.py passes.

Closes #235

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
@antejavor
antejavor merged commit a4ccb5a into main Jul 23, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unstructured2graph: entity-link hardcodes LightRAG's private "base" workspace default

1 participant