Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

Remove hardcoded API keys and finalize Colab badges in notebooks

KaifAhmad1323a788288cf
diff --git a/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb b/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb
index 2c5cf80b..8f5608e6 100644
--- a/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb
+++ b/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb
@@ -5,6 +5,8 @@
"id": "9570d208",
"metadata": {},
"source": [
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Hawksight-AI/semantica/blob/main/cookbook/use_cases/advanced_rag/01_GraphRAG_Complete.ipynb)\n",
+ "\n",
"# 🧪 GraphRAG: Skincare Intelligence System\n",
"## 📖 Overview\n",
"\n",
@@ -27,55 +29,57 @@
"metadata": {},
"outputs": [],
"source": [
- "# Install dependencies\n",
- "!pip install -qU semantica networkx matplotlib plotly pandas faiss-cpu beautifulsoup4 groq"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "b7a767b5",
- "metadata": {},
- "source": [
- "## 🛠️ Phase 0: Environment & Foundation\n",
- "We configure **Groq** as our primary LLM provider and seed the system with verified \"Ground Truth\" data."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "6840539f",
- "metadata": {},
- "outputs": [],
- "source": [
- "import os\n",
- "import json\n",
- "import pandas as pd\n",
- "from semantica.core import Semantica, ConfigManager\n",
- "from semantica.seed import SeedDataManager\n",
- "from semantica.vector_store import VectorStore\n",
- "\n",
- "# 1. Groq Configuration\n",
- "os.environ[\"GROQ_API_KEY\"] = \"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\"\n",
- "\n",
- "config_dict = {\n",
- " \"project_name\": \"Skincare_Intelligence\",\n",
- " \"embedding\": {\"provider\": \"openai\", \"model\": \"text-embedding-3-small\"}, \n",
- " \"extraction\": {\n",
- " \"provider\": \"groq\", \n",
- " \"model\": \"llama-3.1-8b-instant\", \n",
- " \"temperature\": 0.0\n",
- " },\n",
- " \"inference\": {\n",
- " \"provider\": \"groq\",\n",
- " \"model\": \"llama-3.1-70b-versatile\"\n",
- " },\n",
- " \"vector_store\": {\"provider\": \"faiss\", \"dimension\": 1536},\n",
- " \"knowledge_graph\": {\"backend\": \"networkx\", \"merge_entities\": True}\n",
- "}\n",
- "\n",
- "config = ConfigManager().load_from_dict(config_dict)\n",
- "core = Semantica(config=config)\n",
- "vs = VectorStore(backend=\"faiss\", dimension=1536)\n",
+ "# Install dependencies\n",
+ "!pip install -qU semantica networkx matplotlib plotly pandas faiss-cpu beautifulsoup4 groq sentence-transformers"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b7a767b5",
+ "metadata": {},
+ "source": [
+ "## 🛠️ Phase 0: Environment & Foundation\n",
+ "We configure **Groq** as our primary LLM provider and use **Sentence-Transformers** for local embeddings to avoid API dependencies."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "6840539f",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import os\n",
+ "import json\n",
+ "import pandas as pd\n",
+ "from semantica.core import Semantica, ConfigManager\n",
+ "from semantica.seed import SeedDataManager\n",
+ "from semantica.vector_store import VectorStore\n",
+ "\n",
+ "# 1. Groq Configuration\n",
+ "import getpass\n",
+ "if \"GROQ_API_KEY\" not in os.environ:\n",
+ " os.environ[\"GROQ_API_KEY\"] = getpass.getpass(\"Enter your Groq API Key: \")\n",
+ "\n",
+ "config_dict = {\n",
+ " \"project_name\": \"Skincare_Intelligence\",\n",
+ " \"embedding\": {\"provider\": \"sentence_transformers\", \"model\": \"all-MiniLM-L6-v2\"}, \n",
+ " \"extraction\": {\n",
+ " \"provider\": \"groq\", \n",
+ " \"model\": \"llama-3.1-8b-instant\", \n",
+ " \"temperature\": 0.0\n",
+ " },\n",
+ " \"inference\": {\n",
+ " \"provider\": \"groq\",\n",
+ " \"model\": \"llama-3.1-70b-versatile\"\n",
+ " },\n",
+ " \"vector_store\": {\"provider\": \"faiss\", \"dimension\": 384},\n",
+ " \"knowledge_graph\": {\"backend\": \"networkx\", \"merge_entities\": True}\n",
+ "}\n",
+ "\n",
+ "config = ConfigManager().load_from_dict(config_dict)\n",
+ "core = Semantica(config=config)\n",
+ "vs = VectorStore(backend=\"faiss\", dimension=384)\n",
"\n",
"# 2. Seeding Ground Truth\n",
"foundation_data = {\n",
diff --git a/cookbook/use_cases/advanced_rag/02_RAG_vs_GraphRAG_Comparison.ipynb b/cookbook/use_cases/advanced_rag/02_RAG_vs_GraphRAG_Comparison.ipynb
index 6f88ae41..30ba1ee9 100644
--- a/cookbook/use_cases/advanced_rag/02_RAG_vs_GraphRAG_Comparison.ipynb
+++ b/cookbook/use_cases/advanced_rag/02_RAG_vs_GraphRAG_Comparison.ipynb
@@ -5,10 +5,9 @@
"id": "de0a7591",
"metadata": {},
"source": [
- "# RAG vs. GraphRAG: Final Answer Comparison\n",
- "\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Hawksight-AI/semantica/blob/main/cookbook/use_cases/advanced_rag/02_RAG_vs_GraphRAG_Comparison.ipynb)\n",
"\n",
+ "# RAG vs. GraphRAG: Final Answer Comparison\n",
"This notebook demonstrates the difference in final answers generated by **Standard Vector RAG** and **Semantica GraphRAG** for a complex multi-hop query. We use **FalkorDB** as our high-performance graph backend.\n",
"\n",
"### FalkorDB Setup\n",
@@ -53,7 +52,9 @@
"import os\n",
"\n",
"# 1. Core Semantica & Vector Store\n",
- "os.environ[\"GROQ_API_KEY\"] = \"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\"\n",
+ "import getpass\n",
+ "if \"GROQ_API_KEY\" not in os.environ:\n",
+ " os.environ[\"GROQ_API_KEY\"] = getpass.getpass(\"Enter your Groq API Key: \")\n",
"\n",
"config_dict = {\n",
" \"embedding\": {\"provider\": \"sentence_transformers\", \"model\": \"all-MiniLM-L6-v2\"},\n",