mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
Remove hardcoded API keys and finalize Colab badges in notebooks
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
"id": "9570d208",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"[](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",
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
"id": "de0a7591",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# RAG vs. GraphRAG: Final Answer Comparison\n",
|
||||
"\n",
|
||||
"[](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",
|
||||
|
||||
Reference in New Issue
Block a user