diff --git a/docs/docs/examples/cookbooks/GraphRAG_v2.ipynb b/docs/docs/examples/cookbooks/GraphRAG_v2.ipynb index 8c01fa8ef5c07611edfed11f50a944d98f81f635..d80b1bd02473008f92500549a3aac019d4f63f9d 100644 --- a/docs/docs/examples/cookbooks/GraphRAG_v2.ipynb +++ b/docs/docs/examples/cookbooks/GraphRAG_v2.ipynb @@ -32,7 +32,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install llama-index llama-index-graph-stores-neo4j graspologic numpy==1.24.4 scipy==1.12.0" + "!pip install llama-index llama-index-graph-stores-neo4j graspologic numpy==1.24.4 scipy==1.12.0 future" ] }, { @@ -628,10 +628,14 @@ " ).retrieve(query_str)\n", "\n", " enitites = set()\n", - " pattern = r\"(\\w+(?:\\s+\\w+)*)\\s*\\({[^}]*}\\)\\s*->\\s*([^(]+?)\\s*\\({[^}]*}\\)\\s*->\\s*(\\w+(?:\\s+\\w+)*)\"\n", + " pattern = (\n", + " r\"^(\\w+(?:\\s+\\w+)*)\\s*->\\s*([a-zA-Z\\s]+?)\\s*->\\s*(\\w+(?:\\s+\\w+)*)$\"\n", + " )\n", "\n", " for node in nodes_retrieved:\n", - " matches = re.findall(pattern, node.text, re.DOTALL)\n", + " matches = re.findall(\n", + " pattern, node.text, re.MULTILINE | re.IGNORECASE\n", + " )\n", "\n", " for match in matches:\n", " subject = match[0]\n",