File size: 1,970 Bytes
5a5be73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "dfad5f6b",
   "metadata": {},
   "source": [
    "# Demo: AI-Powered Scientific Research Companion\n",
    "This notebook demonstrates how to use the `Dispatcher` to search for papers, retrieve reproducible notebook cells, and fetch a knowledge graph."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "307d78b9",
   "metadata": {},
   "outputs": [],
   "source": [
    "from orchestrator.dispatcher import Dispatcher\n",
    "\n",
    "# Initialize dispatcher\n",
    "dispatcher = Dispatcher()\n",
    "\n",
    "# Example query\n",
    "query = \"CRISPR delivery\"\n",
    "\n",
    "# 1. Search for papers\n",
    "papers = dispatcher.search_papers(query, limit=3)\n",
    "print(\"Papers found:\")\n",
    "for p in papers:\n",
    "    print(f\"- {p['title']} (ID: {p['id']})\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8db389c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2. Retrieve notebook cells for the first paper\n",
    "if papers:\n",
    "    first_id = papers[0]['id']\n",
    "    cells = dispatcher.get_notebook_cells(first_id)\n",
    "    print(f\"Notebook cells for paper {first_id}:\")\n",
    "    for i, cell in enumerate(cells, 1):\n",
    "        print(f\"Cell {i}:\")\n",
    "        print(cell)\n",
    "        print(\"------\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "52666e2a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 3. Fetch knowledge graph for the first paper\n",
    "if papers:\n",
    "    graph = dispatcher.get_graph(first_id)\n",
    "    print(\"Graph nodes:\")\n",
    "    for node in graph.get(\"nodes\", []):\n",
    "        print(node)\n",
    "    print(\"Graph edges:\")\n",
    "    for edge in graph.get(\"edges\", []):\n",
    "        print(edge)\n"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 5
}