Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix(cookbook): resolve AttributeError and update imports in GraphRAG notebook

KaifAhmad1ab4fa0e4c508
diff --git a/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb b/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb
index a977a6a2..2cb86c9a 100644
--- a/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb
+++ b/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb
@@ -214,17 +214,16 @@
"metadata": {},
"outputs": [],
"source": [
- "from semantica.kg import GraphBuilder\n",
- "from semantica.deduplication import DuplicateDetector, EntityMerger\n",
+ "from semantica.kg import GraphBuilder, EntityResolver\n",
"\n",
"# 1. Build & Vectorize\n",
"gb = GraphBuilder(merge_entities=True)\n",
"kg = gb.build([combined_results])\n",
"\n",
"# 2. Deduplicate\n",
- "detector = DuplicateDetector(threshold=0.85)\n",
- "duplicates = detector.detect_duplicates(kg['entities'])\n",
- "kg_final = EntityMerger().merge_entities(kg, duplicates)\n",
+ "# Use EntityResolver for comprehensive deduplication and merging\n",
+ "resolver = EntityResolver(similarity_threshold=0.85)\n",
+ "kg_final = {**kg, 'entities': resolver.resolve_entities(kg['entities'])}\n",
"\n",
"# 3. Populate Vector Store for retrieval\n",
"texts = [str(c.text) for c in all_chunks]\n",
@@ -251,7 +250,7 @@
"outputs": [],
"source": [
"from semantica.context import ContextRetriever\n",
- "from semantica.inference import InferenceEngine\n",
+ "from semantica.reasoning import InferenceEngine\n",
"\n",
"# 1. Initialize Retriever & Engine\n",
"retriever = ContextRetriever(\n",
diff --git a/cookbook/use_cases/advanced_rag/expert_guide.txt b/cookbook/use_cases/advanced_rag/expert_guide.txt
new file mode 100644
index 00000000..55be5973
--- /dev/null
+++ b/cookbook/use_cases/advanced_rag/expert_guide.txt
@@ -0,0 +1,5 @@
+
+RETINOL CLINICAL GUIDE
+Mechanism: Binds to retinoic acid receptors to increase cellular turnover.
+Precautions: Should not be used with high-concentration AHA/BHA exfoliants.
+Synergy: Highly effective when paired with Niacinamide to offset potential erythema.
diff --git a/cookbook/use_cases/advanced_rag/skincare_base.json b/cookbook/use_cases/advanced_rag/skincare_base.json
index 0ef17e3b..6f11beb5 100644
--- a/cookbook/use_cases/advanced_rag/skincare_base.json
+++ b/cookbook/use_cases/advanced_rag/skincare_base.json
@@ -1 +1 @@
-{"entities": [{"id": "hyaluronic_acid", "name": "Hyaluronic Acid", "type": "Ingredient", "properties": {"role": "Humectant"}}, {"id": "retinol", "name": "Retinol", "type": "Ingredient", "properties": {"role": "Anti-aging actives"}}, {"id": "niacinamide", "name": "Niacinamide", "type": "Ingredient", "properties": {"role": "Barrier repair"}}, {"id": "collagen", "name": "Collagen", "type": "Protein", "properties": {"location": "Dermal Matrix"}}], "relationships": [{"source": "retinol", "target": "collagen", "type": "STIMULATES", "properties": {"level": "High"}}, {"source": "hyaluronic_acid", "target": "niacinamide", "type": "COMPLEMENTS", "properties": {"benefit": "Hydration + Barrier"}}]}
\ No newline at end of file
+{"entities": [{"id": "hyaluronic_acid", "name": "Hyaluronic Acid", "type": "Ingredient", "properties": {"role": "Humectant"}}, {"id": "retinol", "name": "Retinol", "type": "Ingredient", "properties": {"role": "Anti-aging actives"}}, {"id": "niacinamide", "name": "Niacinamide", "type": "Ingredient", "properties": {"role": "Barrier repair"}}], "relationships": [{"source": "hyaluronic_acid", "target": "niacinamide", "type": "COMPLEMENTS", "properties": {"benefit": "Hydration + Barrier"}}]}
\ No newline at end of file