From 5cc73e654b55f6b82b16f8698d43f3ba4872bf62 Mon Sep 17 00:00:00 2001 From: Tomaz Bratanic Date: Sun, 15 Sep 2024 22:26:36 +0900 Subject: [PATCH] update graphreader --- llm/graphreader_langgraph.ipynb | 229 ++++++++++++++++++++++++++------ 1 file changed, 191 insertions(+), 38 deletions(-) diff --git a/llm/graphreader_langgraph.ipynb b/llm/graphreader_langgraph.ipynb index 1402cf3..628b789 100644 --- a/llm/graphreader_langgraph.ipynb +++ b/llm/graphreader_langgraph.ipynb @@ -83,6 +83,7 @@ "class OutputState(TypedDict):\n", " answer: str\n", " analysis: str\n", + " previous_actions: List[str]\n", "\n", "class OverallState(TypedDict):\n", " question: str\n", @@ -92,9 +93,7 @@ " check_atomic_facts_queue: List[str]\n", " check_chunks_queue: List[str]\n", " neighbor_check_queue: List[str]\n", - " chosen_action: str\n", - " answer: str\n", - " analysis: str" + " chosen_action: str" ] }, { @@ -170,8 +169,10 @@ "\n", "rational_chain = rational_prompt | model | StrOutputParser()\n", "\n", - "def rational_plan_node(state: OverallState) -> OverallState:\n", + "def rational_plan_node(state: InputState) -> OverallState:\n", " rational_plan = rational_chain.invoke({\"question\": state.get(\"question\")})\n", + " print(\"-\" * 20)\n", + " print(f\"Step: rational_plan\")\n", " print(f\"Rational plan: {rational_plan}\")\n", " return {\"rational_plan\": rational_plan, \"previous_actions\": [\"rational_plan\"]}" ] @@ -341,31 +342,36 @@ " \"\"\", params={\"key_elements\": key_elements})\n", " return data\n", "\n", - "def get_neighbors_by_key_element(nodes):\n", + "def get_neighbors_by_key_element(key_elements):\n", + " print(f\"Key elements: {key_elements}\")\n", " data = neo4j_graph.query(\"\"\"\n", " MATCH (k:KeyElement)<-[:HAS_KEY_ELEMENT]-()-[:HAS_KEY_ELEMENT]->(neighbor)\n", - " WHERE k.id IN $nodes AND NOT neighbor.id IN $nodes\n", - " RETURN neighbor.id AS key_element, count(*) AS count\n", - " ORDER BY count DESC LIMIT 25\n", - " \"\"\", params={\"nodes\":nodes})\n", + " WHERE k.id IN $key_elements AND NOT neighbor.id IN $key_elements\n", + " WITH neighbor, count(*) AS count\n", + " ORDER BY count DESC LIMIT 50\n", + " RETURN collect(neighbor.id) AS possible_candidates\n", + " \"\"\", params={\"key_elements\":key_elements})\n", " return data\n", "\n", "def atomic_fact_check(state: OverallState) -> OverallState:\n", " atomic_facts = get_atomic_facts(state.get(\"check_atomic_facts_queue\"))\n", + " print(\"-\" * 20)\n", + " print(f\"Step: atomic_fact_check\")\n", " print(f\"Reading atomic facts about: {state.get('check_atomic_facts_queue')}\")\n", " atomic_facts_results = atomic_fact_chain.invoke({\"question\":state.get(\"question\"), \n", " \"rational_plan\": state.get(\"rational_plan\"), \n", " \"notebook\": state.get(\"notebook\"), \n", - " \"previous_actions\": state.get(\"previous_action\"),\n", + " \"previous_actions\": state.get(\"previous_actions\"),\n", " \"atomic_facts\": atomic_facts})\n", "\n", " notebook = atomic_facts_results.updated_notebook\n", " print(f\"Rational for next action after atomic check: {atomic_facts_results.rational_next_action}\")\n", " chosen_action = parse_function(atomic_facts_results.chosen_action)\n", + " print(f\"Chosen action: {chosen_action}\")\n", " response = {\"notebook\": notebook, \"chosen_action\": chosen_action.get(\"function_name\"), 'check_atomic_facts_queue': [],\n", " \"previous_actions\": [f\"atomic_fact_check({state.get('check_atomic_facts_queue')})\"]}\n", " if chosen_action.get(\"function_name\") == \"stop_and_read_neighbor\":\n", - " neighbors = get_neighbors_by_key_element(atomic_facts)\n", + " neighbors = get_neighbors_by_key_element(state.get(\"check_atomic_facts_queue\"))\n", " response['neighbor_check_queue'] = neighbors\n", " elif chosen_action.get(\"function_name\") == \"read_chunk\":\n", " response['check_chunks_queue'] = chosen_action.get(\"arguments\")[0]\n", @@ -472,7 +478,7 @@ "\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", + " MATCH (c:Chunk)-[:HAS_ATOMIC_FACT]->()-[:HAS_KEY_ELEMENT]->(element)\n", " WHERE c.id = $chunk_id\n", " RETURN collect(element.id) AS neighbors\n", " \"\"\", params={\"chunk_id\": chunk_id})\n", @@ -481,6 +487,9 @@ "def chunk_check(state: OverallState) -> OverallState:\n", " check_chunks_queue = state.get(\"check_chunks_queue\")\n", " chunk_id = check_chunks_queue.pop()\n", + " print(\"-\" * 20)\n", + " print(f\"Step: read chunk({chunk_id})\")\n", + " \n", " chunks_text = get_chunk(chunk_id)\n", " read_chunk_results = chunk_read_chain.invoke(\n", " {\"question\":state.get(\"question\"), \n", @@ -493,6 +502,7 @@ " notebook = read_chunk_results.updated_notebook\n", " print(f\"Rational for next action after reading chunks: {read_chunk_results.rational_next_move}\")\n", " chosen_action = parse_function(read_chunk_results.chosen_action)\n", + " print(f\"Chosen action: {chosen_action}\")\n", " response = {\"notebook\": notebook, \"chosen_action\": chosen_action.get(\"function_name\"),\n", " \"previous_actions\": [f\"read_chunks({chunk_id})\"]}\n", " if chosen_action.get('function_name') == 'read_subsequent_chunk':\n", @@ -510,7 +520,6 @@ " response[\"neighbor_check_queue\"] = neighbors\n", " \n", " response[\"check_chunks_queue\"] = check_chunks_queue\n", - " print(response)\n", " return response" ] }, @@ -581,20 +590,19 @@ "\n", "def neighbor_select(state: OverallState) -> OverallState:\n", " print(\"-\" * 20)\n", - " print(state.get(\"neighbor_check_queue\"))\n", - " print(\"-\" * 20)\n", + " print(f\"Step: neighbor select\")\n", + " print(f\"Possible candidates: {state.get('neighbor_check_queue')}\")\n", " neighbor_select_results = neighbor_select_chain.invoke(\n", " {\"question\": state.get(\"question\"),\"rational_plan\": state.get(\"rational_plan\"),\n", " \"notebook\": state.get(\"notebook\"), \"nodes\": state.get(\"neighbor_check_queue\"),\n", - " \"previous_actions\": [\"neighbor_select\"]})\n", + " \"previous_actions\": state.get(\"previous_actions\")})\n", " print(f\"Rational for next action after selecting neighbor: {neighbor_select_results.rational_next_move}\")\n", " chosen_action = parse_function(neighbor_select_results.chosen_action)\n", - " print(chosen_action)\n", + " print(f\"Chosen action: {chosen_action}\")\n", " # Empty neighbor select queue\n", - " response = {\"chosen_action\": chosen_action.get(\"function_name\"), \"neighbor_check_queue\": []}\n", + " response = {\"chosen_action\": chosen_action.get(\"function_name\"), \"neighbor_check_queue\": [], \"previous_actions\": [\"neighbor_select\"]}\n", " if chosen_action.get(\"function_name\") == \"read_neighbor_node\":\n", " response[\"check_atomic_facts_queue\"] = [chosen_action.get(\"arguments\")[0]]\n", - " print(response)\n", " return response\n", " \n" ] @@ -667,7 +675,9 @@ "\n", "answer_reasoning_chain = answer_reasoning_prompt | model.with_structured_output(AnswerReasonOutput)\n", "\n", - "def answer_reasoning(state: OverallState) -> OverallState:\n", + "def answer_reasoning(state: OverallState) -> OutputState:\n", + " print(\"-\" * 20)\n", + " print(\"Step: Answer Reasoning\")\n", " final_answer = answer_reasoning_chain.invoke(\n", " {\"question\":state.get(\"question\"),\n", " \"notebook\": state.get(\"notebook\")})\n", @@ -767,29 +777,36 @@ "name": "stdout", "output_type": "stream", "text": [ - "Rational plan: To answer this question, we need to identify specific battles Joan of Arc participated in and determine the outcomes of these battles to see if any were losses.\n", - "Reading atomic facts about: ['Joan of Arc', 'military leader', 'siege of Orléans', 'Loire Campaign', 'unsuccessful']\n", - "Rational for next action after atomic check: The atomic facts provide specific instances of battles Joan of Arc participated in and mention both victories and defeats. This information directly addresses the question about whether Joan of Arc lost any battles.\n", - "Rational for next action after reading chunks: The current chunk provides detailed information about Joan of Arc's military engagements, including her participation in unsuccessful sieges such as Paris and La Charité. This information directly answers the question about her losing battles.\n", - "{'notebook': \"Joan of Arc participated in several battles and sieges during the Hundred Years' War, including the successful siege of Orléans and the Loire Campaign. However, she also faced defeats such as the unsuccessful siege of Paris and the failed siege of La Charité.\", 'chosen_action': 'termination', 'previous_actions': ['read_chunks(3feaa3f3137a5f839bfc207bc5c2ffdb)'], 'check_chunks_queue': []}\n" + "--------------------\n", + "Step: rational_plan\n", + "Rational plan: To answer this question, we need to identify the specific battles Joan of Arc participated in during her military career. Then, we must determine the outcomes of these battles to see if any were lost by her forces. This requires gathering information on each battle's result where Joan of Arc had a significant role.\n", + "--------------------\n", + "Step: atomic_fact_check\n", + "Reading atomic facts about: ['Joan of Arc', 'siege of Orléans', 'Loire Campaign', 'Compiègne', 'unsuccessful']\n", + "Rational for next action after atomic check: To fully answer the question, we need to explore more details about the battles Joan of Arc lost, specifically the unsuccessful sieges of Paris and La Charité, to determine the context and implications of these losses.\n", + "Chosen action: {'function_name': 'read_chunk', 'arguments': [['3feaa3f3137a5f839bfc207bc5c2ffdb']]}\n", + "--------------------\n", + "Step: read chunk(3feaa3f3137a5f839bfc207bc5c2ffdb)\n", + "Rational for next action after reading chunks: The current text chunk confirms Joan of Arc's participation in failed sieges at Paris and La Charité, which aligns with the notebook content. This information is sufficient to answer the question about whether Joan of Arc lost any battles. No further information from other chunks is necessary as the question specifically pertains to her battle losses, which have been clearly identified.\n", + "Chosen action: {'function_name': 'termination', 'arguments': []}\n", + "--------------------\n", + "Step: Answer Reasoning\n" ] }, { "data": { "text/plain": [ "{'question': 'Did Joan of Arc lose any battles?',\n", - " 'rational_plan': 'To answer this question, we need to identify specific battles Joan of Arc participated in and determine the outcomes of these battles to see if any were losses.',\n", - " 'notebook': \"Joan of Arc participated in several battles and sieges during the Hundred Years' War, including the successful siege of Orléans and the Loire Campaign. However, she also faced defeats such as the unsuccessful siege of Paris and the failed siege of La Charité.\",\n", + " 'rational_plan': \"To answer this question, we need to identify the specific battles Joan of Arc participated in during her military career. Then, we must determine the outcomes of these battles to see if any were lost by her forces. This requires gathering information on each battle's result where Joan of Arc had a significant role.\",\n", + " 'notebook': \"Joan of Arc participated in several key battles during the Hundred Years' War, including the siege of Orléans and the Loire Campaign, both of which ended in victories. However, she also participated in failed sieges, such as those at Paris and La Charité. Additionally, she was involved in the unsuccessful siege of Paris in September 1429 and the failed siege of La Charité in November. Her role in these defeats reduced the court's faith in her.\",\n", " 'previous_actions': ['rational_plan',\n", " 'initial_node_selection',\n", - " \"atomic_fact_check(['Joan of Arc', 'military leader', 'siege of Orléans', 'Loire Campaign', 'unsuccessful'])\",\n", + " \"atomic_fact_check(['Joan of Arc', 'siege of Orléans', 'Loire Campaign', 'Compiègne', 'unsuccessful'])\",\n", " 'read_chunks(3feaa3f3137a5f839bfc207bc5c2ffdb)',\n", " 'answer_reasoning'],\n", " 'check_atomic_facts_queue': [],\n", " 'check_chunks_queue': [],\n", - " 'chosen_action': 'termination',\n", - " 'answer': 'Yes, Joan of Arc did lose some battles, including the siege of Paris and the siege of La Charité.',\n", - " 'analysis': \"The notebook content indicates that Joan of Arc participated in various military engagements during the Hundred Years' War, including both successful and unsuccessful battles. Specifically, it mentions her defeats at the siege of Paris and the siege of La Charité.\"}" + " 'chosen_action': 'termination'}" ] }, "execution_count": 14, @@ -803,7 +820,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "6f41c1ab-7973-4e20-888a-2be5c94475a4", "metadata": {}, "outputs": [ @@ -811,9 +828,43 @@ "name": "stdout", "output_type": "stream", "text": [ - "Rational plan: To answer the question about the current weather in Spain, we need to access real-time weather data or forecasts from a reliable meteorological source. This would include information on temperature, precipitation, and any weather advisories currently in effect for various regions within Spain.\n", - "Reading atomic facts about: ['Spain', 'real-time weather data', 'weather data', 'current weather', 'temperature']\n" + "--------------------\n", + "Step: rational_plan\n", + "Rational plan: To answer the question about the current weather in Spain, I would need to access real-time weather data or forecasts from a reliable meteorological source. This would involve checking the latest weather updates for various regions in Spain, including temperature, precipitation, and any weather warnings.\n", + "--------------------\n", + "Step: atomic_fact_check\n", + "Reading atomic facts about: ['Spain']\n", + "Rational for next action after atomic check: Since the atomic facts provided do not contain any relevant information about the current weather in Spain, and given the nature of the question which requires up-to-date meteorological data, it is unlikely that further exploration of the text will yield the necessary information.\n", + "Chosen action: {'function_name': 'stop_and_read_neighbor', 'arguments': []}\n", + "Key elements: ['Spain']\n", + "--------------------\n", + "Step: neighbor select\n", + "Possible candidates: [{'possible_candidates': []}]\n", + "Rational for next action after selecting neighbor: Since the neighbor nodes do not contain any possible candidates that would provide information about the current weather in Spain, it is clear that further exploration within this graph will not yield the necessary real-time weather data.\n", + "Chosen action: {'function_name': 'termination', 'arguments': []}\n", + "--------------------\n", + "Step: Answer Reasoning\n" ] + }, + { + "data": { + "text/plain": [ + "{'question': 'What is the weather in Spain?',\n", + " 'rational_plan': 'To answer the question about the current weather in Spain, I would need to access real-time weather data or forecasts from a reliable meteorological source. This would involve checking the latest weather updates for various regions in Spain, including temperature, precipitation, and any weather warnings.',\n", + " 'notebook': 'The question seeks current weather information for Spain, which typically requires real-time data or forecasts from meteorological sources.',\n", + " 'previous_actions': ['rational_plan',\n", + " 'initial_node_selection',\n", + " \"atomic_fact_check(['Spain'])\",\n", + " 'neighbor_select',\n", + " 'answer_reasoning'],\n", + " 'check_atomic_facts_queue': [],\n", + " 'neighbor_check_queue': [],\n", + " 'chosen_action': 'termination'}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -822,20 +873,122 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "718479e9-a9f4-4346-9f83-04468e55beb4", "metadata": {}, - "outputs": [], + "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": null, + "execution_count": 17, "id": "21900334-d1dc-4761-a576-61c4569f920e", "metadata": {}, - "outputs": [], + "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 cities Joan of Arc visited during her early life. Next, we need to list the cities where she won battles. Finally, we compare these two lists to see if there are any cities that appear on both lists, indicating that she visited them in her early life and also won battles there later.\n", + "--------------------\n", + "Step: atomic_fact_check\n", + "Reading atomic facts about: ['Joan of Arc', 'Domrémy', 'siege of Orléans', 'Loire Campaign', 'Compiègne']\n", + "Rational for next action after atomic check: Identify the cities Joan of Arc visited during her early life and the cities where she won battles. Compare these lists to determine if there are any cities that appear on both lists.\n", + "Chosen action: {'function_name': 'read_chunk', 'arguments': [['3feaa3f3137a5f839bfc207bc5c2ffdb']]}\n", + "--------------------\n", + "Step: read chunk(3feaa3f3137a5f839bfc207bc5c2ffdb)\n", + "Rational for next action after reading chunks: The current chunk provides additional details about Joan's military engagements, including her role in the siege of Orléans and other battles. However, it does not offer new information about her early life visits to cities where she later won battles. We need to continue searching for more specific information about the cities she visited during her early life to see if any of these match the cities where she later won battles.\n", + "Chosen action: {'function_name': 'search_more', 'arguments': []}\n", + "--------------------\n", + "Step: neighbor select\n", + "Possible candidates: [{'neighbors': ['Joan of Arc', 'France', 'patron saint', 'defender', 'French nation', 'siege of Orléans', 'coronation', 'Charles VII', \"Hundred Years' War\", 'divine guidance', 'military leader', 'gender roles', 'savior', 'Joan of Arc', 'Domrémy', 'northeast France', 'propertied peasant family', 'Joan of Arc', 'Charles VII', '1428', 'visions', 'archangel Michael', 'Saint Margaret', 'Saint Catherine', 'English domination', 'Joan of Arc', 'siege of Orléans', 'Charles VII', 'devotion', 'purity', 'relief army', 'seventeen years', 'Joan of Arc', 'siege of Orléans', 'April 1429', 'banner', 'French army', 'English', 'Joan of Arc', 'Charles VII', 'English', 'French', 'Loire Campaign', 'Patay', 'Reims', 'King of France', 'Joan of Arc', 'coronation', 'Charles VII', \"Hundred Years' War\", 'French morale', 'Joan of Arc', 'Paris', 'La Charité', 'siege', \"court's faith\", 'Joan of Arc', 'English', '1430', 'Compiègne', 'Burgundians', 'volunteers', 'Joan of Arc', '23 May', 'Burgundian troops', 'capture', 'captured', 'Joan of Arc', 'English', 'escape attempts', 'November', 'Joan of Arc', 'visions', 'trial', 'Bishop Pierre Cauchon', 'heresy', 'blaspheming', \"men's clothes\", 'demonic', 'church']}]\n", + "Rational for next action after selecting neighbor: To find out if Joan of Arc visited any cities in her early life where she later won battles, we need to explore more about the cities she visited in her early life and where she fought battles. The neighbor node 'Domrémy' could potentially provide more specific information about her early life visits, which is crucial for answering the question.\n", + "Chosen action: {'function_name': 'read_neighbor_node', 'arguments': ['Domrémy']}\n", + "--------------------\n", + "Step: atomic_fact_check\n", + "Reading atomic facts about: ['Domrémy']\n", + "Rational for next action after atomic check: Since the atomic fact about Joan of Arc being born in Domrémy has already been noted in the notebook, there is no new information to add. The next step should be to continue exploring other nodes or chunks to find more information about cities Joan visited in her early life and where she won battles.\n", + "Chosen action: {'function_name': 'stop_and_read_neighbor', 'arguments': []}\n", + "Key elements: ['Domrémy']\n", + "--------------------\n", + "Step: neighbor select\n", + "Possible candidates: [{'possible_candidates': ['Joan of Arc', 'northeast France', 'propertied peasant family']}]\n", + "Rational for next action after selecting neighbor: The neighbor node 'northeast France' might provide geographical context but is unlikely to offer specific details about cities Joan of Arc visited in her early life or where she won battles. The node 'propertied peasant family' could give background on her family status but does not directly relate to the cities she visited or battles won. Since the current information sufficiently answers the question, further exploration of these nodes is unnecessary.\n", + "Chosen action: {'function_name': 'termination', 'arguments': []}\n", + "--------------------\n", + "Step: Answer Reasoning\n" + ] + }, + { + "data": { + "text/plain": [ + "{'question': 'Did Joan of Arc visit any cities in early life where she won battles later?',\n", + " 'rational_plan': 'In order to answer this question, we first need to identify the cities Joan of Arc visited during her early life. Next, we need to list the cities where she won battles. Finally, we compare these two lists to see if there are any cities that appear on both lists, indicating that she visited them in her early life and also won battles there later.',\n", + " 'notebook': 'Joan of Arc was born in Domrémy, northeast France. She visited Orléans and participated in battles there, notably lifting the siege of Orléans in April 1429. Joan also encouraged the French during the Loire Campaign, leading to victories such as at Patay. She was involved in the unsuccessful sieges of Paris and La Charité, and organized a relief for Compiègne.',\n", + " 'previous_actions': ['rational_plan',\n", + " 'initial_node_selection',\n", + " \"atomic_fact_check(['Joan of Arc', 'Domrémy', 'siege of Orléans', 'Loire Campaign', 'Compiègne'])\",\n", + " 'read_chunks(3feaa3f3137a5f839bfc207bc5c2ffdb)',\n", + " 'neighbor_select',\n", + " \"atomic_fact_check(['Domrémy'])\",\n", + " 'neighbor_select',\n", + " 'answer_reasoning'],\n", + " 'check_atomic_facts_queue': [],\n", + " 'check_chunks_queue': [],\n", + " 'neighbor_check_queue': [],\n", + " 'chosen_action': 'termination'}" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "langgraph.invoke({\"question\":\"Did Joan of Arc visit any cities in early life where she won battles later?\"})" ]