Skip to content

Commit

Permalink
Merge pull request #394 from topoteretes/test
Browse files Browse the repository at this point in the history
Add notebooks
  • Loading branch information
Vasilije1990 authored Dec 19, 2024
2 parents 3ea57e0 + d3739d9 commit 02f46a5
Show file tree
Hide file tree
Showing 2 changed files with 757 additions and 1 deletion.
48 changes: 47 additions & 1 deletion notebooks/cognee_code_graph_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,58 @@
"await render_graph(None, include_nodes = True, include_labels = True)"
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# Let's check the evaluations"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"from evals.eval_on_hotpot import eval_on_hotpotQA\n",
"from evals.eval_on_hotpot import answer_with_cognee\n",
"from evals.eval_on_hotpot import answer_without_cognee\n",
"from evals.eval_on_hotpot import eval_answers\n",
"from cognee.base_config import get_base_config\n",
"from pathlib import Path\n",
"from tqdm import tqdm\n",
"import wget\n",
"import json\n",
"import statistics"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"answer_provider = answer_with_cognee # For native LLM answers use answer_without_cognee\n",
"num_samples = 10 # With cognee, it takes ~1m10s per sample\n",
"\n",
"base_config = get_base_config()\n",
"data_root_dir = base_config.data_root_directory\n",
"\n",
"if not Path(data_root_dir).exists():\n",
" Path(data_root_dir).mkdir()\n",
"\n",
"filepath = data_root_dir / Path(\"hotpot_dev_fullwiki_v1.json\")\n",
"if not filepath.exists():\n",
" url = 'http://curtis.ml.cmu.edu/datasets/hotpot/hotpot_dev_fullwiki_v1.json'\n",
" wget.download(url, out=data_root_dir)\n",
"\n",
"with open(filepath, \"r\") as file:\n",
" dataset = json.load(file)\n",
"\n",
"instances = dataset if not num_samples else dataset[:num_samples]\n",
"answers = []\n",
"for instance in tqdm(instances, desc=\"Getting answers\"):\n",
" answer = answer_provider(instance)\n",
" answers.append(answer)"
]
}
],
"metadata": {
Expand Down
Loading

0 comments on commit 02f46a5

Please sign in to comment.