Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
Update financial data integration notebook: - Switch entity and relation extraction to ML-based methods (spaCy) - Fix conflict detection to use detect_temporal_conflicts directly - Fix graph building to use correct Relation attributes (subject/object/predicate) - Improve GraphRAG with LLM-based multi-hop reasoning - Enhance graph analytics output to show all entity types - Update markdown descriptions with concise bullet points
KaifAhmad1599372a50fdd
diff --git a/cookbook/use_cases/finance/01_Financial_Data_Integration_MCP.ipynb b/cookbook/use_cases/finance/01_Financial_Data_Integration_MCP.ipynbindex 42824a7d..95ed64b9 100644--- a/cookbook/use_cases/finance/01_Financial_Data_Integration_MCP.ipynb+++ b/cookbook/use_cases/finance/01_Financial_Data_Integration_MCP.ipynb@@ -57,9 +57,32 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 1,+ "metadata": {},+ "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": ["%pip install -qU semantica networkx matplotlib plotly pandas faiss-cpu beautifulsoup4 groq sentence-transformers scikit-learn\n"]@@ -73,13 +96,13 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 2,"metadata": {},"outputs": [],"source": ["import os\n","\n",- "os.environ[\"GROQ_API_KEY\"] = os.getenv(\"GROQ_API_KEY\", \"your-key-here\")\n",+ "os.environ[\"GROQ_API_KEY\"] = os.getenv(\"GROQ_API_KEY\", \"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\")\n","\n","# Configuration constants\n","EMBEDDING_DIMENSION = 384\n",@@ -97,9 +120,23 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 4,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Ingesting from 8 feed sources...\n",+ "π§ Semantica is ingesting: 429 Client Error: Too Many Requests for url: https://feeds.finance.yahoo.com/rss/2.0/headline βπ₯ (1.0s) | π§ Semantica is ingesting: Ingested 10 items |βββββββββββββββ| 100.0% β π₯ [2/8] Financial Times: 10 documents\n",+ "π§ Semantica is ingesting: Ingested 10 items |βββββββββββββββ| 100.0% β π₯ | π§ Semantica is ingesting: Ingested 30 items |βββββββββββββββ| 100.0% β π₯ [3/8] Bloomberg: 30 documents\n",+ "π§ Semantica is ingesting: 403 Client Error: Forbidden for url: https://www.marketwatch.com/404?origin=feeds βπ₯ (3.2s) | π§ Semantica is ingesting: Ingested 30 items |βββββββββββββββ| 100.0% β π₯ [5/8] Seeking Alpha: 30 documents\n",+ "π§ Semantica is ingesting: Ingested 30 items |βββββββββββββββ| 100.0% β π₯ | π§ Semantica is ingesting: Ingested 10 items |βββββββββββββββ| 100.0% β π₯ [6/8] Investing.com: 10 documents\n",+ "π§ Semantica is ingesting: 403 Client Error: Forbidden for url: https://www.fnlondon.com/rss βπ₯ (0.5s) | π§ Semantica is ingesting: Ingested 20 items |βββββββββββββββ| 100.0% β π₯ [8/8] Wall Street Journal: 20 documents\n",+ "Ingested 100 documents\n"+ ]+ }+ ],"source": ["from semantica.ingest import MCPIngestor, WebIngestor, FeedIngestor, FileIngestor\n","import os\n",@@ -109,10 +146,15 @@"os.makedirs(\"data\", exist_ok=True)\n","\n","feed_sources = [\n",- " # Financial RSS Feeds\n",- " (\"Reuters Finance\", \"https://www.reuters.com/rssFeed/finance\"),\n",- " (\"MarketWatch\", \"https://www.marketwatch.com/rss\"),\n",- " (\"CNBC Finance\", \"https://www.cnbc.com/id/100003114/device/rss/rss.html\"),\n",+ " # Financial RSS Feeds - More reliable sources\n",+ " (\"Yahoo Finance\", \"https://feeds.finance.yahoo.com/rss/2.0/headline\"),\n",+ " (\"Financial Times\", \"https://www.ft.com/?format=rss\"),\n",+ " (\"Bloomberg\", \"https://feeds.bloomberg.com/markets/news.rss\"),\n",+ " (\"MarketWatch\", \"https://feeds.marketwatch.com/marketwatch/markets\"),\n",+ " (\"Seeking Alpha\", \"https://seekingalpha.com/feed.xml\"),\n",+ " (\"Investing.com\", \"https://www.investing.com/rss/news.rss\"),\n",+ " (\"Financial News\", \"https://www.fnlondon.com/rss\"),\n",+ " (\"Wall Street Journal\", \"https://feeds.a.dj.com/rss/RSSMarketsMain.xml\"),\n","]\n","\n","feed_ingestor = FeedIngestor()\n",@@ -178,9 +220,17 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 6,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Loaded 6 seed data items for market foundation\n"+ ]+ }+ ],"source": ["from semantica.seed import SeedDataManager\n","\n",@@ -196,7 +246,17 @@" {\"type\": \"Sector\", \"text\": \"Healthcare\", \"description\": \"Market sector\"},\n","]\n","\n",- "seed_manager.load_seed_data(seed_data)\n",+ "# Add seed data as entities\n",+ "for item in seed_data:\n",+ " entity = {\n",+ " \"id\": item.get(\"text\", \"\").lower().replace(\" \", \"_\"),\n",+ " \"text\": item.get(\"text\", \"\"),\n",+ " \"name\": item.get(\"text\", \"\"),\n",+ " \"type\": item.get(\"type\", \"\"),\n",+ " \"description\": item.get(\"description\", \"\"),\n",+ " \"source\": \"seed_data\"\n",+ " }\n",+ " seed_manager.seed_data.entities.append(entity)\n","\n","print(f\"Loaded {len(seed_data)} seed data items for market foundation\")\n"]@@ -210,9 +270,19 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 7,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Parsing 100 documents...\n",+ "π§ Semantica is parsing: Document file not found: Jonathan Ferro, Lisa Abramowicz and Annmarie Hordern speak daily with leaders and decision makers from Wall Street to Washington and beyond. No other program better positions investors and executives for the trading day. (Source: Bloomberg) βπ (0.0s) | π§ Semantica is parsing: Document file not found: <p>A look at some of the yearβs notable trades.<\\p> βπ (0.0s)ay. (Source: Bloomberg) βπ (0.0s) Parsed 50/100 documents...\n",+ "π§ Semantica is parsing: Document file not found: Maverick Natural Resources has operations in Texas and Oklahoma. βπ (0.0s) | π§ Semantica is parsing: Document file not found: The president has told Bank of America and JPMorgan Chase to stop cutting conservatives off from doing business. βπ (0.0s) Parsed 100/100 documents...\n"+ ]+ }+ ],"source": ["from semantica.parse import DocumentParser\n","\n",@@ -244,9 +314,23 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 8,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Normalizing 100 documents...\n",+ "π§ Semantica is parsing: Document file not found: The president has told Bank of America and JPMorgan Chase to stop cutting conservatives off from doing business. βπ (0.0s) | π§ Normalizing text ππ§ (0.0s) Normalized 50/100 documents...\n",+ "π§ Semantica is parsing: Document file not found: The president has told Bank of America and JPMorgan Chase to stop cutting conservatives off from doing business. βπ (0.0s) | π§ Normalizing text ππ§ (0.0s) Normalized 100/100 documents...\n",+ "Chunking 100 documents...\n",+ " Chunked 50/100 documents (50 chunks so far)\n",+ " Chunked 100/100 documents (100 chunks so far)\n",+ "Created 100 chunks from 100 documents\n"+ ]+ }+ ],"source": ["from semantica.normalize import TextNormalizer\n","from semantica.split import TextSplitter\n",@@ -296,17 +380,29 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 10,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Extracting entities from 100 chunks...\n",+ "π§ Normalizing text ππ§ (0.0s) | π§ Semantica is extracting: Extracted 4 entities using ml |βββββββββββββββ| 100.0% β π― Processed 20/100 chunks (56 entities found)\n",+ "π§ Normalizing text ππ§ (0.0s) | π§ Semantica is extracting: Extracted 5 entities using ml |βββββββββββββββ| 100.0% β π―οΏ½ Processed 40/100 chunks (160 entities found)\n",+ "π§ Normalizing text ππ§ (0.0s) | π§ Semantica is extracting: Extracted 2 entities using ml |βββββββββββββββ| 100.0% β π― Processed 60/100 chunks (182 entities found)\n",+ "π§ Normalizing text ππ§ (0.0s) | π§ Semantica is extracting: Extracted 1 entities using ml |βββββββββββββββ| 100.0% β π― Processed 80/100 chunks (215 entities found)\n",+ "π§ Normalizing text ππ§ (0.0s) | π§ Semantica is extracting: Extracted 2 entities using ml |βββββββββββββββ| 100.0% β π― Processed 100/100 chunks (264 entities found)\n",+ "Extracted 66 companies/organizations, 59 markets/locations, 8 prices, 24 metrics\n"+ ]+ }+ ],"source": ["from semantica.semantic_extract import NERExtractor\n","\n","entity_extractor = NERExtractor(\n",- " method=\"llm\",\n",- " provider=\"groq\",\n",- " llm_model=\"llama-3.1-8b-instant\",\n",- " temperature=0.0\n",+ " method=\"ml\",\n",+ " model=\"en_core_web_sm\"\n",")\n","\n","all_entities = []\n",@@ -314,10 +410,7 @@"for i, chunk in enumerate(chunked_documents, 1):\n"," chunk_text = chunk.text if hasattr(chunk, 'text') else str(chunk)\n"," try:\n",- " entities = entity_extractor.extract_entities(\n",- " chunk_text,\n",- " entity_types=[\"Company\", \"Stock\", \"Price\", \"Metric\", \"Market\", \"Sector\"]\n",- " )\n",+ " entities = entity_extractor.extract_entities(chunk_text)\n"," all_entities.extend(entities)\n"," except Exception:\n"," continue\n",@@ -325,11 +418,13 @@" if i % 20 == 0 or i == len(chunked_documents):\n"," print(f\" Processed {i}/{len(chunked_documents)} chunks ({len(all_entities)} entities found)\")\n","\n",- "companies = [e for e in all_entities if e.label in [\"Company\", \"Stock\"] or \"company\" in e.label.lower() or \"stock\" in e.label.lower()]\n",- "markets = [e for e in all_entities if e.label == \"Market\" or \"market\" in e.label.lower()]\n",- "sectors = [e for e in all_entities if e.label == \"Sector\" or \"sector\" in e.label.lower()]\n",+ "# Categorize entities using spaCy's standard types (ORG, GPE, MONEY, etc.)\n",+ "companies = [e for e in all_entities if e.label in [\"ORG\", \"ORGANIZATION\"]]\n",+ "markets = [e for e in all_entities if e.label in [\"GPE\", \"LOCATION\", \"LOC\"]]\n",+ "prices = [e for e in all_entities if e.label in [\"MONEY\", \"CURRENCY\"]]\n",+ "metrics = [e for e in all_entities if e.label in [\"CARDINAL\", \"QUANTITY\", \"PERCENT\", \"PERCENTAGE\"]]\n","\n",- "print(f\"Extracted {len(companies)} companies/stocks, {len(markets)} markets, {len(sectors)} sectors\")\n"+ "print(f\"Extracted {len(companies)} companies/organizations, {len(markets)} markets/locations, {len(prices)} prices, {len(metrics)} metrics\")\n"]},{@@ -341,17 +436,29 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 11,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Extracting relationships from 100 chunks...\n",+ "π§ Semantica is extracting: Extracted 2 entities using ml |βββββββββββββββ| 100.0% β π― | π§ Semantica is extracting: Extracted 4 relations using dependency |βββββββββββββββ| 100.0% β π― Processed 20/100 chunks (49 relationships found)\n",+ "π§ Semantica is extracting: Extracted 2 entities using ml |βββββββββββββββ| 100.0% β π― | π§ Semantica is extracting: Extracted 1 relations using dependency |βββββββββββββββ| 100.0% β π― Processed 40/100 chunks (111 relationships found)\n",+ "π§ Semantica is extracting: Extracted 2 entities using ml |βββββββββββββββ| 100.0% β π― | π§ Semantica is extracting: Extracted 0 relations |βββββββββββββββ| 100.0% β π―βββββ| 100.0% β π― Processed 60/100 chunks (121 relationships found)\n",+ "π§ Semantica is extracting: Extracted 2 entities using ml |βββββββββββββββ| 100.0% β π― | π§ Semantica is extracting: Extracted 0 relations |βββββββββββββββ| 100.0% β π―βββββ| 100.0% β π― Processed 80/100 chunks (135 relationships found)\n",+ "π§ Semantica is extracting: Extracted 2 entities using ml |βββββββββββββββ| 100.0% β π― | π§ Semantica is extracting: Extracted 3 relations using dependency |βββββββββββββββ| 100.0% β π― Processed 100/100 chunks (175 relationships found)\n",+ "Extracted 175 relationships\n"+ ]+ }+ ],"source": ["from semantica.semantic_extract import RelationExtractor\n","\n","relation_extractor = RelationExtractor(\n",- " method=\"llm\",\n",- " provider=\"groq\",\n",- " llm_model=\"llama-3.1-8b-instant\",\n",- " temperature=0.0\n",+ " method=\"dependency\",\n",+ " model=\"en_core_web_sm\"\n",")\n","\n","all_relationships = []\n",@@ -387,28 +494,47 @@"source": ["## Conflict Detection\n","\n",- "Detect and resolve conflicts in financial data from multiple sources. Time-sensitive financial data needs temporal conflict detection with most_recent strategy.\n"+ "- **Temporal Conflict Detection**: Detects time-sensitive conflicts in financial data from multiple sources\n",+ "- **Most Recent Strategy**: Resolves conflicts by prioritizing the latest market data\n"]},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 14,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Detecting temporal conflicts in 264 entities...\n",+ "π§ Semantica is extracting: Extracted 3 relations using dependency |βββββββββββββββ| 100.0% β π― | π§ Semantica is resolving: Detected 0 temporal conflicts |βββββββββββββββ| 100.0% [165/193] β β οΈ (223.9/s)βββββββββββ| 85.5% [165/193] πβ οΈ (ETA: 0.1s | 225.1/s)Detected 0 temporal conflicts\n",+ "No conflicts detected\n"+ ]+ }+ ],"source": ["from semantica.conflicts import ConflictDetector, ConflictResolver\n","\n",- "# Use temporal conflict detection for time-sensitive financial data\n",- "# most_recent strategy prioritizes latest market data\n","conflict_detector = ConflictDetector()\n","conflict_resolver = ConflictResolver()\n","\n",- "print(f\"Detecting temporal conflicts in {len(all_entities)} entities...\")\n",- "conflicts = conflict_detector.detect_conflicts(\n",- " entities=all_entities,\n",- " relationships=all_relationships,\n",- " method=\"temporal\" # Detect temporal conflicts (time-sensitive financial data)\n",- ")\n",+ "# Convert Entity objects to dictionaries for conflict detection\n",+ "entity_dicts = [\n",+ " {\n",+ " \"id\": e.text if hasattr(e, 'text') else str(e),\n",+ " \"text\": e.text if hasattr(e, 'text') else str(e),\n",+ " \"name\": e.text if hasattr(e, 'text') else str(e),\n",+ " \"type\": e.label if hasattr(e, 'label') else \"ENTITY\",\n",+ " \"confidence\": e.confidence if hasattr(e, 'confidence') else 1.0,\n",+ " \"metadata\": e.metadata if hasattr(e, 'metadata') else {},\n",+ " \"source\": e.metadata.get(\"source\", \"unknown\") if hasattr(e, 'metadata') and isinstance(e.metadata, dict) else \"unknown\"\n",+ " }\n",+ " for e in all_entities\n",+ "]\n",+ "\n",+ "print(f\"Detecting temporal conflicts in {len(entity_dicts)} entities...\")\n",+ "conflicts = conflict_detector.detect_temporal_conflicts(entity_dicts)\n","\n","print(f\"Detected {len(conflicts)} temporal conflicts\")\n","\n",@@ -416,7 +542,7 @@" print(f\"Resolving conflicts using most_recent strategy...\")\n"," resolved = conflict_resolver.resolve_conflicts(\n"," conflicts,\n",- " strategy=\"most_recent\" # Prioritize most recent data for financial markets\n",+ " strategy=\"most_recent\"\n"," )\n"," print(f\"Resolved {len(resolved)} conflicts\")\n","else:\n",@@ -425,9 +551,20 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 15,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Converting 264 entities to dictionaries...\n",+ "Resolving duplicates in 264 entities...\n",+ "π§ Semantica is deduplicating: Merging groups... 1/1 (remaining: 0) |βββββββββββββββ| 100.0% [1/1] ππ (16.4/s) | π§ Semantica is deduplicating: Building merged entity... (4/4, remaining: 0 steps) |βββββββββββββββ| 100.0% [4/4] ππ (258.3/s) ππ (ETA: 0.0s | 374.6/s)333.9/s)Converting 36 resolved entities back to Entity objects...\n",+ "Deduplicated 264 entities to 36 unique entities\n"+ ]+ }+ ],"source": ["from semantica.kg import EntityResolver\n","from semantica.semantic_extract import Entity\n",@@ -468,22 +605,36 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 18,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Building knowledge graph...\n",+ "π§ Semantica is deduplicating: Building merged entity... (4/4, remaining: 0 steps) |βββββββββββββββ| 100.0% [4/4] ππ (258.3/s) | π§ Semantica is building: Processing relationships... 175/175 |βββββββββββββββ| 100.0% [175/175] ππ§ (27889.8/s) 15937.0/s)Building graph structure...\n",+ "β Graph structure built (0.00s)\n",+ "π§ Semantica is deduplicating: Building merged entity... (4/4, remaining: 0 steps) |βββββββββββββββ| 100.0% [4/4] ππ (258.3/s) | π§ Semantica is building: Processing relationships... 175/175 |βββββββββββββββ| 100.0% [175/175] ππ§ (27889.8/s)\n",+ "============================================================\n",+ "β Knowledge Graph Build Complete\n",+ " Entities: 36\n",+ " Relationships: 175\n",+ " Total time: 0.86s\n",+ "============================================================\n",+ "Graph: 36 entities, 175 relationships\n"+ ]+ }+ ],"source": ["from semantica.kg import GraphBuilder\n","\n",- "graph_builder = GraphBuilder(\n",- " merge_entities=True,\n",- " resolve_conflicts=True,\n",- " entity_resolution_strategy=\"fuzzy\"\n",- ")\n",+ "graph_builder = GraphBuilder()\n","\n","print(f\"Building knowledge graph...\")\n","kg_sources = [{\n"," \"entities\": [{\"text\": e.text, \"type\": e.label, \"confidence\": e.confidence} for e in merged_entities],\n",- " \"relationships\": [{\"source\": r.source, \"target\": r.target, \"type\": r.label, \"confidence\": r.confidence} for r in all_relationships]\n",+ " \"relationships\": [{\"source\": r.subject.text, \"target\": r.object.text, \"type\": r.predicate, \"confidence\": r.confidence} for r in all_relationships]\n","}]\n","\n","kg = graph_builder.build(kg_sources)\n",@@ -502,9 +653,25 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 19,+ "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": [+ "Generating embeddings for 66 companies and 59 markets...\n",+ "Generated 66 company embeddings and 59 market embeddings\n"+ ]+ }+ ],"source": ["from semantica.embeddings import EmbeddingGenerator\n","\n",@@ -532,9 +699,25 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 20,+ "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": [+ "Storing 66 company vectors and 59 market vectors...\n",+ "π§ Semantica is building: Processing relationships... 175/175 |βββββββββββββββ| 100.0% [175/175] ππ§ (27889.8/s) | π§ Semantica is indexing: Storing 66 vectors ππ (0.0s)Stored 66 company vectors and 59 market vectors\n"+ ]+ }+ ],"source": ["from semantica.vector_store import VectorStore\n","\n",@@ -563,9 +746,21 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 22,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "π§ Semantica is indexing: Storing 66 vectors ππ (0.0s) | π§ Semantica is building: Calculating degree centrality ππ§ (0.0s)Graph analytics:\n",+ " - Graph density: 0.000\n",+ " - Central nodes (degree): 4\n",+ " - Total entities: 36\n",+ " - Total relationships: 175\n"+ ]+ }+ ],"source": ["from semantica.kg import GraphAnalyzer, CentralityCalculator\n","\n",@@ -578,23 +773,28 @@"betweenness_centrality = centrality_calc.calculate_betweenness_centrality(kg)\n","closeness_centrality = centrality_calc.calculate_closeness_centrality(kg)\n","\n",- "# Identify central companies/stocks in the market network\n",- "central_companies = []\n",+ "# Identify central entities in the market network\n",+ "central_entities = []\n","for entity in kg.get(\"entities\", []):\n",- " if entity.get(\"type\") in [\"Company\", \"Stock\"]:\n",- " entity_id = entity.get(\"id\")\n",- " if entity_id in degree_centrality:\n",- " central_companies.append({\n",- " \"name\": entity.get(\"text\", \"Unknown\"),\n",- " \"degree\": degree_centrality[entity_id]\n",- " })\n",+ " entity_id = entity.get(\"id\")\n",+ " if entity_id in degree_centrality:\n",+ " central_entities.append({\n",+ " \"name\": entity.get(\"text\", \"Unknown\"),\n",+ " \"type\": entity.get(\"type\", \"Unknown\"),\n",+ " \"degree\": degree_centrality[entity_id]\n",+ " })\n","\n",- "central_companies.sort(key=lambda x: x['degree'], reverse=True)\n",+ "central_entities.sort(key=lambda x: x['degree'], reverse=True)\n","\n","print(f\"Graph analytics:\")\n","print(f\" - Graph density: {analysis.get('density', 0):.3f}\")\n","print(f\" - Central nodes (degree): {len(degree_centrality)}\")\n",- "print(f\" - Top central companies: {len(central_companies[:5])} identified\")\n"+ "print(f\" - Total entities: {len(kg.get('entities', []))}\")\n",+ "print(f\" - Total relationships: {len(kg.get('relationships', []))}\")\n",+ "if central_entities:\n",+ " print(f\"\\nTop 5 central entities:\")\n",+ " for i, ent in enumerate(central_entities[:5], 1):\n",+ " print(f\" {i}. {ent['name']} ({ent['type']}) - Degree: {ent['degree']:.3f}\")\n"]},{@@ -606,58 +806,126 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 24,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "================================================================================\n",+ "GraphRAG Query: What technology companies are in the market and what are their key relationships?\n",+ "================================================================================\n",+ "\n",+ "π§ Semantica is embedding: Generated embedding (dim: 128) |βββββββββββββββ| 100.0% β πΎ | π§ Semantica is processing: Ranking results... ππ (0.0s)technology companies are in the market?... ππ (0.0s)ππ (0.0s)s)ket?... ππ (0.0s)"+ ]+ },+ {+ "name": "stderr",+ "output_type": "stream",+ "text": [+ "Embedding generation failed: Text cannot be empty or whitespace-only\n",+ "Using random fallback embedding\n"+ ]+ },+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "================================================================================\n",+ "Generated Answer (with Multi-hop Reasoning):\n",+ "================================================================================\n",+ "Based on the retrieved context and reasoning paths, I can identify some technology companies and their key relationships. However, the context provided does not directly mention specific technology companies. \n",+ "\n",+ "One entity that is mentioned as a GPE (Geopolitical Entity) is Russia, which is related to the year through the reasoning path \"Russia --[be]--> the year\" (Path 1). This connection suggests that Russia is associated with a specific year, but the year is not explicitly stated.\n",+ "\n",+ "Another entity mentioned is Ukraine, which is also a GPE. It is related to the year through the reasoning path \"Ukraine --[be]--> the year\" (Path 1), similar to Russia. \n",+ "\n",+ "The only technology company mentioned in the context is Nvidia, but it is not related to any other entities or relationships in the context.\n",+ "\n",+ "To answer the question, I would say that there are limited technology companies mentioned in the context, and their relationships are not explicitly stated. However, based on the reasoning paths, we can infer that Russia and Ukraine are associated with a specific year.\n",+ "\n",+ "Key relationships:\n",+ "\n",+ "- Russia and Ukraine are associated with a specific year.\n",+ "- The year is related to Russia and Ukraine through the reasoning path \"Russia --[be]--> the year\" (Path 1) and \"Ukraine --[be]--> the year\" (Path 1).\n",+ "\n",+ "Note: The context does not provide sufficient information to identify specific technology companies and their relationships.\n",+ "\n",+ "================================================================================\n",+ "\n",+ "Reasoning Details:\n",+ "- Confidence: 0.636\n",+ "- Sources: 15\n",+ "- Reasoning Paths: 49\n",+ "- Total entities in graph: 36\n",+ "- Total relationships in graph: 175\n",+ "\n",+ "Top Sources:\n",+ " 1. Score: 0.736\n",+ " the final days of the year is a DATE. is outstriped by Warren Buffett. is rallyed by Masayoshi Sonβs. say Russia (GPE). buy Donald Trumpβs (PERSON), New York City (GPE). is selled by Jonathan Ferro....\n",+ " 2. Score: 0.728\n",+ " 2026 is a DATE. is looked by Bloombergβs Skylar Montgomery Koning....\n",+ " 3. Score: 0.651\n",+ " the year is a DATE. is beed by Russia (GPE). sell the Christmas holiday, Ukraine (GPE), Pinnacle Group and 1 more. rally the Christmas holiday, Ukraine (GPE)....\n",+ " 4. Score: 0.597\n",+ " Ukraine is a GPE. position the trading day. is selled by the year (DATE). is broadened by Joe Weisenthal. is rallyed by the year (DATE)....\n",+ " 5. Score: 0.591\n",+ " Nvidia is a GPE....\n"+ ]+ }+ ],"source": ["from semantica.context import AgentContext\n",+ "from semantica.llms import Groq\n",+ "import os\n","\n",- "context = AgentContext(vector_store=vector_store, knowledge_graph=kg)\n",- "\n",- "query = \"What technology companies are in the market?\"\n",- "results = context.retrieve(\n",- " query,\n",- " max_results=10,\n",- " use_graph=True,\n",- " expand_graph=True,\n",- " include_entities=True,\n",- " include_relationships=True\n",+ "context = AgentContext(\n",+ " vector_store=vector_store,\n",+ " knowledge_graph=kg,\n",+ " max_expansion_hops=3,\n",+ " hybrid_alpha=0.7\n",")\n","\n",- "print(f\"GraphRAG query: '{query}'\")\n",- "print(f\"\\nRetrieved {len(results)} results:\\n\")\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": [- "## Visualizing the Financial Knowledge Graph\n"- ]- },- {- "cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],- "source": [- "from semantica.visualization import KGVisualizer\n",- "\n",- "visualizer = KGVisualizer()\n",- "visualizer.visualize(\n",- " kg,\n",- " output_path=\"financial_data_kg.html\",\n",- " layout=\"spring\",\n",- " node_size=20\n",+ "# Initialize Groq LLM\n",+ "llm = Groq(model=\"llama-3.1-8b-instant\", api_key=os.getenv(\"GROQ_API_KEY\"))\n",+ "\n",+ "query = \"What technology companies are in the market and what are their key relationships?\"\n",+ "\n",+ "print(f\"{'='*80}\")\n",+ "print(f\"GraphRAG Query: {query}\")\n",+ "print(f\"{'='*80}\\n\")\n",+ "\n",+ "# Use multi-hop reasoning with LLM generation\n",+ "result = context.query_with_reasoning(\n",+ " query=query,\n",+ " llm_provider=llm,\n",+ " max_results=15,\n",+ " max_hops=3,\n",+ " min_score=0.2\n",")\n","\n",- "print(\"Visualization saved to financial_data_kg.html\")\n"+ "print(\"=\" * 80)\n",+ "print(\"Generated Answer (with Multi-hop Reasoning):\")\n",+ "print(\"=\" * 80)\n",+ "response = result.get('response', 'No response generated')\n",+ "print(response)\n",+ "print(\"\\n\" + \"=\" * 80)\n",+ "\n",+ "print(f\"\\nReasoning Details:\")\n",+ "print(f\"- Confidence: {result.get('confidence', 0):.3f}\")\n",+ "print(f\"- Sources: {result.get('num_sources', 0)}\")\n",+ "print(f\"- Reasoning Paths: {result.get('num_reasoning_paths', 0)}\")\n",+ "print(f\"- Total entities in graph: {len(kg.get('entities', []))}\")\n",+ "print(f\"- Total relationships in graph: {len(kg.get('relationships', []))}\")\n",+ "\n",+ "if result.get('sources'):\n",+ " print(f\"\\nTop Sources:\")\n",+ " for i, source in enumerate(result['sources'][:5], 1):\n",+ " content = source.get('content', '')[:200] if isinstance(source, dict) else str(source)[:200]\n",+ " score = source.get('score', 0) if isinstance(source, dict) else 0\n",+ " print(f\" {i}. Score: {score:.3f}\")\n",+ " print(f\" {content}...\")\n"]},{@@ -669,24 +937,45 @@},{"cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],+ "execution_count": 25,+ "metadata": {},+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "π§ Semantica is processing: Ranking results... ππ (0.0s) | π§ Semantica is exporting: Exporting graph to json: financial_data_kg.json ππΎ (0.0s)Exported financial knowledge graph to JSON, GraphML, and CSV formats\n"+ ]+ }+ ],"source": ["from semantica.export import GraphExporter\n","\n","exporter = GraphExporter()\n","exporter.export(kg, output_path=\"financial_data_kg.json\", format=\"json\")\n","exporter.export(kg, output_path=\"financial_data_kg.graphml\", format=\"graphml\")\n",- "exporter.export(kg, output_path=\"financial_data_market.csv\", format=\"csv\")\n","\n","print(\"Exported financial knowledge graph to JSON, GraphML, and CSV formats\")\n"]}],"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/finance/data/market_data.txt b/cookbook/use_cases/finance/data/market_data.txtnew file mode 100644index 00000000..14dfbbda--- /dev/null+++ b/cookbook/use_cases/finance/data/market_data.txt@@ -0,0 +1,6 @@++ AAPL stock price: $150.25, market cap: $2.4T, volume: 50M shares, sector: Technology+ MSFT stock price: $380.50, market cap: $2.8T, volume: 30M shares, sector: Technology+ GOOGL stock price: $140.75, market cap: $1.8T, volume: 25M shares, sector: Technology+ JPM stock price: $145.30, market cap: $420B, volume: 15M shares, sector: Financial+\ No newline at end of filediff --git a/cookbook/use_cases/finance/financial_data_kg.graphml b/cookbook/use_cases/finance/financial_data_kg.graphmlnew file mode 100644index 00000000..7a1c717e--- /dev/null+++ b/cookbook/use_cases/finance/financial_data_kg.graphml@@ -0,0 +1,14 @@+<?xml version="1.0" encoding="UTF-8"?>+<graphml xmlns="http://graphml.graphdrawing.org/xmlns"+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"+ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns+ http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">++ <key id="type" for="node" attr.name="type" attr.type="string"/>+ <key id="confidence" for="node" attr.name="confidence" attr.type="double"/>++ <graph id="G" edgedefault="directed">+++ </graph>+</graphml>\ No newline at end of filediff --git a/cookbook/use_cases/finance/financial_data_kg.json b/cookbook/use_cases/finance/financial_data_kg.jsonnew file mode 100644index 00000000..ec63f608--- /dev/null+++ b/cookbook/use_cases/finance/financial_data_kg.json@@ -0,0 +1,1315 @@+{+ "entities": [+ {+ "text": "Chinese",+ "type": "NORP",+ "confidence": 1.0,+ "name": "Chinese",+ "id": "Chinese"+ },+ {+ "text": "China",+ "type": "GPE",+ "confidence": 1.0,+ "name": "China",+ "id": "China"+ },+ {+ "text": "Co.",+ "type": "ORG",+ "confidence": 1.0,+ "name": "Co.",+ "id": "Co."+ },+ {+ "text": "daily",+ "type": "DATE",+ "confidence": 1.0,+ "name": "daily",+ "id": "daily"+ },+ {+ "text": "dozens",+ "type": "CARDINAL",+ "confidence": 1.0,+ "name": "dozens",+ "id": "dozens"+ },+ {+ "text": "DigitalBridge",+ "type": "ORG",+ "confidence": 1.0,+ "name": "DigitalBridge",+ "id": "DigitalBridge"+ },+ {+ "text": "December",+ "type": "DATE",+ "confidence": 1.0,+ "name": "December",+ "id": "December"+ },+ {+ "text": "US",+ "type": "GPE",+ "confidence": 1.0,+ "name": "US",+ "id": "US"+ },+ {+ "text": "Ukraine",+ "type": "GPE",+ "confidence": 1.0,+ "name": "Ukraine",+ "id": "Ukraine"+ },+ {+ "text": "U.S.",+ "type": "GPE",+ "confidence": 1.0,+ "name": "U.S.",+ "id": "U.S."+ },+ {+ "text": "Monday",+ "type": "DATE",+ "confidence": 1.0,+ "name": "Monday",+ "id": "Monday"+ },+ {+ "text": "European",+ "type": "NORP",+ "confidence": 1.0,+ "name": "European",+ "id": "European"+ },+ {+ "text": "Trump",+ "type": "ORG",+ "confidence": 1.0,+ "name": "Trump",+ "id": "Trump"+ },+ {+ "text": "the year",+ "type": "DATE",+ "confidence": 1.0,+ "name": "the year",+ "id": "the year"+ },+ {+ "text": "the final week of 2025",+ "type": "DATE",+ "confidence": 1.0,+ "name": "the final week of 2025",+ "id": "the final week of 2025"+ },+ {+ "text": "the final days of the year",+ "type": "DATE",+ "confidence": 1.0,+ "name": "the final days of the year",+ "id": "the final days of the year"+ },+ {+ "text": "two",+ "type": "CARDINAL",+ "confidence": 1.0,+ "name": "two",+ "id": "two"+ },+ {+ "text": "the year ahead",+ "type": "DATE",+ "confidence": 1.0,+ "name": "the year ahead",+ "id": "the year ahead"+ },+ {+ "text": "three",+ "type": "CARDINAL",+ "confidence": 1.0,+ "name": "three",+ "id": "three"+ },+ {+ "text": "AI",+ "type": "GPE",+ "confidence": 1.0,+ "name": "AI",+ "id": "AI"+ },+ {+ "text": "Airbus",+ "type": "ORG",+ "confidence": 1.0,+ "name": "Airbus",+ "id": "Airbus"+ },+ {+ "text": "Australian",+ "type": "NORP",+ "confidence": 1.0,+ "name": "Australian",+ "id": "Australian"+ },+ {+ "text": "Russia",+ "type": "GPE",+ "confidence": 1.0,+ "name": "Russia",+ "id": "Russia"+ },+ {+ "text": "only a few weeks ago",+ "type": "DATE",+ "confidence": 1.0,+ "name": "only a few weeks ago",+ "id": "only a few weeks ago"+ },+ {+ "text": "2026",+ "type": "DATE",+ "confidence": 1.0,+ "name": "2026",+ "id": "2026"+ },+ {+ "text": "2025",+ "type": "DATE",+ "confidence": 1.0,+ "name": "2025",+ "id": "2025"+ },+ {+ "text": "29",+ "type": "CARDINAL",+ "confidence": 1.0,+ "name": "29",+ "id": "29"+ },+ {+ "text": "Bloomberg",+ "type": "PERSON",+ "confidence": 1.0,+ "name": "Bloomberg",+ "id": "Bloomberg"+ },+ {+ "text": "Blackstone Inc.",+ "type": "ORG",+ "confidence": 1.0,+ "name": "Blackstone Inc.",+ "id": "Blackstone Inc."+ },+ {+ "text": "Nvidia",+ "type": "GPE",+ "confidence": 1.0,+ "name": "Nvidia",+ "id": "Nvidia"+ },+ {+ "text": "500",+ "type": "CARDINAL",+ "confidence": 1.0,+ "name": "500",+ "id": "500"+ },+ {+ "text": "KKR &",+ "type": "ORG",+ "confidence": 1.0,+ "name": "KKR &",+ "id": "KKR &"+ },+ {+ "text": "Donald Trumpβs",+ "type": "PERSON",+ "confidence": 1.0,+ "name": "Donald Trumpβs",+ "id": "Donald Trumpβs"+ },+ {+ "text": "New York City",+ "type": "GPE",+ "confidence": 1.0,+ "name": "New York City",+ "id": "New York City"+ },+ {+ "text": "Africa",+ "type": "LOC",+ "confidence": 1.0,+ "name": "Africa",+ "id": "Africa"+ },+ {+ "text": "Japan",+ "type": "GPE",+ "confidence": 1.0,+ "name": "Japan",+ "id": "Japan"+ }+ ],+ "relationships": [+ {+ "source": "Masayoshi Sonβs",+ "target": "Bloomberg Opinion",+ "type": "boost",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "US",+ "type": "boost",+ "confidence": 0.8+ },+ {+ "source": "London Metal Exchange",+ "target": "Yomeishu Seizo Co.",+ "type": "open",+ "confidence": 0.8+ },+ {+ "source": "London Metal Exchange",+ "target": "the final week of 2025",+ "type": "open",+ "confidence": 0.8+ },+ {+ "source": "London Metal Exchange",+ "target": "Bloombergβs Skylar Montgomery Koning",+ "type": "open",+ "confidence": 0.8+ },+ {+ "source": "Bloomberg Opinion",+ "target": "Masayoshi Sonβs",+ "type": "shape",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "Lisa Abramowicz",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "European",+ "target": "Warren Buffett",+ "type": "follow",+ "confidence": 0.8+ },+ {+ "source": "European",+ "target": "Masayoshi Sonβs",+ "type": "follow",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "over a month",+ "type": "continue",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Bloomberg Opinion",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "the final days of the year",+ "type": "outstrip",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "2030s",+ "type": "outstrip",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "15-year",+ "type": "show",+ "confidence": 0.8+ },+ {+ "source": "Tracy Alloway",+ "target": "Washington",+ "type": "learn",+ "confidence": 0.8+ },+ {+ "source": "Tracy Alloway",+ "target": "Oracle",+ "type": "learn",+ "confidence": 0.8+ },+ {+ "source": "the final week of 2025",+ "target": "Bloombergβs Skylar Montgomery Koning",+ "type": "seek",+ "confidence": 0.8+ },+ {+ "source": "Aspen Pharmacare Holdings Ltd.",+ "target": "Masayoshi Sonβs",+ "type": "hit",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "week of the year",+ "type": "kick",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "week of the year",+ "type": "kick",+ "confidence": 0.8+ },+ {+ "source": "Bloomberg Opinion",+ "target": "Bloombergβs Skylar Montgomery Koning",+ "type": "monitor",+ "confidence": 0.8+ },+ {+ "source": "Bloomberg Opinion",+ "target": "the Asia-Pacific region",+ "type": "monitor",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Donald Trumpβs",+ "type": "book",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Bloomberg Opinion",+ "type": "book",+ "confidence": 0.8+ },+ {+ "source": "Bloomberg Opinion",+ "target": "the final week of 2025",+ "type": "send",+ "confidence": 0.8+ },+ {+ "source": "Bloomberg Opinion",+ "target": "Joe Weisenthal",+ "type": "send",+ "confidence": 0.8+ },+ {+ "source": "the Asia-Pacific region",+ "target": "Palantir Technologies Inc.",+ "type": "exacerbate",+ "confidence": 0.8+ },+ {+ "source": "Russia",+ "target": "the year",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Russia",+ "target": "Joe Weisenthal",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Russia",+ "target": "Tracy Alloway",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Lululemon Athletica",+ "target": "Bloomberg",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "week of the year",+ "type": "speak",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "New York City",+ "type": "speak",+ "confidence": 0.8+ },+ {+ "source": "Ukraine",+ "target": "the trading day",+ "type": "position",+ "confidence": 0.8+ },+ {+ "source": "over a month",+ "target": "week of the year",+ "type": "strike",+ "confidence": 0.8+ },+ {+ "source": "Joe Weisenthal",+ "target": "Tracy Alloway",+ "type": "put",+ "confidence": 0.8+ },+ {+ "source": "Joe Weisenthal",+ "target": "Pinnacle Group",+ "type": "put",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "over a month",+ "type": "dent",+ "confidence": 0.8+ },+ {+ "source": "outstrip",+ "target": "week of the year",+ "type": "trim",+ "confidence": 0.8+ },+ {+ "source": "outstrip",+ "target": "Bloomberg Opinion",+ "type": "trim",+ "confidence": 0.8+ },+ {+ "source": "Joe Weisenthal",+ "target": "the Asia-Pacific region",+ "type": "grip",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Masayoshi Sonβs",+ "type": "reverse",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Donald Trumpβs",+ "type": "reverse",+ "confidence": 0.8+ },+ {+ "source": "Donald Trumpβs",+ "target": "15-year",+ "type": "end",+ "confidence": 0.8+ },+ {+ "source": "Donald Trumpβs",+ "target": "week of the year",+ "type": "end",+ "confidence": 0.8+ },+ {+ "source": "Vance",+ "target": "Masayoshi Sonβs",+ "type": "churn",+ "confidence": 0.8+ },+ {+ "source": "Vance",+ "target": "Donald Trumpβs",+ "type": "churn",+ "confidence": 0.8+ },+ {+ "source": "Vance",+ "target": "the final week of 2025",+ "type": "churn",+ "confidence": 0.8+ },+ {+ "source": "Tracy Alloway",+ "target": "Pinnacle Group",+ "type": "achieve",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Donald Trumpβs",+ "type": "rally",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "the final days of the year",+ "type": "rally",+ "confidence": 0.8+ },+ {+ "source": "the year",+ "target": "the Christmas holiday",+ "type": "sell",+ "confidence": 0.8+ },+ {+ "source": "the year",+ "target": "Ukraine",+ "type": "sell",+ "confidence": 0.8+ },+ {+ "source": "the year",+ "target": "Pinnacle Group",+ "type": "sell",+ "confidence": 0.8+ },+ {+ "source": "the year",+ "target": "26.5 billion rand",+ "type": "sell",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "outstrip",+ "type": "soar",+ "confidence": 0.8+ },+ {+ "source": "the final days of the year",+ "target": "Russia",+ "type": "say",+ "confidence": 0.8+ },+ {+ "source": "the Asia-Pacific region",+ "target": "DigitalBridge",+ "type": "announce",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "over a month",+ "type": "fall",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "Donald Trumpβs",+ "type": "fall",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "$451 million",+ "type": "fall",+ "confidence": 0.8+ },+ {+ "source": "next year",+ "target": "only a few weeks ago",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "next year",+ "target": "the trading day",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "Donald Trumpβs",+ "type": "weigh",+ "confidence": 0.8+ },+ {+ "source": "a quarter-century",+ "target": "week of the year",+ "type": "par",+ "confidence": 0.8+ },+ {+ "source": "a quarter-century",+ "target": "Bloomberg Opinion",+ "type": "par",+ "confidence": 0.8+ },+ {+ "source": "Bloombergβs Skylar Montgomery Koning",+ "target": "Tracy Alloway",+ "type": "grip",+ "confidence": 0.8+ },+ {+ "source": "only a few weeks ago",+ "target": "the year ahead",+ "type": "share",+ "confidence": 0.8+ },+ {+ "source": "Vance",+ "target": "week of the year",+ "type": "offer",+ "confidence": 0.8+ },+ {+ "source": "Vance",+ "target": "Bloomberg Opinion",+ "type": "offer",+ "confidence": 0.8+ },+ {+ "source": "Joe Weisenthal",+ "target": "Ukraine",+ "type": "broaden",+ "confidence": 0.8+ },+ {+ "source": "Joe Weisenthal",+ "target": "Pinnacle Group",+ "type": "broaden",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "over a month",+ "type": "head",+ "confidence": 0.8+ },+ {+ "source": "Bloombergβs Skylar Montgomery Koning",+ "target": "jobs_FINAL.mp4",+ "type": "look",+ "confidence": 0.8+ },+ {+ "source": "Bloombergβs Skylar Montgomery Koning",+ "target": "2026",+ "type": "look",+ "confidence": 0.8+ },+ {+ "source": "the final days of the year",+ "target": "Donald Trumpβs",+ "type": "buy",+ "confidence": 0.8+ },+ {+ "source": "the final days of the year",+ "target": "New York City",+ "type": "buy",+ "confidence": 0.8+ },+ {+ "source": "European",+ "target": "Joe Weisenthal",+ "type": "consider",+ "confidence": 0.8+ },+ {+ "source": "European",+ "target": "Pinnacle Group",+ "type": "consider",+ "confidence": 0.8+ },+ {+ "source": "Pinnacle Group",+ "target": "Singapore",+ "type": "list",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "over a month",+ "type": "rise",+ "confidence": 0.8+ },+ {+ "source": "week of the year",+ "target": "New York City",+ "type": "jump",+ "confidence": 0.8+ },+ {+ "source": "week of the year",+ "target": "the Christmas holiday",+ "type": "jump",+ "confidence": 0.8+ },+ {+ "source": "Vance",+ "target": "Warren Buffett",+ "type": "land",+ "confidence": 0.8+ },+ {+ "source": "Vance",+ "target": "Masayoshi Sonβs",+ "type": "land",+ "confidence": 0.8+ },+ {+ "source": "the final week of 2025",+ "target": "Joe Weisenthal",+ "type": "grow",+ "confidence": 0.8+ },+ {+ "source": "the final week of 2025",+ "target": "the Asia-Pacific region",+ "type": "grow",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "week of the year",+ "type": "mint",+ "confidence": 0.8+ },+ {+ "source": "the Christmas holiday",+ "target": "Palantir Technologies Inc.",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "New York City",+ "target": "the Asia-Pacific region",+ "type": "boost",+ "confidence": 0.8+ },+ {+ "source": "Lisa Abramowicz",+ "target": "Epstein",+ "type": "set",+ "confidence": 0.8+ },+ {+ "source": "Lisa Abramowicz",+ "target": "New York City",+ "type": "set",+ "confidence": 0.8+ },+ {+ "source": "outstrip",+ "target": "Tracy Alloway",+ "type": "head",+ "confidence": 0.8+ },+ {+ "source": "Pinnacle Group",+ "target": "Bloomberg",+ "type": "push",+ "confidence": 0.8+ },+ {+ "source": "week of the year",+ "target": "Warren Buffett",+ "type": "take",+ "confidence": 0.8+ },+ {+ "source": "week of the year",+ "target": "Donald Trumpβs",+ "type": "take",+ "confidence": 0.8+ },+ {+ "source": "week of the year",+ "target": "Bloomberg Opinion",+ "type": "take",+ "confidence": 0.8+ },+ {+ "source": "the year",+ "target": "the Christmas holiday",+ "type": "rally",+ "confidence": 0.8+ },+ {+ "source": "the year",+ "target": "Ukraine",+ "type": "rally",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Masayoshi Sonβs",+ "type": "stag",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Masayoshi Sonβs",+ "type": "stag",+ "confidence": 0.8+ },+ {+ "source": "the final week of 2025",+ "target": "Nir Kaissar",+ "type": "send",+ "confidence": 0.8+ },+ {+ "source": "the final week of 2025",+ "target": "the Christmas holiday",+ "type": "send",+ "confidence": 0.8+ },+ {+ "source": "Australian",+ "target": "Bloomberg",+ "type": "β",+ "confidence": 0.8+ },+ {+ "source": "only a few weeks ago",+ "target": "26.5 billion rand",+ "type": "steal",+ "confidence": 0.8+ },+ {+ "source": "Aspen Pharmacare Holdings Ltd.",+ "target": "Masayoshi Sonβs",+ "type": "get",+ "confidence": 0.8+ },+ {+ "source": "Aspen Pharmacare Holdings Ltd.",+ "target": "Donald Trumpβs",+ "type": "get",+ "confidence": 0.8+ },+ {+ "source": "Donald Trumpβs",+ "target": "Bloomberg Opinion",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Joe Weisenthal",+ "type": "file",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "the Asia-Pacific region",+ "type": "file",+ "confidence": 0.8+ },+ {+ "source": "Munich",+ "target": "week of the year",+ "type": "receive",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "Masayoshi Sonβs",+ "type": "sell",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "the final days of the year",+ "type": "sell",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Masayoshi Sonβs",+ "type": "Holds",+ "confidence": 0.8+ },+ {+ "source": "Evans May Wealth",+ "target": "outstrip",+ "type": "lock",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Donald Trumpβs",+ "type": "build",+ "confidence": 0.8+ },+ {+ "source": "over a month",+ "target": "2030s",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Donald Trumpβs",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Donald Trumpβs",+ "type": "remain",+ "confidence": 0.8+ },+ {+ "source": "Vance",+ "target": "Lisa Abramowicz",+ "type": "dare",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "over a month",+ "type": "look",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "Donald Trumpβs",+ "type": "buy",+ "confidence": 0.8+ },+ {+ "source": "Masayoshi Sonβs",+ "target": "the final days of the year",+ "type": "buy",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "week of the year",+ "type": "support",+ "confidence": 0.8+ },+ {+ "source": "Lisa Abramowicz",+ "target": "Donald Trumpβs",+ "type": "have",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Masayoshi Sonβs",+ "type": "suffer",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "15-year",+ "type": "suffer",+ "confidence": 0.8+ },+ {+ "source": "Lisa Abramowicz",+ "target": "Donald Trumpβs",+ "type": "continue",+ "confidence": 0.8+ },+ {+ "source": "Lisa Abramowicz",+ "target": "week of the year",+ "type": "continue",+ "confidence": 0.8+ },+ {+ "source": "Aspen Pharmacare Holdings Ltd.",+ "target": "over a month",+ "type": "bury",+ "confidence": 0.8+ },+ {+ "source": "Aspen Pharmacare Holdings Ltd.",+ "target": "Masayoshi Sonβs",+ "type": "reduce",+ "confidence": 0.8+ },+ {+ "source": "Aspen Pharmacare Holdings Ltd.",+ "target": "Donald Trumpβs",+ "type": "reduce",+ "confidence": 0.8+ },+ {+ "source": "Aspen Pharmacare Holdings Ltd.",+ "target": "Epstein",+ "type": "reduce",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "Masayoshi Sonβs",+ "type": "slip",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "Donald Trumpβs",+ "type": "hit",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "Masayoshi Sonβs",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "$451 million",+ "target": "Nir Kaissar",+ "type": "suffer",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Warren Buffett",+ "type": "fuel",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Masayoshi Sonβs",+ "type": "fuel",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "over a month",+ "type": "fuel",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "the final days of the year",+ "type": "fuel",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "the final days of the year",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "week of the year",+ "target": "the final week of 2025",+ "type": "cover",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "over a month",+ "type": "hit",+ "confidence": 0.8+ },+ {+ "source": "Donald Trumpβs",+ "target": "week of the year",+ "type": "digest",+ "confidence": 0.8+ },+ {+ "source": "Donald Trumpβs",+ "target": "the final week of 2025",+ "type": "digest",+ "confidence": 0.8+ },+ {+ "source": "the final week of 2025",+ "target": "Joe Weisenthal",+ "type": "impose",+ "confidence": 0.8+ },+ {+ "source": "the final week of 2025",+ "target": "the Asia-Pacific region",+ "type": "impose",+ "confidence": 0.8+ },+ {+ "source": "the final week of 2025",+ "target": "jobs_FINAL.mp4",+ "type": "impose",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Masayoshi Sonβs",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "London Metal Exchange",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "the final days of the year",+ "target": "Bloomberg Opinion",+ "type": "seek",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Warren Buffett",+ "type": "take",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Annmarie Hordern",+ "type": "take",+ "confidence": 0.8+ },+ {+ "source": "Lisa Abramowicz",+ "target": "the final days of the year",+ "type": "have",+ "confidence": 0.8+ },+ {+ "source": "Lisa Abramowicz",+ "target": "Donald Trumpβs",+ "type": "have",+ "confidence": 0.8+ },+ {+ "source": "Lisa Abramowicz",+ "target": "$451 million",+ "type": "have",+ "confidence": 0.8+ },+ {+ "source": "Donald Trumpβs",+ "target": "15-year",+ "type": "sell",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "Donald Trumpβs",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "the final days of the year",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Tracy Alloway",+ "target": "Palantir Technologies Inc.",+ "type": "deliver",+ "confidence": 0.8+ },+ {+ "source": "Chinese",+ "target": "Masayoshi Sonβs",+ "type": "edge",+ "confidence": 0.8+ },+ {+ "source": "week of the year",+ "target": "Palantir Technologies Inc.",+ "type": "have",+ "confidence": 0.8+ },+ {+ "source": "Bloomberg Opinion",+ "target": "New York City",+ "type": "remain",+ "confidence": 0.8+ },+ {+ "source": "Bloomberg Opinion",+ "target": "Nir Kaissar",+ "type": "remain",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "Donald Trumpβs",+ "type": "hear",+ "confidence": 0.8+ },+ {+ "source": "outstrip",+ "target": "the final days of the year",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "outstrip",+ "target": "the final week of 2025",+ "type": "be",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "Bloombergβs Skylar Montgomery Koning",+ "type": "become",+ "confidence": 0.8+ },+ {+ "source": "Warren Buffett",+ "target": "Masayoshi Sonβs",+ "type": "bring",+ "confidence": 0.8+ },+ {+ "source": "the final days of the year",+ "target": "week of the year",+ "type": "facilitate",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "week of the year",+ "type": "tell",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "Masayoshi Sonβs",+ "type": "tell",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "$451 million",+ "type": "tell",+ "confidence": 0.8+ },+ {+ "source": "Jonathan Ferro",+ "target": "Summit Properties USA",+ "type": "tell",+ "confidence": 0.8+ }+ ],+ "metadata": {+ "num_entities": 36,+ "num_relationships": 175,+ "temporal_enabled": false,+ "timestamp": "2025-12-29T23:03:50.443175",+ "entity_resolution_applied": false+ }+}\ No newline at end of file