Skip to content

Commit

Permalink
move graphreader to separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasonjo committed Sep 15, 2024
1 parent 5cc73e6 commit 5a9b790
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 51 deletions.
3 changes: 3 additions & 0 deletions graphreader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GraphReader implementation

link to paper: https://arxiv.org/abs/2406.14550
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@
" \"\"\", params={\"chunk_id\": chunk_id})\n",
" return data\n",
"\n",
"# Todo get more neighbors\n",
"def get_neighbors_by_chunk(chunk_id: str) -> List[str]:\n",
" data = neo4j_graph.query(\"\"\"\n",
" MATCH (c:Chunk)-[:HAS_ATOMIC_FACT]->()-[:HAS_KEY_ELEMENT]->(element)\n",
Expand Down Expand Up @@ -871,57 +872,6 @@
"langgraph.invoke({\"question\":\"What is the weather in Spain?\"})"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "718479e9-a9f4-4346-9f83-04468e55beb4",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--------------------\n",
"Step: rational_plan\n",
"Rational plan: In order to answer this question, we first need to identify the specific battles Joan of Arc participated in during her military career, and then determine which one was the final battle she fought before her capture or end of military activity.\n",
"--------------------\n",
"Step: atomic_fact_check\n",
"Reading atomic facts about: ['Joan of Arc', 'Compiègne', 'Loire Campaign', 'siege', 'besieged']\n",
"Rational for next action after atomic check: To determine the last battle Joan of Arc fought, we need to confirm the details of her capture and the events leading up to it, specifically focusing on her activities around the time she was captured.\n",
"Chosen action: {'function_name': 'read_chunk', 'arguments': [['3feaa3f3137a5f839bfc207bc5c2ffdb']]}\n",
"--------------------\n",
"Step: read chunk(3feaa3f3137a5f839bfc207bc5c2ffdb)\n",
"Rational for next action after reading chunks: The information in the current text chunk confirms that the last battle Joan of Arc fought was the attempt to relieve Compiègne, where she was captured. This aligns with the information previously noted and provides a clear answer to the question.\n",
"Chosen action: {'function_name': 'termination', 'arguments': []}\n",
"--------------------\n",
"Step: Answer Reasoning\n"
]
},
{
"data": {
"text/plain": [
"{'question': 'What is the last battle that Joan of Arc fought?',\n",
" 'rational_plan': 'In order to answer this question, we first need to identify the specific battles Joan of Arc participated in during her military career, and then determine which one was the final battle she fought before her capture or end of military activity.',\n",
" 'notebook': 'Joan of Arc participated in several battles during her military career, including the siege of Orléans, the Loire Campaign, and the siege of Paris. She was captured during an attempt to relieve Compiègne, which was besieged by the Burgundians. The last battle Joan of Arc fought was the attempt to relieve Compiègne, where she was captured by Burgundian troops on 23 May 1430.',\n",
" 'previous_actions': ['rational_plan',\n",
" 'initial_node_selection',\n",
" \"atomic_fact_check(['Joan of Arc', 'Compiègne', 'Loire Campaign', 'siege', 'besieged'])\",\n",
" 'read_chunks(3feaa3f3137a5f839bfc207bc5c2ffdb)',\n",
" 'answer_reasoning'],\n",
" 'check_atomic_facts_queue': [],\n",
" 'check_chunks_queue': [],\n",
" 'chosen_action': 'termination'}"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"langgraph.invoke({\"question\":\"What is the last battle that Joan of Arc fought?\"})"
]
},
{
"cell_type": "code",
"execution_count": 17,
Expand Down

0 comments on commit 5a9b790

Please sign in to comment.