Skip to content

feat: implement localized relationship predicate extraction for graph edges (#799) - #803

Closed
suhaniiz wants to merge 531 commits into
param20h:devfrom
suhaniiz:feat/relationship-extraction-799
Closed

feat: implement localized relationship predicate extraction for graph edges (#799)#803
suhaniiz wants to merge 531 commits into
param20h:devfrom
suhaniiz:feat/relationship-extraction-799

Conversation

@suhaniiz

@suhaniiz suhaniiz commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

📋 PR Checklist

Thank you for contributing to PDF-Assistant-RAG! 🎉
Please fill out this template before submitting. PRs without it filled in will be closed.


🔗 Related Issue

Closes #799


📝 What does this PR do?

Implements a direct local relationship extraction feature (predicate labeling) for the knowledge graph building pipeline.

Previously, the GraphRAG implementation built a standard co-occurrence network, incrementing an edge weight but dropping all semantic contextual information explaining why those entities appeared together. This limited the accuracy of downstream LLM RAG queries.

This PR introduces an extract_relationship_predicate() utility that isolates the textual span between matching entities within a given text chunk. This semantic context description is stored directly within a mutable relationships set on graph edges, which is safely serialized into clean JSON arrays during the graph sanitization phase.


🗂️ Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🔧 Refactor / code cleanup
  • 📝 Documentation update
  • 🎨 UI / styling change
  • ⚙️ CI / tooling / config change
  • 🧪 Tests

🧪 How was this tested?

  • Tested the affected API endpoints manually
  • Verified that generated edge objects inside the serialized graph data file save with clean "relationships": [...] list string arrays.

📸 Screenshots (if UI change)

N/A (Backend feature)


⚠️ Anything to flag for reviewers?

The predicate window extraction features basic boundary slicing and multi-space scrubbing fallbacks. It runs locally without needing an external LLM, maintaining low ingestion costs and fast building loop benchmarks.


✅ Self-Review Checklist

  • My branch is based on dev, not main
  • I have not added any secrets / API keys
  • I have not modified main branch or any HuggingFace deployment config
  • My code follows the existing style (no unnecessary formatting changes)
  • I have updated relevant docs / comments if needed

param20h and others added 30 commits May 31, 2026 15:11
feat(rag): Refactor LLM agent to use dynamic per-user tokens
fix(db): Update UUID generation for Postgres compatibility
…hooks-issue58

devops: add pre-commit hooks for black, flake8, and prettier (param20h#58)
…ue56

test: add snapshot tests for key frontend components (param20h#56)
…n-Input

fix(01): HuggingFaceTokenModal - apply code review fixes
feat: add table-aware PDF chunking with pdfplumber
…dge-graph

feat: add GraphRAG knowledge graph context
Updated retriever.py to use langchain_classic.retrievers for EnsembleRetriever, which is required in the latest versions. Added langchain-classic to requirements.txt.
Adjusted test_retriever.py to expect the new stable sort order and rank-based scores (1.0) introduced by the hybrid search integration.
…tests

1. Updated retriever.py import to use langchain_classic and fixed typos.
2. Fixed TypeErrors in test_graphrag_agent.py mocks.
3. Fixed ObjectDeletedError in test_documents.py.
4. Updated test_retriever.py assertions to match rank-based scoring.
…to-text-dictation

feat(ui): Implement Speech-to-Text Dictation
…-search

feat(rag): Hybrid Search (Keyword + Vector)
…ator-tool

feat(rag): implement secure calculator tool for financial math (Fixes…
Kishor0009 and others added 24 commits June 5, 2026 00:03
Co-authored-by: Kishor Kumar <ckishor2333@gmail.com>
…ntegration-tests

test: add API integration tests using httpx and pytest
…-chunks

fix: remove stale vector chunks before re-ingestion in ChromaDB
…age-timestamps

Add relative timestamps to chat message bubbles
…ownload-route

fix: sanitize filename in /download route to prevent path traversal
feat(ui): add settings page with HF token status and manual token input
…est-components-52

test: set up frontend component tests
Co-authored-by: ack-chai <abhijna.marathe@gmail.com>
…parately

feat(db): embed markdown tables as separate chunks in ChromaDB
…ess-reset

fix: reset upload zone after successful processing
…reranker

added semantic reranker for search results
…k-mismatch

docs: rewrite README to match actual Flask + Pinecone + Jinja2 stack
…counter

Add live character counter and warning for chat input
…idation-18

fix: handle RequestValidationError globally to return 422 instead of …
…fications-25

Feat/toast notifications 25
@suhaniiz
suhaniiz requested a review from param20h as a code owner July 6, 2026 19:16
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

@suhaniiz is attempting to deploy a commit to the param20h's projects Team on Vercel.

A member of the Team first needs to authorize it.

@suhaniiz

Copy link
Copy Markdown
Contributor Author

@param20h , this pr is under gssoc 2026

@suhaniiz

Copy link
Copy Markdown
Contributor Author

kindly review it!

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.

[FEAT] Implement Direct Relationship Extraction (Predicate Labeling) for GraphRAG Edges