Skip to content

Add opt-in event_entity KG builder, event_join partitioner and event extraction profiles - #195

Open
Leon-Algo wants to merge 1 commit into
InternScience:mainfrom
Leon-Algo:pr-c-event-entity-pipeline
Open

Leon-Algo wants to merge 1 commit into
InternScience:mainfrom
Leon-Algo:pr-c-event-entity-pipeline

Conversation

@Leon-Algo

Copy link
Copy Markdown

Summary

  • Opt-in event pipeline: kg_method: event_entity builds an EVENT star graph via a profile-driven extractor; partition.method: event_join groups same-anchor events. Default light_rag + ECE route is untouched.
  • Event profiles: graphgen/templates/event_profile_loader.py validates manifest+prompt fail-closed with SHA-256 lineage. Ships only generic_event.v1 as an example; no default profile — event_entity mode without an explicit event_profile errors instead of falling back to a domain policy.
  • External profile paths preserved end-to-end: BuildKGService validates at init but passes the original path reference through to the builder (fixes the second-load event_profile_not_found bug flagged in Add versioned prompt profiles and event-entity generation pipeline #192).
  • Support citations fixed: <support> edge citations accept the rendered -- separator and both endpoint orders, canonicalize to stored orientation, and closure validation accepts only edges that actually exist in the partition (fixes the always-stripped citations bug flagged in Add versioned prompt profiles and event-entity generation pipeline #192).
  • Membership edges self-describing: extract() sets event_member=True at creation and deterministic merge persists the participant role (fixes direct-builder misuse and role loss flagged in Add versioned prompt profiles and event-entity generation pipeline #192).
  • Robust partitioning: a missing-anchor event is skipped (consistent with extraction's drop-and-count) instead of raising and killing the whole partition stage.
  • No PMS profiles/gates/docs, no import-time file I/O, no fork identity.

Third of three PRs split from #192 per review. Depends on #193 (partitioner test fixes; the ECE integration tests don't collect on main) and #194 (profile/prefill/LLM mechanisms this builds on).

Validation

  • pytest tests/unit_tests → 13 passed: disk-profile service→builder propagation, citations both orders + strict closure, anchor skip, merge role persistence, direct extraction marker, loader validation.
  • Default-route check: PR A's synced ECE tests run green against this branch's production code.
  • pylint on all touched modules → 10.00/10.

🤖 Generated with Claude Code

…event profiles

改了什么:
- 新增 profile 驱动的 event_contract/event_entity 星型图构建器:事件节点带 anchor 与 graph_role,成员边在 extract() 即写入 event_member 标记与 role,事件/参与者/成员边合并全部确定性完成并持久化 role
- 新增 EventJoinPartitioner:按共享参与者 join 事件星型子图,缺 anchor 事件跳过而非报错,require_same_anchor 硬约束跨锚扩展
- 新增 event_profile_loader 与内置 generic_event.v1 唯一示例 profile:event_entity 模式强制要求 event_profile,无任何隐式默认;显式文件路径 profile 在 service→builder 全链路原样透传
- 新增 generator support 视图:生成期把事件 ID 换成可读名,support 边引用支持渲染的 "--" 格式且双向端点序均可解析回 canonical 边,closure 校验只接受实际存在的节点/边
- BuildKGService 增加 kg_method=event_entity opt-in 分发,PartitionService 增加 event_join 分发;MANIFEST 收录 event_profiles 数据文件

达成什么目标:不改动 LightRAG 默认链路的前提下,为上游提供可插拔的事件-实体图能力;focused 单测(profile 经 service→builder 磁盘加载、双向边引用严格 closure、anchor 跳过、合并 role 持久化、直接抽取标记)与默认 ECE 分区器测试全部通过,touched 生产模块 pylint 10.00/10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Leon-Algo pushed a commit to Leon-Algo/GraphGen that referenced this pull request Oct 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant