Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

Refactor Drug Discovery Pipeline notebook: break down dense cells, remove unnecessary markdown headings, add bullet points

KaifAhmad1a54959d277e8
diff --git a/cookbook/introduction/02_Data_Ingestion.ipynb b/cookbook/introduction/02_Data_Ingestion.ipynb
index f95a5204..5854fae7 100644
--- a/cookbook/introduction/02_Data_Ingestion.ipynb
+++ b/cookbook/introduction/02_Data_Ingestion.ipynb
@@ -734,4 +734,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
-}
\ No newline at end of file
+}
diff --git a/cookbook/use_cases/biomedical/01_Drug_Discovery_Pipeline.ipynb b/cookbook/use_cases/biomedical/01_Drug_Discovery_Pipeline.ipynb
index fb5e68b1..414e9ef9 100644
--- a/cookbook/use_cases/biomedical/01_Drug_Discovery_Pipeline.ipynb
+++ b/cookbook/use_cases/biomedical/01_Drug_Discovery_Pipeline.ipynb
@@ -50,9 +50,32 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "WARNING: Ignoring invalid distribution ~gno (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
+ "WARNING: Ignoring invalid distribution ~lotly (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
+ "WARNING: Ignoring invalid distribution ~ython-socketio (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
+ "WARNING: Ignoring invalid distribution ~gno (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
+ "WARNING: Ignoring invalid distribution ~lotly (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
+ "WARNING: Ignoring invalid distribution ~ython-socketio (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
+ "WARNING: Ignoring invalid distribution ~gno (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
+ "WARNING: Ignoring invalid distribution ~lotly (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
+ "WARNING: Ignoring invalid distribution ~ython-socketio (c:\\Users\\Mohd Kaif\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n"
+ ]
+ }
+ ],
"source": [
"# Install Semantica and required dependencies\n",
"%pip install -qU semantica networkx matplotlib plotly pandas faiss-cpu beautifulsoup4 groq sentence-transformers scikit-learn\n"
@@ -64,39 +87,56 @@
"source": [
"---\n",
"\n",
- "## Phase 0: Setup & Configuration\n",
+ "## Setup & Configuration\n",
"\n",
- "Configure Semantica for drug discovery with focus on vector similarity search.\n"
+ "- Configure Semantica for drug discovery\n",
+ "- Focus on vector similarity search\n"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Environment configured.\n"
+ ]
+ }
+ ],
"source": [
"import os\n",
- "import json\n",
- "import pandas as pd\n",
- "import numpy as np\n",
- "from typing import List, Dict, Any\n",
"\n",
"# Set API keys\n",
- "os.environ[\"GROQ_API_KEY\"] = os.getenv(\"GROQ_API_KEY\", \"your-groq-api-key-here\")\n",
+ "os.environ[\"GROQ_API_KEY\"] = os.getenv(\"GROQ_API_KEY\", \"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\")\n",
"\n",
"print(\"Environment configured.\")\n"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "- Import and configure Semantica core components\n"
+ ]
+ },
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Semantica core configured.\n"
+ ]
+ }
+ ],
"source": [
"from semantica.core import Semantica, ConfigManager\n",
- "from semantica.vector_store import VectorStore\n",
- "from semantica.embeddings import EmbeddingGenerator\n",
- "from semantica.semantic_extract import NamedEntityRecognizer, RelationExtractor\n",
"\n",
"# Configure for drug discovery with vector similarity focus\n",
"config_dict = {\n",
@@ -122,9 +162,44 @@
"\n",
"config = ConfigManager().load_from_dict(config_dict)\n",
"core = Semantica(config=config)\n",
+ "\n",
+ "print(\"Semantica core configured.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "fastembed not available. Install with: pip install fastembed. Using fallback embedding method.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Vector store initialized.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from semantica.vector_store import VectorStore\n",
+ "\n",
+ "# Initialize vector store with FAISS backend\n",
"vector_store = VectorStore(backend=\"faiss\", dimension=384)\n",
"\n",
- "print(\"Semantica configured for drug discovery pipeline.\")\n"
+ "print(\"Vector store initialized.\")\n"
]
},
{
@@ -133,36 +208,152 @@
"source": [
"---\n",
"\n",
- "## Phase 1: Real Data Ingestion (PubMed RSS Feed)\n",
+ "## Biomedical Data Ingestion\n",
"\n",
- "Ingest biomedical data from PubMed RSS feeds using FeedIngestor.\n"
+ "- Ingest biomedical data from PubMed RSS feeds\n",
+ "- Use FeedIngestor for data collection\n"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Data directory ready.\n"
+ ]
+ }
+ ],
"source": [
- "from semantica.ingest import FeedIngestor, FileIngestor\n",
"import os\n",
- "\n",
"# Create data directory if it doesn't exist\n",
"os.makedirs(\"data\", exist_ok=True)\n",
"\n",
- "# Option 1: Ingest from PubMed RSS feed (real data source)\n",
- "# PubMed RSS feed for drug discovery research\n",
- "pubmed_rss_url = \"https://pubmed.ncbi.nlm.nih.gov/rss/search/1?term=drug+discovery&limit=10&sort=pub_date&fc=article_type\"\n",
- "\n",
- "try:\n",
- " feed_ingestor = FeedIngestor()\n",
- " # Ingest from PubMed RSS feed\n",
- " feed_documents = feed_ingestor.ingest(pubmed_rss_url, method=\"rss\")\n",
- " print(f\"Ingested {len(feed_documents)} documents from PubMed RSS feed\")\n",
- " documents = feed_documents\n",
- "except Exception as e:\n",
- " print(f\"RSS feed ingestion failed (using sample data): {e}\")\n",
- " # Fallback: Sample drug and protein data\n",
+ "print(\"Data directory ready.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Configured 8 RSS feed sources\n"
+ ]
+ }
+ ],
+ "source": [
+ "from semantica.ingest import FeedIngestor\n",
+ "from contextlib import redirect_stderr\n",
+ "from io import StringIO\n",
+ "\n",
+ "# Multiple RSS feed options for biomedical data\n",
+ "feed_urls = [\n",
+ " (\"PubMed - Drug Discovery\", \"https://pubmed.ncbi.nlm.nih.gov/rss/search/1?term=drug+discovery&limit=10&sort=pub_date&fc=article_type\"),\n",
+ " (\"PubMed - Drug Target Interaction\", \"https://pubmed.ncbi.nlm.nih.gov/rss/search/1?term=drug+target+interaction&limit=10&sort=pub_date\"),\n",
+ " (\"PubMed - Pharmacokinetics\", \"https://pubmed.ncbi.nlm.nih.gov/rss/search/1?term=pharmacokinetics&limit=10&sort=pub_date\"),\n",
+ " (\"PubMed - Pharmacodynamics\", \"https://pubmed.ncbi.nlm.nih.gov/rss/search/1?term=pharmacodynamics&limit=10&sort=pub_date\"),\n",
+ " (\"PubMed - Clinical Trial\", \"https://pubmed.ncbi.nlm.nih.gov/rss/search/1?term=clinical+trial&limit=10&sort=pub_date\"),\n",
+ " (\"PubMed - Protein Target\", \"https://pubmed.ncbi.nlm.nih.gov/rss/search/1?term=protein+target&limit=10&sort=pub_date\"),\n",
+ " (\"BioRxiv - Pharmacology\", \"https://connect.biorxiv.org/biorxiv_xml.php?subject=pharmacology_and_toxicology\"),\n",
+ " (\"Nature - Drug Discovery\", \"https://www.nature.com/subjects/drug-discovery.rss\")\n",
+ "]\n",
+ "\n",
+ "print(f\"Configured {len(feed_urls)} RSS feed sources\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "FeedIngestor initialized\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Initialize FeedIngestor\n",
+ "feed_ingestor = FeedIngestor()\n",
+ "print(\"FeedIngestor initialized\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div style='font-family: monospace;'><h4>🧠 Semantica - πŸ“Š Current Progress</h4><table style='width: 100%; border-collapse: collapse;'><tr><th>Status</th><th>Action</th><th>Module</th><th>Submodule</th><th>File</th><th>Time</th></tr><tr><td>βœ…</td><td>Semantica is normalizing</td><td>πŸ”§ normalize</td><td>TextNormalizer</td><td>-</td><td>0.00s</td></tr><tr><td>βœ…</td><td>Semantica is extracting</td><td>🎯 semantic_extract</td><td>NERExtractor</td><td>-</td><td>0.65s</td></tr><tr><td>βœ…</td><td>Semantica is processing</td><td>⏳ core</td><td>LifecycleManager</td><td>-</td><td>1.19s</td></tr><tr><td>πŸ”„</td><td>Semantica is processing</td><td>⏳ core</td><td>Semantica</td><td>-</td><td>0.06s</td></tr><tr><td>βœ…</td><td>Semantica is executing</td><td>βš™οΈ pipeline</td><td>PipelineBuilder</td><td>-</td><td>0.03s</td></tr><tr><td>βœ…</td><td>Semantica is executing</td><td>βš™οΈ pipeline</td><td>PipelineValidator</td><td>-</td><td>0.01s</td></tr><tr><td>πŸ”„</td><td>Semantica is processing</td><td>⏳ core</td><td>build_knowledge_base</td><td>chunk_0.txt</td><td>0.01s</td></tr><tr><td>πŸ”„</td><td>Semantica is executing</td><td>βš™οΈ pipeline</td><td>ExecutionEngine</td><td>chunk_0.txt</td><td>0.01s</td></tr><tr><td>πŸ”„</td><td>Semantica is executing</td><td>βš™οΈ pipeline</td><td>ExecutionEngine</td><td>-</td><td>0.01s</td></tr><tr><td>πŸ”„</td><td>Semantica is executing</td><td>βš™οΈ pipeline</td><td>ResourceScheduler</td><td>-</td><td>0.00s</td></tr></table></div>"
+ ],
+ "text/plain": [
+ "<IPython.core.display.HTML object>"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "βœ“ Successfully ingested 30 documents from Nature - Drug Discovery\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Try each feed URL until one succeeds (suppress error messages)\n",
+ "documents = None\n",
+ "\n",
+ "for feed_name, feed_url in feed_urls:\n",
+ " try:\n",
+ " # Suppress stderr to avoid cluttering output with parsing errors\n",
+ " with redirect_stderr(StringIO()):\n",
+ " feed_data = feed_ingestor.ingest_feed(feed_url, validate=False)\n",
+ " \n",
+ " # Convert FeedItem objects to documents\n",
+ " documents = []\n",
+ " for item in feed_data.items:\n",
+ " if not item.content:\n",
+ " item.content = item.description or item.title or \"\"\n",
+ " if item.content:\n",
+ " documents.append(item)\n",
+ " \n",
+ " if documents:\n",
+ " print(f\"βœ“ Successfully ingested {len(documents)} documents from {feed_name}\")\n",
+ " break\n",
+ " except Exception:\n",
+ " continue\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Fallback to sample data if all RSS feeds failed\n",
+ "from semantica.ingest import FileIngestor\n",
+ "\n",
+ "if not documents:\n",
" sample_drug_data = \"\"\"\n",
" Aspirin (acetylsalicylic acid) is a medication used to reduce pain, fever, or inflammation. \n",
" It targets cyclooxygenase enzymes COX-1 and COX-2. Aspirin is commonly used for cardiovascular protection.\n",
@@ -173,11 +364,11 @@
" Atorvastatin is a statin medication that targets HMG-CoA reductase.\n",
" \"\"\"\n",
" \n",
- " # Save sample data\n",
+ " import os\n",
+ " os.makedirs(\"data\", exist_ok=True)\n",
" with open(\"data/sample_drugs.txt\", \"w\") as f:\n",
" f.write(sample_drug_data)\n",
" \n",
- " # Ingest from file\n",
" file_ingestor = FileIngestor()\n",
" documents = file_ingestor.ingest(\"data/sample_drugs.txt\")\n",
" print(f\"Ingested {len(documents)} documents from sample data\")\n"
@@ -185,28 +376,39 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 10,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "TextNormalizer initialized\n"
+ ]
+ }
+ ],
"source": [
- "---\n",
- "\n",
- "## Phase 2: Text Normalization & Cleaning\n",
+ "from semantica.normalize import TextNormalizer\n",
"\n",
- "Normalize and clean ingested text data using the normalize module.\n"
+ "# Initialize text normalizer\n",
+ "normalizer = TextNormalizer()\n",
+ "print(\"TextNormalizer initialized\")\n"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 11,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Normalized 30 documents\n"
+ ]
+ }
+ ],
"source": [
- "from semantica.normalize import TextNormalizer\n",
- "\n",
- "# Normalize and clean text data\n",
- "normalizer = TextNormalizer()\n",
- "\n",
"# Normalize all documents\n",
"normalized_documents = []\n",
"for doc in documents:\n",
@@ -219,8 +421,18 @@
" )\n",
" normalized_documents.append(normalized_text)\n",
"\n",
- "print(f\"Normalized {len(normalized_documents)} documents\")\n",
- "print(f\"Sample normalized text (first 200 chars): {normalized_documents[0][:200] if normalized_documents else 'N/A'}\")\n"
+ "print(f\"Normalized {len(normalized_documents)} documents\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Preview normalized text\n",
+ "if normalized_documents:\n",
+ " print(f\"Sample normalized text (first 200 chars): {normalized_documents[0][:200]}\")\n",
+ "else:\n",
+ " print(\"No normalized documents available\")\n"
]
},
{
@@ -229,44 +441,375 @@
"source": [
"---\n",
"\n",
- "## Phase 3: Advanced Chunking (Entity-Aware)\n",
+ "## Text Normalization & Cleaning\n",
"\n",
- "Use entity-aware chunking to preserve drug/protein entity boundaries for GraphRAG.\n"
+ "- Clean HTML tags and special characters\n",
+ "- Normalize entity names\n",
+ "- Remove extra whitespace\n",
+ "- Preserve drug names (case-sensitive)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "\n",
+ "## Entity-Aware Chunking\n",
+ "\n",
+ "- Use entity-aware chunking to preserve drug/protein entity boundaries\n",
+ "- Essential for GraphRAG operations\n"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "TextSplitter initialized with entity-aware chunking\n"
+ ]
+ }
+ ],
"source": [
- "from semantica.split import TextSplitter, EntityAwareChunker\n",
+ "from semantica.split import TextSplitter\n",
+ "from contextlib import redirect_stderr\n",
+ "from io import StringIO\n",
"\n",
- "# Use entity-aware chunking to preserve drug/protein entity boundaries\n",
- "# This is crucial for GraphRAG workflows to maintain entity context\n",
+ "# Initialize TextSplitter with entity-aware chunking\n",
+ "# Using 'spacy' instead of 'llm' to avoid API key requirements\n",
"splitter = TextSplitter(\n",
" method=\"entity_aware\",\n",
- " ner_method=\"llm\", # Use LLM for better entity recognition\n",
+ " ner_method=\"spacy\", # Use spaCy for entity recognition (no API key needed)\n",
" chunk_size=1000,\n",
" chunk_overlap=200\n",
")\n",
"\n",
- "# Alternative: Use EntityAwareChunker directly\n",
- "entity_chunker = EntityAwareChunker(\n",
+ "print(\"TextSplitter initialized with entity-aware chunking\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Created 30 chunks\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Chunk normalized documents (suppress error messages)\n",
+ "chunked_documents = []\n",
+ "for doc_text in normalized_documents:\n",
+ " try:\n",
+ " # Suppress stderr to avoid cluttering output with NER errors\n",
+ " with redirect_stderr(StringIO()):\n",
+ " chunks = splitter.split(doc_text)\n",
+ " chunked_documents.extend(chunks)\n",
+ " except Exception:\n",
+ " # Fallback to simple recursive splitting if entity-aware fails\n",
+ " simple_splitter = TextSplitter(method=\"recursive\", chunk_size=1000, chunk_overlap=200)\n",
+ " chunks = simple_splitter.split(doc_text)\n",
+ " chunked_documents.extend(chunks)\n",
+ "\n",
+ "print(f\"Created {len(chunked_documents)} chunks\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Sample chunk (first 200 chars): Apoptotic signatures allow early and rapid screening of drug-induced liver injury to accelerate drug discovery\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Preview sample chunk\n",
+ "if chunked_documents:\n",
+ " sample_chunk = chunked_documents[0]\n",
+ " chunk_text = sample_chunk.text if hasattr(sample_chunk, 'text') else str(sample_chunk)\n",
+ " print(f\"Sample chunk (first 200 chars): {chunk_text[:200]}\")\n",
+ "else:\n",
+ " print(\"No chunks available\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "\n",
+ "## Entity Extraction & Knowledge Graph Construction\n",
+ "\n",
+ "- Extract drug and protein entities\n",
+ "- Build knowledge graph from extracted entities\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Prepared 30 chunk files for entity extraction\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Convert chunks to text files\n",
+ "# build_knowledge_base requires file paths or URLs, not raw text\n",
+ "import os\n",
+ "\n",
+ "os.makedirs(\"data/chunks\", exist_ok=True)\n",
+ "chunk_files = []\n",
+ "\n",
+ "for i, chunk in enumerate(chunked_documents):\n",
+ " # Extract text from chunk object\n",
+ " if hasattr(chunk, 'text'):\n",
+ " chunk_text = chunk.text\n",
+ " elif hasattr(chunk, 'content'):\n",
+ " chunk_text = chunk.content\n",
+ " else:\n",
+ " chunk_text = str(chunk)\n",
+ " \n",
+ " # Save chunk to temporary file\n",
+ " chunk_file = f\"data/chunks/chunk_{i}.txt\"\n",
+ " with open(chunk_file, \"w\", encoding=\"utf-8\") as f:\n",
+ " f.write(chunk_text)\n",
+ " chunk_files.append(chunk_file)\n",
+ "\n",
+ "print(f\"Prepared {len(chunk_files)} chunk files for entity extraction\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Build knowledge base with entity extraction\n",
+ "result = core.build_knowledge_base(\n",
+ " sources=chunk_files,\n",
+ " custom_entity_types=[\"Drug\", \"Protein\", \"Target\", \"Compound\", \"Enzyme\", \"Receptor\"],\n",
+ " embeddings=True,\n",
+ " graph=True\n",
+ ")\n",
+ "\n",
+ "print(\"Knowledge base built successfully\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Extract entities from result\n",
+ "entities = result[\"entities\"]\n",
+ "print(f\"Total entities extracted: {len(entities)}\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Filter drugs and proteins\n",
+ "drugs = [e for e in entities if e.get(\"type\") == \"Drug\" or \"drug\" in e.get(\"type\", \"\").lower()]\n",
+ "proteins = [e for e in entities if e.get(\"type\") == \"Protein\" or \"protein\" in e.get(\"type\", \"\").lower()]\n",
+ "\n",
+ "print(f\"Extracted {len(drugs)} drugs and {len(proteins)} proteins\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Preview sample drugs\n",
+ "print(\"Sample drugs:\")\n",
+ "for d in drugs[:3]:\n",
+ " print(f\" - {d.get('text', 'Unknown')[:50]}\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Preview sample proteins\n",
+ "print(\"Sample proteins:\")\n",
+ "for p in proteins[:3]:\n",
+ " print(f\" - {p.get('text', 'Unknown')[:50]}\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Get knowledge graph statistics\n",
+ "kg = result[\"knowledge_graph\"]\n",
+ "print(f\"Knowledge graph contains:\")\n",
+ "print(f\" - {len(kg.get('entities', []))} entities\")\n",
+ "print(f\" - {len(kg.get('relationships', []))} relationships\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "\n",
+ "## Entity-Aware Chunking\n",
+ "\n",
+ "- Use entity-aware chunking to preserve drug/protein entity boundaries\n",
+ "- Essential for GraphRAG operations\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Define GraphRAG query\n",
+ "query = \"What drugs target COX enzymes?\"\n",
+ "print(f\"Query: {query}\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Retrieve using GraphRAG (hybrid vector + graph retrieval)\n",
+ "results = context.retrieve(\n",
+ " query,\n",
+ " max_results=10,\n",
+ " use_graph=True, # Enable graph traversal\n",
+ " expand_graph=True, # Expand graph relationships\n",
+ " include_entities=True, # Include related entities\n",
+ " include_relationships=True # Include relationships\n",
+ ")\n",
+ "\n",
+ "print(f\"GraphRAG retrieved {len(results)} results\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Display GraphRAG results\n",
+ "for i, result in enumerate(results[:5], 1):\n",
+ " print(f\"{i}. Score: {result.get('score', 0):.3f}\")\n",
+ " print(f\" Content: {result.get('content', '')[:200]}...\")\n",
+ " if result.get('related_entities'):\n",
+ " print(f\" Related entities: {len(result['related_entities'])}\")\n",
+ " print()\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Created 30 chunks using entity-aware chunking\n"
+ ]
+ }
+ ],
+ "source": [
+ "from semantica.split import TextSplitter\n",
+ "from contextlib import redirect_stderr\n",
+ "from io import StringIO\n",
+ "\n",
+ "# Use entity-aware chunking to preserve drug/protein entity boundaries\n",
+ "# Using 'spacy' instead of 'llm' to avoid API key requirements\n",
+ "splitter = TextSplitter(\n",
+ " method=\"entity_aware\",\n",
+ " ner_method=\"spacy\", # Use spaCy for entity recognition (no API key needed)\n",
" chunk_size=1000,\n",
- " chunk_overlap=200,\n",
- " ner_method=\"llm\",\n",
- " preserve_entities=True\n",
+ " chunk_overlap=200\n",
")\n",
"\n",
- "# Chunk normalized documents\n",
+ "# Chunk normalized documents (suppress error messages)\n",
"chunked_documents = []\n",
"for doc_text in normalized_documents:\n",
- " chunks = splitter.split(doc_text)\n",
- " chunked_documents.extend(chunks)\n",
+ " try:\n",
+ " # Suppress stderr to avoid cluttering output with NER errors\n",
+ " with redirect_stderr(StringIO()):\n",
+ " chunks = splitter.split(doc_text)\n",
+ " chunked_documents.extend(chunks)\n",
+ " except Exception:\n",
+ " # Fallback to simple recursive splitting if entity-aware fails\n",
+ " simple_splitter = TextSplitter(method=\"recursive\", chunk_size=1000, chunk_overlap=200)\n",
+ " chunks = simple_splitter.split(doc_text)\n",
+ " chunked_documents.extend(chunks)\n",
+ "\n",
+ "print(f\"Created {len(chunked_documents)} chunks using entity-aware chunking\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Prepare drug texts for embedding\n",
+ "drug_texts = [f\"{d.get('text', '')} {d.get('description', '')}\" for d in drugs]\n",
+ "print(f\"Prepared {len(drug_texts)} drug texts for embedding\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Generate drug embeddings\n",
+ "drug_embeddings = embedding_gen.generate_embeddings(drug_texts)\n",
+ "print(f\"Generated {len(drug_embeddings)} drug embeddings\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Store embeddings in vector store\n",
+ "drug_ids = vector_store.store_vectors(\n",
+ " vectors=drug_embeddings,\n",
+ " metadata=[{\"type\": \"drug\", \"name\": d.get(\"text\", \"\")} for d in drugs]\n",
+ ")\n",
"\n",
- "print(f\"Created {len(chunked_documents)} chunks using entity-aware chunking\")\n",
- "print(f\"Sample chunk (first 300 chars): {chunked_documents[0].content[:300] if chunked_documents else 'N/A'}\")\n"
+ "print(f\"Stored {len(drug_ids)} drug embeddings in vector store\")\n"
]
},
{
@@ -275,9 +818,32 @@
"source": [
"---\n",
"\n",
- "## Phase 4: Entity Extraction & Knowledge Graph Construction\n",
+ "## Entity Extraction & Knowledge Graph Construction\n",
"\n",
- "Extract drug and protein entities, then build knowledge graph.\n"
+ "- Extract drug and protein entities\n",
+ "- Build knowledge graph from extracted entities\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Generate query embedding\n",
+ "query_embedding = embedding_gen.generate_embeddings([query_drug])[0]\n",
+ "print(\"Query embedding generated\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Search for similar drugs\n",
+ "similar_drugs = vector_store.search_vectors(query_embedding, k=5)\n",
+ "print(f\"Found {len(similar_drugs)} similar drugs\")\n"
]
},
{
@@ -286,17 +852,53 @@
"metadata": {},
"outputs": [],
"source": [
- "# Convert chunks to document format for entity extraction\n",
- "# Chunks from TextSplitter have content attribute\n",
- "chunk_docs = []\n",
- "for chunk in chunked_documents:\n",
- " # Create a simple document-like object\n",
- " doc_content = chunk.content if hasattr(chunk, 'content') else str(chunk)\n",
- " chunk_docs.append(doc_content)\n",
+ "# Display similar drugs\n",
+ "print(f\"Drugs similar to '{query_drug}':\")\n",
+ "for i, result in enumerate(similar_drugs, 1):\n",
+ " print(f\"{i}. {result['metadata'].get('name', 'Unknown')} (similarity: {result['score']:.3f})\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Prepared 30 chunk files for entity extraction\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Convert chunks to text strings and save to temporary files\n",
+ "# build_knowledge_base requires file paths or URLs, not raw text\n",
+ "import os\n",
+ "\n",
+ "os.makedirs(\"data/chunks\", exist_ok=True)\n",
+ "chunk_files = []\n",
+ "\n",
+ "for i, chunk in enumerate(chunked_documents):\n",
+ " # Extract text from chunk object\n",
+ " if hasattr(chunk, 'text'):\n",
+ " chunk_text = chunk.text\n",
+ " elif hasattr(chunk, 'content'):\n",
+ " chunk_text = chunk.content\n",
+ " else:\n",
+ " chunk_text = str(chunk)\n",
+ " \n",
+ " # Save chunk to temporary file\n",
+ " chunk_file = f\"data/chunks/chunk_{i}.txt\"\n",
+ " with open(chunk_file, \"w\", encoding=\"utf-8\") as f:\n",
+ " f.write(chunk_text)\n",
+ " chunk_files.append(chunk_file)\n",
+ "\n",
+ "print(f\"Prepared {len(chunk_files)} chunk files for entity extraction\")\n",
"\n",
"# Build knowledge base with entity extraction\n",
"result = core.build_knowledge_base(\n",
- " sources=chunk_docs,\n",
+ " sources=chunk_files,\n",
" custom_entity_types=[\"Drug\", \"Protein\", \"Target\", \"Compound\", \"Enzyme\", \"Receptor\"],\n",
" embeddings=True,\n",
" graph=True\n",
@@ -308,34 +910,90 @@
"proteins = [e for e in entities if e.get(\"type\") == \"Protein\" or \"protein\" in e.get(\"type\", \"\").lower()]\n",
"\n",
"print(f\"Extracted {len(drugs)} drugs and {len(proteins)} proteins\")\n",
- "print(f\"Sample drugs: {[d.get('text', '')[:30] for d in drugs[:3]]}\")\n",
- "print(f\"Sample proteins: {[p.get('text', '')[:30] for p in proteins[:3]]}\")\n",
+ "print(f\"\\nSample drugs:\")\n",
+ "for d in drugs[:3]:\n",
+ " print(f\" - {d.get('text', 'Unknown')[:50]}\")\n",
+ "print(f\"\\nSample proteins:\")\n",
+ "for p in proteins[:3]:\n",
+ " print(f\" - {p.get('text', 'Unknown')[:50]}\")\n",
"\n",
"# Get knowledge graph\n",
"kg = result[\"knowledge_graph\"]\n",
- "print(f\"Knowledge graph contains {len(kg.get('entities', []))} entities and {len(kg.get('relationships', []))} relationships\")\n"
+ "print(f\"\\nKnowledge graph contains:\")\n",
+ "print(f\" - {len(kg.get('entities', []))} entities\")\n",
+ "print(f\" - {len(kg.get('relationships', []))} relationships\")\n"
]
},
{
- "cell_type": "markdown",
+ "cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "---\n",
- "\n",
- "## Phase 5: Vector Store Population & Embedding Generation\n",
- "\n",
- "Generate embeddings and populate vector store for similarity search.\n"
+ "# Define GraphRAG query\n",
+ "query = \"What drugs target COX enzymes?\"\n",
+ "print(f\"Query: {query}\")\n"
]
},
{
- "cell_type": "markdown",
+ "cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "---\n",
+ "# Retrieve using GraphRAG (hybrid vector + graph retrieval)\n",
+ "results = context.retrieve(\n",
+ " query,\n",
+ " max_results=10,\n",
+ " use_graph=True, # Enable graph traversal\n",
+ " expand_graph=True, # Expand graph relationships\n",
+ " include_entities=True, # Include related entities\n",
+ " include_relationships=True # Include relationships\n",
+ ")\n",
"\n",
- "## Phase 4-5: Vector Store & Similarity Search\n",
+ "print(f\"GraphRAG retrieved {len(results)} results\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Display GraphRAG results\n",
+ "for i, result in enumerate(results[:5], 1):\n",
+ " print(f\"{i}. Score: {result.get('score', 0):.3f}\")\n",
+ " print(f\" Content: {result.get('content', '')[:200]}...\")\n",
+ " if result.get('related_entities'):\n",
+ " print(f\" Related entities: {len(result['related_entities'])}\")\n",
+ " print()\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Generate knowledge graph visualization\n",
+ "visualizer.visualize(\n",
+ " kg,\n",
+ " output_path=\"drug_target_kg.html\",\n",
+ " layout=\"spring\",\n",
+ " node_size=20\n",
+ ")\n",
"\n",
- "Generate embeddings and populate vector store for similarity search.\n"
+ "print(\"Knowledge graph visualization saved to drug_target_kg.html\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Display graph statistics\n",
+ "print(f\"Graph contains {len(kg.get('entities', []))} entities and {len(kg.get('relationships', []))} relationships\")\n"
]
},
{
@@ -344,9 +1002,10 @@
"source": [
"---\n",
"\n",
- "## Phase 6: GraphRAG - Hybrid Vector + Graph Retrieval\n",
+ "## Embedding Generation & Vector Store Population\n",
"\n",
- "Use AgentContext for GraphRAG to combine vector similarity search with knowledge graph traversal.\n"
+ "- Generate embeddings for drugs and proteins\n",
+ "- Populate vector store for similarity search\n"
]
},
{
@@ -389,9 +1048,10 @@
"source": [
"---\n",
"\n",
- "## Phase 7: Similarity Search & Interaction Prediction\n",
+ "## Similarity Search & Interaction Prediction\n",
"\n",
- "Use vector similarity to find similar drugs and predict interactions.\n"
+ "- Use vector similarity to find similar drugs\n",
+ "- Predict drug-target interactions\n"
]
},
{
@@ -418,26 +1078,90 @@
"print(f\"Stored {len(drug_ids)} drug embeddings in vector store\")\n"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Retrieve using GraphRAG (hybrid vector + graph retrieval)\n",
+ "results = context.retrieve(\n",
+ " query,\n",
+ " max_results=10,\n",
+ " use_graph=True, # Enable graph traversal\n",
+ " expand_graph=True, # Expand graph relationships\n",
+ " include_entities=True, # Include related entities\n",
+ " include_relationships=True # Include relationships\n",
+ ")\n",
+ "\n",
+ "print(f\"GraphRAG retrieved {len(results)} results\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Display GraphRAG results\n",
+ "for i, result in enumerate(results[:5], 1):\n",
+ " print(f\"{i}. Score: {result.get('score', 0):.3f}\")\n",
+ " print(f\" Content: {result.get('content', '')[:200]}...\")\n",
+ " if result.get('related_entities'):\n",
+ " print(f\" Related entities: {len(result['related_entities'])}\")\n",
+ " print()\n"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
- "## Phase 8: Knowledge Graph Visualization\n",
+ "## Knowledge Graph Visualization\n",
"\n",
- "Visualize drug-target knowledge graph and relationships.\n"
+ "- Visualize drug-target knowledge graph\n",
+ "- Display relationships between entities\n"
]
},
{
- "cell_type": "markdown",
+ "cell_type": "code",
+ "execution_count": null,
"metadata": {},
+ "outputs": [],
"source": [
- "---\n",
+ "from semantica.visualization import KGVisualizer\n",
"\n",
- "## Phase 6: Similarity Search & Interaction Prediction\n",
+ "# Initialize KG visualizer\n",
+ "visualizer = KGVisualizer()\n",
+ "print(\"KGVisualizer initialized\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Generate knowledge graph visualization\n",
+ "visualizer.visualize(\n",
+ " kg,\n",
+ " output_path=\"drug_target_kg.html\",\n",
+ " layout=\"spring\",\n",
+ " node_size=20\n",
+ ")\n",
"\n",
- "Use vector similarity to find similar drugs and predict interactions.\n"
+ "print(\"Knowledge graph visualization saved to drug_target_kg.html\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Display graph statistics\n",
+ "print(f\"Graph contains {len(kg.get('entities', []))} entities and {len(kg.get('relationships', []))} relationships\")\n"
]
},
{
@@ -458,17 +1182,6 @@
" print(f\"{i}. {result['metadata'].get('name', 'Unknown')} (similarity: {result['score']:.3f})\")\n"
]
},
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "---\n",
- "\n",
- "## Phase 7-8: Knowledge Graph & Visualization\n",
- "\n",
- "Build drug-target knowledge graph and visualize relationships.\n"
- ]
- },
{
"cell_type": "code",
"execution_count": null,
@@ -495,8 +1208,22 @@
}
],
"metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
"language_info": {
- "name": "python"
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_0.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_0.txt
new file mode 100644
index 00000000..b61bfccf
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_0.txt
@@ -0,0 +1 @@
+Apoptotic signatures allow early and rapid screening of drug-induced liver injury to accelerate drug discovery
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_1.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_1.txt
new file mode 100644
index 00000000..8d1087c3
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_1.txt
@@ -0,0 +1 @@
+SynergyGraph: predicting cell line specific drug combination synergy scores using knowledge graph representation and hypergraph modeling
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_10.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_10.txt
new file mode 100644
index 00000000..0a67f1c7
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_10.txt
@@ -0,0 +1 @@
+Unraveling the mechanism of curcumin in coronary slow flow phenomenon through network pharmacology and molecular docking
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_11.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_11.txt
new file mode 100644
index 00000000..6312f0c8
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_11.txt
@@ -0,0 +1 @@
+Penicillium chrysogenum originated chloro-diydropyridyl-oxopropanimidic acid derivative as a potent EPSP synthase-targeted bioherbicide against invasive weed species
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_12.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_12.txt
new file mode 100644
index 00000000..8dc8cd02
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_12.txt
@@ -0,0 +1 @@
+Enhancing the anti-cancer potential of resveratrol through cocrystal technology in colorectal cancerous rats
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_13.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_13.txt
new file mode 100644
index 00000000..4ad49e0a
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_13.txt
@@ -0,0 +1 @@
+Synthesis, spectral, thermal, and biological characterization of Se(IV) nanocomplexes derived from vitamin E and amino acid mixed ligands as a metal-drug model
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_14.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_14.txt
new file mode 100644
index 00000000..cb47981e
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_14.txt
@@ -0,0 +1 @@
+BT-11 targets the LANCL2 pathway to attenuate cognitive deficits and hippocampal pathology in Alzheimer’s transgenic rats
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_15.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_15.txt
new file mode 100644
index 00000000..faa0bedf
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_15.txt
@@ -0,0 +1 @@
+Saffron as a natural modulator of reverse cholesterol transport genes in atherosclerotic rabbits, with molecular docking insights
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_16.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_16.txt
new file mode 100644
index 00000000..8bb10833
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_16.txt
@@ -0,0 +1 @@
+Simultaneous targeting of KRAS and CDK4 synergistically induces durable growth arrest in pancreatic cancer cells
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_17.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_17.txt
new file mode 100644
index 00000000..9d3f88e9
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_17.txt
@@ -0,0 +1 @@
+Antiproliferative activity of Moringa oleifera (L.) Lam. and Moringa stenopetala (Bak.) Cufod. leaves extract against selected cancer cells in primary cell culture
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_18.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_18.txt
new file mode 100644
index 00000000..65647015
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_18.txt
@@ -0,0 +1 @@
+Applications of Sombor topological indices and entropy measures for QSPR modeling of anticancer drugs: a Python-based methodology
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_19.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_19.txt
new file mode 100644
index 00000000..d260d737
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_19.txt
@@ -0,0 +1 @@
+In-silico studies, synthesis, and pharmacological screening of novel multitarget diphenylpyrazole scaffold as EGFR/BRAF and cyclooxygenase-2 inhibitors
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_2.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_2.txt
new file mode 100644
index 00000000..3cc55866
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_2.txt
@@ -0,0 +1 @@
+Rational design and in silico characterization of a multiepitope mRNA vaccine candidate against human metapneumovirus (hMPV) using reverse vaccinology and immunoinformatics approaches
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_20.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_20.txt
new file mode 100644
index 00000000..d6e05ab8
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_20.txt
@@ -0,0 +1 @@
+Unveiling novel potential drug targets for lung cancer through Mendelian randomization analysis
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_21.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_21.txt
new file mode 100644
index 00000000..ffe32bad
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_21.txt
@@ -0,0 +1 @@
+Comparative analysis of OECD guideline data and Tox21 assays to improve reproductive and developmental toxicity prediction
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_22.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_22.txt
new file mode 100644
index 00000000..c88f74b5
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_22.txt
@@ -0,0 +1 @@
+High-throughput triazole-based combinatorial click chemistry for the synthesis and identification of functional metal complexes
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_23.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_23.txt
new file mode 100644
index 00000000..e26f1783
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_23.txt
@@ -0,0 +1 @@
+Efficacy and safety assessment of gelatin hemostatic matrix in a burr hole neurosurgical beagle model
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_24.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_24.txt
new file mode 100644
index 00000000..05ade069
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_24.txt
@@ -0,0 +1 @@
+Biological and computer-aided evaluation of 3-methoxy-13Ξ±-estrone-16Ξ±-diphenylphosphine oxide as a new antiestrogenic agent
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_25.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_25.txt
new file mode 100644
index 00000000..9d7149c7
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_25.txt
@@ -0,0 +1 @@
+Design and optimization of intranasal aripiprazole-loaded nanostructured lipid carriers for enhanced brain targeting in schizophrenia: in vitro and ex vivo evaluation
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_26.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_26.txt
new file mode 100644
index 00000000..0043ff31
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_26.txt
@@ -0,0 +1 @@
+Endosome-phagophore linking assemblies for the degradation of membrane/extracellular proteins
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_27.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_27.txt
new file mode 100644
index 00000000..8c6f58b1
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_27.txt
@@ -0,0 +1 @@
+Protodioscin enhances Methotrexate-induced senescence and senolytic activity in HepG2 liver cancer spheroids by modulating cell cycle regulators and the TGF-Ξ²/p-Smad2-4 signaling pathway
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_28.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_28.txt
new file mode 100644
index 00000000..b04ffea3
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_28.txt
@@ -0,0 +1 @@
+Morpholino-RNA duplex exhibits robust, sustained, and safe steric-block antisense activity by intracerebroventricular and intrathecal injection
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_29.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_29.txt
new file mode 100644
index 00000000..331cde67
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_29.txt
@@ -0,0 +1 @@
+Pushing the limits of hydrogen/deuterium exchange mass spectrometry to study protein:fragment low affinity interactions
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_3.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_3.txt
new file mode 100644
index 00000000..eacad404
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_3.txt
@@ -0,0 +1 @@
+Cannabidiol perturbs macrophage polarization by interfering with the metabolic flux and PI3K/Akt pathway
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_4.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_4.txt
new file mode 100644
index 00000000..4f3cdec8
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_4.txt
@@ -0,0 +1 @@
+Bidirectional reinforcement learning neural network for constrained molecular design
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_5.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_5.txt
new file mode 100644
index 00000000..53a0d0af
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_5.txt
@@ -0,0 +1 @@
+Phytochemical investigation and antibacterial activities of Cordia africana roots extracts
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_6.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_6.txt
new file mode 100644
index 00000000..96d20296
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_6.txt
@@ -0,0 +1 @@
+Similar short-term efficacy of oral levosulpiride and intravitreal ranibizumab in patients with diabetic macular oedema
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_7.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_7.txt
new file mode 100644
index 00000000..db2a4c94
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_7.txt
@@ -0,0 +1 @@
+SIMD: Synergistic integration mutualistic platform based on single-cell and proteotranscriptomics for drug repositioning
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_8.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_8.txt
new file mode 100644
index 00000000..1c6608b8
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_8.txt
@@ -0,0 +1 @@
+Elucidating the anti-fibrotic mechanisms of Abrus cantoniensis in hepatic fibrosis using network pharmacology and proteomics
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/chunks/chunk_9.txt b/cookbook/use_cases/biomedical/data/chunks/chunk_9.txt
new file mode 100644
index 00000000..632b6be0
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/chunks/chunk_9.txt
@@ -0,0 +1 @@
+Identification of bioactive phytoconstituents as promising ABL2 inhibitors using virtual screening and molecular dynamics simulation
\ No newline at end of file
diff --git a/cookbook/use_cases/biomedical/data/sample_drugs.txt b/cookbook/use_cases/biomedical/data/sample_drugs.txt
new file mode 100644
index 00000000..71386958
--- /dev/null
+++ b/cookbook/use_cases/biomedical/data/sample_drugs.txt
@@ -0,0 +1,9 @@
+
+ Aspirin (acetylsalicylic acid) is a medication used to reduce pain, fever, or inflammation.
+ It targets cyclooxygenase enzymes COX-1 and COX-2. Aspirin is commonly used for cardiovascular protection.
+ Ibuprofen is a nonsteroidal anti-inflammatory drug (NSAID) that targets COX-1 and COX-2 enzymes.
+ Metformin is an antidiabetic medication that targets AMP-activated protein kinase (AMPK).
+ Insulin targets the insulin receptor (INSR) to regulate glucose metabolism.
+ Warfarin is an anticoagulant that targets vitamin K epoxide reductase complex subunit 1 (VKORC1).
+ Atorvastatin is a statin medication that targets HMG-CoA reductase.
+
\ No newline at end of file