feat(memory): LLM-powered entity and relation extraction pipeline (#1225)#1247
Merged
feat(memory): LLM-powered entity and relation extraction pipeline (#1225)#1247
Conversation
) Add GraphExtractor and EntityResolver for Phase 2 of graph memory. GraphExtractor uses chat_typed_erased for structured LLM extraction with graceful parse-failure degradation. EntityResolver performs case-insensitive entity resolution with unknown-type coercion to Concept, edge deduplication, and temporal supersession. Includes entity name sanitization (control chars, BiDi overrides, length cap), edges_exact() for unidirectional queries, and 33 new tests.
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
GraphExtractorwith LLM-powered entity/relation extraction viachat_typed_erased, 10-rule system prompt, truncation guards, and graceful parse-failure degradation (Ok(None))EntityResolverwith case-insensitive entity resolution (exact name+type match, unknown types coerced toConcept), edge deduplication, and temporal supersession of contradictory edgesGraphStore::edges_exact()for unidirectional edge queries (PERF-01 fix)graph-memorywith explicitzeph-llm/schemadependencyTest delta: 4084 → 4094 (+33 new tests, 10 from security/perf fixes)
Test plan
cargo +nightly fmt --checkpassescargo clippy --workspace --features full -- -D warningspasses (zero warnings)cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --binspasses (4094/4094)Closes #1225