Skip to content

feat: add ShenNongMi — TCM Knowledge Graph RAG with LangGraph + Neo4j - #1108

Open
Happy-Chen-CH wants to merge 1 commit into
Shubhamsaboo:mainfrom
Happy-Chen-CH:feature/tcm-knowledge-graph-rag
Open

feat: add ShenNongMi — TCM Knowledge Graph RAG with LangGraph + Neo4j#1108
Happy-Chen-CH wants to merge 1 commit into
Shubhamsaboo:mainfrom
Happy-Chen-CH:feature/tcm-knowledge-graph-rag

Conversation

@Happy-Chen-CH

Copy link
Copy Markdown

Description

Add ShenNongMi (神农觅 — "The Divine Farmer Seeks"), a self-contained knowledge-graph RAG tutorial for Traditional Chinese Medicine Q&A, built per the feedback on #1066.

Architecture

User query
  → Intent classification (RoBERTa+LoRA, local model)
  → Entity extraction (LLM)
  → FAISS entity matching (BGE-Large-Zh-v1.5)
  → Cypher generation with self-correction loop (max 3 retries)
  → Neo4j execution
  → Natural-language answer (LLM)

Changes vs. original submission (#1066)

Feedback Action
Full multi-service product ✅ Slimmed to the LangGraph + Neo4j Q&A core only (41 files, ~432 KB)
ToS-violating auto-publishing ✅ Removed Playwright/Xiaohongshu pipeline entirely
13.6 MB screenshots ✅ Replaced with 2 placeholder PNGs (140 bytes total)
Invalid model default deepseek-chat (valid DeepSeek model)
pip install broken ✅ Flat, semantic directory names; requirements.txt installs cleanly
MIT inside Apache-2.0 repo ✅ Apache-2.0 licensed

What's included

  • 8-node LangGraph workflow: intent → extract → FAISS match → Cypher gen → validate → execute → answer (+ non-TCM fallback)
  • Neo4j knowledge graph with 6 entity types and 6 relationship types (schema in kg_setup/tcm_metadata.json)
  • Streamlit frontend (Q&A + graph explorer) with FastAPI SSE streaming backend
  • Integration tests with mocked LLM/Neo4j/FAISS (run: python langgraph_workflow/langgraph_more_nodes.py)
  • Knowledge graph setup scripts (Neo4j import + FAISS index builder)

Run it

cd rag_tutorials/shennongmi_tcm_knowledge_graph
pip install -r requirements.txt
cp .env.example .env  # add your DeepSeek API key + Neo4j credentials
python fastapi_app/main.py            # terminal 1
streamlit run streamlit_app/app.py    # terminal 2

Related

Self-contained knowledge-graph RAG tutorial per maintainer feedback on Shubhamsaboo#1066:
- LangGraph + Neo4j Q&A core only (crawler, fine-tuning, and content
  publishing pipelines removed)
- Valid model default (deepseek-chat)
- Requirements installable via pip
- Apache-2.0 licensed
- Screenshots trimmed to placeholder size

Workflow: intent classification (RoBERTa+LoRA) → entity extraction (LLM)
→ FAISS entity matching → Cypher generation with self-correction loop
→ Neo4j execution → natural-language answer.

Resolves Shubhamsaboo#1065

Co-Authored-By: Claude <noreply@anthropic.com>
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.

[New App] ShenNongMi — TCM Knowledge Graph RAG with LangGraph + Neo4j + DeepSeek

2 participants