diff --git a/examples/Multi-step research agent.ipynb b/examples/Multi-step research agent.ipynb index e572dc6d..2cc580e8 100644 --- a/examples/Multi-step research agent.ipynb +++ b/examples/Multi-step research agent.ipynb @@ -42,15 +42,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "f98875ae-db68-4f1d-9c86-93a32633b19d", "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", - "import shutil\n", - "import os, sys\n", - "import platform\n", + "import os\n", "\n", "import kuzu\n", "from dotenv import load_dotenv\n", @@ -61,18 +59,20 @@ "WORKING_DIR = Path(os.path.realpath(\".\"))\n", "\n", "from motleycrew import MotleyCrew\n", - "from motleycrew.storage import MotleyKuzuGraphStore\n", - "from motleycrew.common import configure_logging\n", + "from motleycrew.common import configure_logging, LLMFramework\n", + "from motleycrew.common.llms import init_llm\n", "from motleycrew.applications.research_agent.question_task import QuestionTask\n", "from motleycrew.applications.research_agent.answer_task import AnswerTask\n", "from motleycrew.tools.simple_retriever_tool import SimpleRetrieverTool\n", "\n", + "from llama_index.embeddings.openai import OpenAIEmbedding\n", + "\n", "configure_logging(verbose=True)" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "0f351a51-df42-4c12-8f14-a5fe94d4f145", "metadata": {}, "outputs": [], @@ -83,18 +83,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "eac94541-2eb0-4e5a-9303-03ad924135e0", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "fatal: destination path 'mahabharata' already exists and is not an empty directory.\n" - ] - } - ], + "outputs": [], "source": [ "# Only run this the first time you run the notebook, to get the raw data\n", "!git clone https://github.com/rahulnyk/mahabharata.git" @@ -110,14 +102,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "2024-05-31 19:10:49,165 - motleycrew_logger - INFO - No db_path provided, creating temporary directory for database\n", - "INFO:motleycrew_logger:No db_path provided, creating temporary directory for database\n", - "2024-05-31 19:10:49,167 - motleycrew_logger - INFO - Using Kuzu graph store with path: /var/folders/fv/tyhll76x0fn6l7j_q2nhvyg00000gn/T/tmp3dn3ez5x/kuzu_db\n", - "INFO:motleycrew_logger:Using Kuzu graph store with path: /var/folders/fv/tyhll76x0fn6l7j_q2nhvyg00000gn/T/tmp3dn3ez5x/kuzu_db\n", - "2024-05-31 19:10:49,209 - motleycrew_logger - INFO - Node table MotleyGraphNode does not exist in the database, creating\n", - "INFO:motleycrew_logger:Node table MotleyGraphNode does not exist in the database, creating\n", - "2024-05-31 19:10:49,220 - motleycrew_logger - INFO - Relation table dummy from MotleyGraphNode to MotleyGraphNode does not exist in the database, creating\n", - "INFO:motleycrew_logger:Relation table dummy from MotleyGraphNode to MotleyGraphNode does not exist in the database, creating\n" + "2024-09-27 22:33:38,055 - motleycrew - INFO - No db_path provided, creating temporary directory for database\n", + "2024-09-27 22:33:38,056 - motleycrew - INFO - Using Kuzu graph store with path: /var/folders/fv/tyhll76x0fn6l7j_q2nhvyg00000gn/T/tmp4obi9n3p/kuzu_db\n" ] } ], @@ -135,68 +121,38 @@ "name": "stderr", "output_type": "stream", "text": [ - "2024-05-31 19:10:51,695 - motleycrew_logger - INFO - Node table TaskNode does not exist in the database, creating\n", - "INFO:motleycrew_logger:Node table TaskNode does not exist in the database, creating\n", - "2024-05-31 19:10:51,698 - motleycrew_logger - INFO - Property name not present in table for label TaskNode, creating\n", - "INFO:motleycrew_logger:Property name not present in table for label TaskNode, creating\n", - "2024-05-31 19:10:51,700 - motleycrew_logger - INFO - Property done not present in table for label TaskNode, creating\n", - "INFO:motleycrew_logger:Property done not present in table for label TaskNode, creating\n", - "2024-05-31 19:10:51,702 - motleycrew_logger - INFO - Node table QuestionGenerationTaskUnit does not exist in the database, creating\n", - "INFO:motleycrew_logger:Node table QuestionGenerationTaskUnit does not exist in the database, creating\n", - "2024-05-31 19:10:51,703 - motleycrew_logger - INFO - Property status not present in table for label QuestionGenerationTaskUnit, creating\n", - "INFO:motleycrew_logger:Property status not present in table for label QuestionGenerationTaskUnit, creating\n", - "2024-05-31 19:10:51,705 - motleycrew_logger - INFO - Property output not present in table for label QuestionGenerationTaskUnit, creating\n", - "INFO:motleycrew_logger:Property output not present in table for label QuestionGenerationTaskUnit, creating\n", - "2024-05-31 19:10:51,705 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "2024-05-31 19:10:51,707 - motleycrew_logger - INFO - Property question not present in table for label QuestionGenerationTaskUnit, creating\n", - "INFO:motleycrew_logger:Property question not present in table for label QuestionGenerationTaskUnit, creating\n", - "2024-05-31 19:10:51,707 - motleycrew_logger - WARNING - No known Cypher type matching annotation , will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation , will use JSON string\n", - "2024-05-31 19:10:51,710 - motleycrew_logger - INFO - Relation table QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit to TaskNode does not exist in the database, creating\n", - "INFO:motleycrew_logger:Relation table QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit to TaskNode does not exist in the database, creating\n", - "2024-05-31 19:10:51,712 - motleycrew_logger - INFO - Inserting new node with label TaskNode: name='QuestionTask' done=False\n", - "INFO:motleycrew_logger:Inserting new node with label TaskNode: name='QuestionTask' done=False\n", - "2024-05-31 19:10:51,718 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:10:51,719 - motleycrew_logger - INFO - Relation table task_is_upstream from TaskNode to TaskNode does not exist in the database, creating\n", - "INFO:motleycrew_logger:Relation table task_is_upstream from TaskNode to TaskNode does not exist in the database, creating\n", - "2024-05-31 19:10:51,722 - motleycrew_logger - INFO - Node table Question does not exist in the database, creating\n", - "INFO:motleycrew_logger:Node table Question does not exist in the database, creating\n", - "2024-05-31 19:10:51,724 - motleycrew_logger - INFO - Property question not present in table for label Question, creating\n", - "INFO:motleycrew_logger:Property question not present in table for label Question, creating\n", - "2024-05-31 19:10:51,725 - motleycrew_logger - INFO - Property answer not present in table for label Question, creating\n", - "INFO:motleycrew_logger:Property answer not present in table for label Question, creating\n", - "2024-05-31 19:10:51,727 - motleycrew_logger - INFO - Property context not present in table for label Question, creating\n", - "INFO:motleycrew_logger:Property context not present in table for label Question, creating\n", - "2024-05-31 19:10:51,727 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", - "2024-05-31 19:10:51,730 - motleycrew_logger - INFO - Inserting new node with label Question: question='Why did Arjuna kill Karna, his half-brother?' answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question='Why did Arjuna kill Karna, his half-brother?' answer=None context=None\n", - "2024-05-31 19:10:51,733 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:10:51,830 - motleycrew_logger - INFO - Node table QuestionAnsweringTaskUnit does not exist in the database, creating\n", - "INFO:motleycrew_logger:Node table QuestionAnsweringTaskUnit does not exist in the database, creating\n", - "2024-05-31 19:10:51,833 - motleycrew_logger - INFO - Property status not present in table for label QuestionAnsweringTaskUnit, creating\n", - "INFO:motleycrew_logger:Property status not present in table for label QuestionAnsweringTaskUnit, creating\n", - "2024-05-31 19:10:51,835 - motleycrew_logger - INFO - Property output not present in table for label QuestionAnsweringTaskUnit, creating\n", - "INFO:motleycrew_logger:Property output not present in table for label QuestionAnsweringTaskUnit, creating\n", - "2024-05-31 19:10:51,835 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "2024-05-31 19:10:51,841 - motleycrew_logger - INFO - Property question not present in table for label QuestionAnsweringTaskUnit, creating\n", - "INFO:motleycrew_logger:Property question not present in table for label QuestionAnsweringTaskUnit, creating\n", - "2024-05-31 19:10:51,841 - motleycrew_logger - WARNING - No known Cypher type matching annotation , will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation , will use JSON string\n", - "2024-05-31 19:10:51,848 - motleycrew_logger - INFO - Relation table QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit to TaskNode does not exist in the database, creating\n", - "INFO:motleycrew_logger:Relation table QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit to TaskNode does not exist in the database, creating\n", - "2024-05-31 19:10:51,851 - motleycrew_logger - INFO - Inserting new node with label TaskNode: name='AnswerTask' done=False\n", - "INFO:motleycrew_logger:Inserting new node with label TaskNode: name='AnswerTask' done=False\n", - "2024-05-31 19:10:51,853 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:10:51,874 - motleycrew_logger - INFO - Creating relation task_is_upstream from TaskNode:0 to TaskNode:1\n", - "INFO:motleycrew_logger:Creating relation task_is_upstream from TaskNode:0 to TaskNode:1\n", - "2024-05-31 19:10:51,880 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n" + "2024-09-27 22:33:38,974 - motleycrew - INFO - Node table TaskNode does not exist in the database, creating\n", + "2024-09-27 22:33:38,980 - motleycrew - INFO - Property name not present in table for label TaskNode, creating\n", + "2024-09-27 22:33:38,982 - motleycrew - INFO - Property done not present in table for label TaskNode, creating\n", + "2024-09-27 22:33:38,983 - motleycrew - INFO - Node table QuestionGenerationTaskUnit does not exist in the database, creating\n", + "2024-09-27 22:33:38,985 - motleycrew - INFO - Property status not present in table for label QuestionGenerationTaskUnit, creating\n", + "2024-09-27 22:33:38,986 - motleycrew - INFO - Property output not present in table for label QuestionGenerationTaskUnit, creating\n", + "2024-09-27 22:33:38,986 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:38,989 - motleycrew - INFO - Property question not present in table for label QuestionGenerationTaskUnit, creating\n", + "2024-09-27 22:33:38,989 - motleycrew - INFO - No known Cypher type matching annotation , will use JSON string\n", + "2024-09-27 22:33:38,991 - motleycrew - INFO - Relation table QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit to TaskNode does not exist in the database, creating\n", + "2024-09-27 22:33:38,993 - motleycrew - INFO - Inserting new node with label TaskNode: name='QuestionTask' done=False\n", + "2024-09-27 22:33:38,997 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:38,998 - motleycrew - INFO - Relation table task_is_upstream from TaskNode to TaskNode does not exist in the database, creating\n", + "2024-09-27 22:33:39,000 - motleycrew - INFO - Node table Question does not exist in the database, creating\n", + "2024-09-27 22:33:39,002 - motleycrew - INFO - Property question not present in table for label Question, creating\n", + "2024-09-27 22:33:39,003 - motleycrew - INFO - Property answer not present in table for label Question, creating\n", + "2024-09-27 22:33:39,005 - motleycrew - INFO - Property context not present in table for label Question, creating\n", + "2024-09-27 22:33:39,005 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:39,007 - motleycrew - INFO - Inserting new node with label Question: question='Why did Arjuna kill Karna, his half-brother?' answer=None context=None\n", + "2024-09-27 22:33:39,007 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:39,009 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:39,025 - motleycrew - INFO - Node table QuestionAnsweringTaskUnit does not exist in the database, creating\n", + "2024-09-27 22:33:39,027 - motleycrew - INFO - Property status not present in table for label QuestionAnsweringTaskUnit, creating\n", + "2024-09-27 22:33:39,028 - motleycrew - INFO - Property output not present in table for label QuestionAnsweringTaskUnit, creating\n", + "2024-09-27 22:33:39,028 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:39,030 - motleycrew - INFO - Property question not present in table for label QuestionAnsweringTaskUnit, creating\n", + "2024-09-27 22:33:39,030 - motleycrew - INFO - No known Cypher type matching annotation , will use JSON string\n", + "2024-09-27 22:33:39,032 - motleycrew - INFO - Relation table QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit to TaskNode does not exist in the database, creating\n", + "2024-09-27 22:33:39,034 - motleycrew - INFO - Inserting new node with label TaskNode: name='AnswerTask' done=False\n", + "2024-09-27 22:33:39,035 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:39,047 - motleycrew - INFO - Creating relation task_is_upstream from TaskNode:0 to TaskNode:1\n", + "2024-09-27 22:33:39,054 - motleycrew - INFO - Relation created OK\n" ] }, { @@ -215,18 +171,21 @@ "MAX_ITER = 3\n", "ANSWER_LENGTH = 200\n", "\n", - "query_tool = SimpleRetrieverTool(DATA_DIR, PERSIST_DIR, return_strings_only=True)\n", + "embeddings = OpenAIEmbedding(model=\"text-embedding-ada-002\")\n", + "llm = init_llm(LLMFramework.LANGCHAIN, llm_name=\"gpt-4o\")\n", + "\n", + "query_tool = SimpleRetrieverTool(DATA_DIR, PERSIST_DIR, return_strings_only=True, embeddings=embeddings)\n", "\n", "# We need to pass the crew to the Tasks so they have access to the graph store\n", "# and the crew is aware of them\n", "\n", "# The question task is responsible for new question generation\n", "question_recipe = QuestionTask(\n", - " crew=crew, question=QUESTION, query_tool=query_tool, max_iter=MAX_ITER\n", + " crew=crew, question=QUESTION, query_tool=query_tool, max_iter=MAX_ITER, llm=llm\n", ")\n", "\n", "# The answer task is responsible for rolling the answers up the tree\n", - "answer_recipe = AnswerTask(answer_length=ANSWER_LENGTH, crew=crew)\n", + "answer_recipe = AnswerTask(answer_length=ANSWER_LENGTH, crew=crew, llm=llm)\n", "\n", "# Only kick off the answer task once the question task is done\n", "question_recipe >> answer_recipe" @@ -244,312 +203,174 @@ "name": "stderr", "output_type": "stream", "text": [ - "2024-05-31 19:11:05,574 - motleycrew_logger - INFO - Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", - "INFO:motleycrew_logger:Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", - "2024-05-31 19:11:05,575 - motleycrew_logger - INFO - Processing task: QuestionTask(name=QuestionTask, done=False)\n", - "INFO:motleycrew_logger:Processing task: QuestionTask(name=QuestionTask, done=False)\n", - "2024-05-31 19:11:05,586 - motleycrew_logger - INFO - Loaded unanswered questions: [Question(id=0, question=Why did Arjuna kill Karna, his half-brother?, answer=None, context=None)]\n", - "INFO:motleycrew_logger:Loaded unanswered questions: [Question(id=0, question=Why did Arjuna kill Karna, his half-brother?, answer=None, context=None)]\n", - "2024-05-31 19:11:06,332 - motleycrew_logger - INFO - Most pertinent question according to the tool: question='Why did Arjuna kill Karna, his half-brother?' answer=None context=None\n", - "INFO:motleycrew_logger:Most pertinent question according to the tool: question='Why did Arjuna kill Karna, his half-brother?' answer=None context=None\n", - "2024-05-31 19:11:06,333 - motleycrew_logger - INFO - Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", - "INFO:motleycrew_logger:Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", - "2024-05-31 19:11:06,334 - motleycrew_logger - INFO - Processing task: TaskUnit(status=pending)\n", - "INFO:motleycrew_logger:Processing task: TaskUnit(status=pending)\n", - "2024-05-31 19:11:06,334 - motleycrew_logger - INFO - Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "INFO:motleycrew_logger:Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "2024-05-31 19:11:06,335 - motleycrew_logger - INFO - Node TaskUnit(status=running) does not exist, creating\n", - "INFO:motleycrew_logger:Node TaskUnit(status=running) does not exist, creating\n", - "2024-05-31 19:11:06,337 - motleycrew_logger - INFO - Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", - "INFO:motleycrew_logger:Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", - "2024-05-31 19:11:06,337 - motleycrew_logger - WARNING - No known Cypher type matching annotation , will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation , will use JSON string\n", - "2024-05-31 19:11:06,342 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:06,349 - motleycrew_logger - INFO - Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", - "INFO:motleycrew_logger:Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", - "2024-05-31 19:11:06,352 - motleycrew_logger - INFO - Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:0 to TaskNode:0\n", - "INFO:motleycrew_logger:Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:0 to TaskNode:0\n", - "2024-05-31 19:11:06,356 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:06,357 - motleycrew_logger - INFO - ==== Started iteration 1 of 3 ====\n", - "INFO:motleycrew_logger:==== Started iteration 1 of 3 ====\n", - "2024-05-31 19:11:09,851 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", - "2024-05-31 19:11:15,855 - motleycrew_logger - INFO - Inserting question: What were the circumstances that led to Arjuna killing Karna during their duel?\n", - "INFO:motleycrew_logger:Inserting question: What were the circumstances that led to Arjuna killing Karna during their duel?\n", - "2024-05-31 19:11:15,859 - motleycrew_logger - INFO - Inserting new node with label Question: question='What were the circumstances that led to Arjuna killing Karna during their duel?' answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question='What were the circumstances that led to Arjuna killing Karna during their duel?' answer=None context=None\n", - "2024-05-31 19:11:15,868 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:15,875 - motleycrew_logger - INFO - Relation table is_subquestion from Question to Question does not exist in the database, creating\n", - "INFO:motleycrew_logger:Relation table is_subquestion from Question to Question does not exist in the database, creating\n", - "2024-05-31 19:11:15,878 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:0 to Question:1\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:0 to Question:1\n", - "2024-05-31 19:11:15,885 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:15,885 - motleycrew_logger - INFO - Inserting question: How did Karna's promise to Kunti influence his actions in the battle against Arjuna?\n", - "INFO:motleycrew_logger:Inserting question: How did Karna's promise to Kunti influence his actions in the battle against Arjuna?\n", - "2024-05-31 19:11:15,887 - motleycrew_logger - INFO - Inserting new node with label Question: question=\"How did Karna's promise to Kunti influence his actions in the battle against Arjuna?\" answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question=\"How did Karna's promise to Kunti influence his actions in the battle against Arjuna?\" answer=None context=None\n", - "2024-05-31 19:11:15,889 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:15,892 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:0 to Question:2\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:0 to Question:2\n", - "2024-05-31 19:11:15,895 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:15,895 - motleycrew_logger - INFO - Inserting question: What role did Krishna play in the duel between Karna and Arjuna?\n", - "INFO:motleycrew_logger:Inserting question: What role did Krishna play in the duel between Karna and Arjuna?\n", - "2024-05-31 19:11:15,897 - motleycrew_logger - INFO - Inserting new node with label Question: question='What role did Krishna play in the duel between Karna and Arjuna?' answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question='What role did Krishna play in the duel between Karna and Arjuna?' answer=None context=None\n", - "2024-05-31 19:11:15,899 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:15,902 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:0 to Question:3\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:0 to Question:3\n", - "2024-05-31 19:11:15,905 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:15,905 - motleycrew_logger - INFO - Inserted 3 questions\n", - "INFO:motleycrew_logger:Inserted 3 questions\n", - "2024-05-31 19:11:15,907 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "2024-05-31 19:11:15,909 - motleycrew_logger - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", - "INFO:motleycrew_logger:Task unit TaskUnit(status=running) completed, marking as done\n", - "2024-05-31 19:11:15,914 - motleycrew_logger - INFO - Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", - "INFO:motleycrew_logger:Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", - "2024-05-31 19:11:15,914 - motleycrew_logger - INFO - Processing task: QuestionTask(name=QuestionTask, done=False)\n", - "INFO:motleycrew_logger:Processing task: QuestionTask(name=QuestionTask, done=False)\n", - "2024-05-31 19:11:15,917 - motleycrew_logger - INFO - Loaded unanswered questions: [Question(id=1, question=What were the circumstances that led to Arjuna killing Karna during their duel?, answer=None, context=None), Question(id=2, question=How did Karna's promise to Kunti influence his actions in the battle against Arjuna?, answer=None, context=None), Question(id=3, question=What role did Krishna play in the duel between Karna and Arjuna?, answer=None, context=None)]\n", - "INFO:motleycrew_logger:Loaded unanswered questions: [Question(id=1, question=What were the circumstances that led to Arjuna killing Karna during their duel?, answer=None, context=None), Question(id=2, question=How did Karna's promise to Kunti influence his actions in the battle against Arjuna?, answer=None, context=None), Question(id=3, question=What role did Krishna play in the duel between Karna and Arjuna?, answer=None, context=None)]\n", - "2024-05-31 19:11:16,654 - motleycrew_logger - INFO - Most pertinent question according to the tool: question='What were the circumstances that led to Arjuna killing Karna during their duel?' answer=None context=None\n", - "INFO:motleycrew_logger:Most pertinent question according to the tool: question='What were the circumstances that led to Arjuna killing Karna during their duel?' answer=None context=None\n", - "2024-05-31 19:11:16,655 - motleycrew_logger - INFO - Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", - "INFO:motleycrew_logger:Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", - "2024-05-31 19:11:16,655 - motleycrew_logger - INFO - Processing task: TaskUnit(status=pending)\n", - "INFO:motleycrew_logger:Processing task: TaskUnit(status=pending)\n", - "2024-05-31 19:11:16,656 - motleycrew_logger - INFO - Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "INFO:motleycrew_logger:Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "2024-05-31 19:11:16,657 - motleycrew_logger - INFO - Node TaskUnit(status=running) does not exist, creating\n", - "INFO:motleycrew_logger:Node TaskUnit(status=running) does not exist, creating\n", - "2024-05-31 19:11:16,658 - motleycrew_logger - INFO - Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", - "INFO:motleycrew_logger:Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", - "2024-05-31 19:11:16,659 - motleycrew_logger - WARNING - No known Cypher type matching annotation , will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation , will use JSON string\n", - "2024-05-31 19:11:16,663 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:16,670 - motleycrew_logger - INFO - Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", - "INFO:motleycrew_logger:Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", - "2024-05-31 19:11:16,673 - motleycrew_logger - INFO - Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:1 to TaskNode:0\n", - "INFO:motleycrew_logger:Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:1 to TaskNode:0\n", - "2024-05-31 19:11:16,676 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:16,677 - motleycrew_logger - INFO - ==== Started iteration 2 of 3 ====\n", - "INFO:motleycrew_logger:==== Started iteration 2 of 3 ====\n", - "2024-05-31 19:11:20,597 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", - "2024-05-31 19:11:26,599 - motleycrew_logger - INFO - Inserting question: What role did Krishna play in influencing the outcome of the duel between Karna and Arjuna?\n", - "INFO:motleycrew_logger:Inserting question: What role did Krishna play in influencing the outcome of the duel between Karna and Arjuna?\n", - "2024-05-31 19:11:26,603 - motleycrew_logger - INFO - Inserting new node with label Question: question='What role did Krishna play in influencing the outcome of the duel between Karna and Arjuna?' answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question='What role did Krishna play in influencing the outcome of the duel between Karna and Arjuna?' answer=None context=None\n", - "2024-05-31 19:11:26,608 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:26,613 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:1 to Question:4\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:1 to Question:4\n", - "2024-05-31 19:11:26,618 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:26,618 - motleycrew_logger - INFO - Inserting question: How did the curses on Karna affect his performance and decisions during the duel with Arjuna?\n", - "INFO:motleycrew_logger:Inserting question: How did the curses on Karna affect his performance and decisions during the duel with Arjuna?\n", - "2024-05-31 19:11:26,620 - motleycrew_logger - INFO - Inserting new node with label Question: question='How did the curses on Karna affect his performance and decisions during the duel with Arjuna?' answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question='How did the curses on Karna affect his performance and decisions during the duel with Arjuna?' answer=None context=None\n", - "2024-05-31 19:11:26,622 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:26,626 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:1 to Question:5\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:1 to Question:5\n", - "2024-05-31 19:11:26,629 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:26,630 - motleycrew_logger - INFO - Inserting question: What were the psychological and strategic factors that led to Karna's vulnerability in his duel against Arjuna?\n", - "INFO:motleycrew_logger:Inserting question: What were the psychological and strategic factors that led to Karna's vulnerability in his duel against Arjuna?\n", - "2024-05-31 19:11:26,631 - motleycrew_logger - INFO - Inserting new node with label Question: question=\"What were the psychological and strategic factors that led to Karna's vulnerability in his duel against Arjuna?\" answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question=\"What were the psychological and strategic factors that led to Karna's vulnerability in his duel against Arjuna?\" answer=None context=None\n", - "2024-05-31 19:11:26,633 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:26,636 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:1 to Question:6\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:1 to Question:6\n", - "2024-05-31 19:11:26,638 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:26,639 - motleycrew_logger - INFO - Inserted 3 questions\n", - "INFO:motleycrew_logger:Inserted 3 questions\n", - "2024-05-31 19:11:26,640 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "2024-05-31 19:11:26,642 - motleycrew_logger - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", - "INFO:motleycrew_logger:Task unit TaskUnit(status=running) completed, marking as done\n", - "2024-05-31 19:11:26,646 - motleycrew_logger - INFO - Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", - "INFO:motleycrew_logger:Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", - "2024-05-31 19:11:26,646 - motleycrew_logger - INFO - Processing task: QuestionTask(name=QuestionTask, done=False)\n", - "INFO:motleycrew_logger:Processing task: QuestionTask(name=QuestionTask, done=False)\n", - "2024-05-31 19:11:26,649 - motleycrew_logger - INFO - Loaded unanswered questions: [Question(id=2, question=How did Karna's promise to Kunti influence his actions in the battle against Arjuna?, answer=None, context=None), Question(id=3, question=What role did Krishna play in the duel between Karna and Arjuna?, answer=None, context=None), Question(id=4, question=What role did Krishna play in influencing the outcome of the duel between Karna and Arjuna?, answer=None, context=None), Question(id=5, question=How did the curses on Karna affect his performance and decisions during the duel with Arjuna?, answer=None, context=None), Question(id=6, question=What were the psychological and strategic factors that led to Karna's vulnerability in his duel against Arjuna?, answer=None, context=None)]\n", - "INFO:motleycrew_logger:Loaded unanswered questions: [Question(id=2, question=How did Karna's promise to Kunti influence his actions in the battle against Arjuna?, answer=None, context=None), Question(id=3, question=What role did Krishna play in the duel between Karna and Arjuna?, answer=None, context=None), Question(id=4, question=What role did Krishna play in influencing the outcome of the duel between Karna and Arjuna?, answer=None, context=None), Question(id=5, question=How did the curses on Karna affect his performance and decisions during the duel with Arjuna?, answer=None, context=None), Question(id=6, question=What were the psychological and strategic factors that led to Karna's vulnerability in his duel against Arjuna?, answer=None, context=None)]\n", - "2024-05-31 19:11:27,452 - motleycrew_logger - INFO - Most pertinent question according to the tool: question=\"How did Karna's promise to Kunti influence his actions in the battle against Arjuna?\" answer=None context=None\n", - "INFO:motleycrew_logger:Most pertinent question according to the tool: question=\"How did Karna's promise to Kunti influence his actions in the battle against Arjuna?\" answer=None context=None\n", - "2024-05-31 19:11:27,454 - motleycrew_logger - INFO - Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", - "INFO:motleycrew_logger:Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", - "2024-05-31 19:11:27,454 - motleycrew_logger - INFO - Processing task: TaskUnit(status=pending)\n", - "INFO:motleycrew_logger:Processing task: TaskUnit(status=pending)\n", - "2024-05-31 19:11:27,455 - motleycrew_logger - INFO - Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "INFO:motleycrew_logger:Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "2024-05-31 19:11:27,456 - motleycrew_logger - INFO - Node TaskUnit(status=running) does not exist, creating\n", - "INFO:motleycrew_logger:Node TaskUnit(status=running) does not exist, creating\n", - "2024-05-31 19:11:27,458 - motleycrew_logger - INFO - Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", - "INFO:motleycrew_logger:Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", - "2024-05-31 19:11:27,459 - motleycrew_logger - WARNING - No known Cypher type matching annotation , will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation , will use JSON string\n", - "2024-05-31 19:11:27,464 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:27,473 - motleycrew_logger - INFO - Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", - "INFO:motleycrew_logger:Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", - "2024-05-31 19:11:27,478 - motleycrew_logger - INFO - Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:2 to TaskNode:0\n", - "INFO:motleycrew_logger:Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:2 to TaskNode:0\n", - "2024-05-31 19:11:27,482 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:27,482 - motleycrew_logger - INFO - ==== Started iteration 3 of 3 ====\n", - "INFO:motleycrew_logger:==== Started iteration 3 of 3 ====\n", - "2024-05-31 19:11:31,733 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", - "2024-05-31 19:11:37,737 - motleycrew_logger - INFO - Inserting question: What specific promise did Karna make to Kunti regarding the battle against her sons, and how did this promise influence his actions during the battle with Arjuna?\n", - "INFO:motleycrew_logger:Inserting question: What specific promise did Karna make to Kunti regarding the battle against her sons, and how did this promise influence his actions during the battle with Arjuna?\n", - "2024-05-31 19:11:37,742 - motleycrew_logger - INFO - Inserting new node with label Question: question='What specific promise did Karna make to Kunti regarding the battle against her sons, and how did this promise influence his actions during the battle with Arjuna?' answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question='What specific promise did Karna make to Kunti regarding the battle against her sons, and how did this promise influence his actions during the battle with Arjuna?' answer=None context=None\n", - "2024-05-31 19:11:37,752 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:37,760 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:2 to Question:7\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:2 to Question:7\n", - "2024-05-31 19:11:37,766 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:37,767 - motleycrew_logger - INFO - Inserting question: How did Karna's adherence to his promise to Kunti affect the outcomes of his encounters with other Pandavas on the battlefield?\n", - "INFO:motleycrew_logger:Inserting question: How did Karna's adherence to his promise to Kunti affect the outcomes of his encounters with other Pandavas on the battlefield?\n", - "2024-05-31 19:11:37,769 - motleycrew_logger - INFO - Inserting new node with label Question: question=\"How did Karna's adherence to his promise to Kunti affect the outcomes of his encounters with other Pandavas on the battlefield?\" answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question=\"How did Karna's adherence to his promise to Kunti affect the outcomes of his encounters with other Pandavas on the battlefield?\" answer=None context=None\n", - "2024-05-31 19:11:37,773 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:37,778 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:2 to Question:8\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:2 to Question:8\n", - "2024-05-31 19:11:37,783 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:37,784 - motleycrew_logger - INFO - Inserting question: In what ways did Karna's promise to Kunti reflect his personal values and affect his strategic decisions during the war?\n", - "INFO:motleycrew_logger:Inserting question: In what ways did Karna's promise to Kunti reflect his personal values and affect his strategic decisions during the war?\n", - "2024-05-31 19:11:37,785 - motleycrew_logger - INFO - Inserting new node with label Question: question=\"In what ways did Karna's promise to Kunti reflect his personal values and affect his strategic decisions during the war?\" answer=None context=None\n", - "INFO:motleycrew_logger:Inserting new node with label Question: question=\"In what ways did Karna's promise to Kunti reflect his personal values and affect his strategic decisions during the war?\" answer=None context=None\n", - "2024-05-31 19:11:37,787 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:37,791 - motleycrew_logger - INFO - Creating relation is_subquestion from Question:2 to Question:9\n", - "INFO:motleycrew_logger:Creating relation is_subquestion from Question:2 to Question:9\n", - "2024-05-31 19:11:37,794 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:37,795 - motleycrew_logger - INFO - Inserted 3 questions\n", - "INFO:motleycrew_logger:Inserted 3 questions\n", - "2024-05-31 19:11:37,797 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "2024-05-31 19:11:37,799 - motleycrew_logger - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", - "INFO:motleycrew_logger:Task unit TaskUnit(status=running) completed, marking as done\n", - "2024-05-31 19:11:37,806 - motleycrew_logger - INFO - Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", - "INFO:motleycrew_logger:Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", - "2024-05-31 19:11:37,806 - motleycrew_logger - INFO - Processing task: AnswerTask(name=AnswerTask, done=False)\n", - "INFO:motleycrew_logger:Processing task: AnswerTask(name=AnswerTask, done=False)\n", - "2024-05-31 19:11:37,812 - motleycrew_logger - INFO - Available questions: [Question(id=1, question=What were the circumstances that led to Arjuna killing Karna during their duel?, answer=None, context=[\"~ 158. Karna Duels with Arjuna...]), Question(id=2, question=How did Karna's promise to Kunti influence his actions in the battle against Arjuna?, answer=None, context=[\"\"I'm thirsty,\" he said, and Ar...])]\n", - "INFO:motleycrew_logger:Available questions: [Question(id=1, question=What were the circumstances that led to Arjuna killing Karna during their duel?, answer=None, context=[\"~ 158. Karna Duels with Arjuna...]), Question(id=2, question=How did Karna's promise to Kunti influence his actions in the battle against Arjuna?, answer=None, context=[\"\"I'm thirsty,\" he said, and Ar...])]\n", - "2024-05-31 19:11:37,815 - motleycrew_logger - INFO - Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", - "INFO:motleycrew_logger:Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", - "2024-05-31 19:11:37,816 - motleycrew_logger - INFO - Processing task: TaskUnit(status=pending)\n", - "INFO:motleycrew_logger:Processing task: TaskUnit(status=pending)\n", - "2024-05-31 19:11:37,816 - motleycrew_logger - INFO - Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "INFO:motleycrew_logger:Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "2024-05-31 19:11:37,817 - motleycrew_logger - INFO - Node TaskUnit(status=running) does not exist, creating\n", - "INFO:motleycrew_logger:Node TaskUnit(status=running) does not exist, creating\n", - "2024-05-31 19:11:37,817 - motleycrew_logger - INFO - Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", - "INFO:motleycrew_logger:Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", - "2024-05-31 19:11:37,818 - motleycrew_logger - WARNING - No known Cypher type matching annotation , will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation , will use JSON string\n", - "2024-05-31 19:11:37,821 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:37,826 - motleycrew_logger - INFO - Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", - "INFO:motleycrew_logger:Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", - "2024-05-31 19:11:37,828 - motleycrew_logger - INFO - Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:0 to TaskNode:1\n", - "INFO:motleycrew_logger:Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:0 to TaskNode:1\n", - "2024-05-31 19:11:37,831 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:11:52,231 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "2024-05-31 19:11:52,234 - motleycrew_logger - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", - "INFO:motleycrew_logger:Task unit TaskUnit(status=running) completed, marking as done\n", - "2024-05-31 19:11:52,242 - motleycrew_logger - INFO - Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", - "INFO:motleycrew_logger:Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", - "2024-05-31 19:11:52,242 - motleycrew_logger - INFO - Processing task: AnswerTask(name=AnswerTask, done=False)\n", - "INFO:motleycrew_logger:Processing task: AnswerTask(name=AnswerTask, done=False)\n", - "2024-05-31 19:11:52,247 - motleycrew_logger - INFO - Available questions: [Question(id=2, question=How did Karna's promise to Kunti influence his actions in the battle against Arjuna?, answer=None, context=[\"\"I'm thirsty,\" he said, and Ar...])]\n", - "INFO:motleycrew_logger:Available questions: [Question(id=2, question=How did Karna's promise to Kunti influence his actions in the battle against Arjuna?, answer=None, context=[\"\"I'm thirsty,\" he said, and Ar...])]\n", - "2024-05-31 19:11:52,250 - motleycrew_logger - INFO - Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", - "INFO:motleycrew_logger:Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", - "2024-05-31 19:11:52,251 - motleycrew_logger - INFO - Processing task: TaskUnit(status=pending)\n", - "INFO:motleycrew_logger:Processing task: TaskUnit(status=pending)\n", - "2024-05-31 19:11:52,251 - motleycrew_logger - INFO - Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "INFO:motleycrew_logger:Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "2024-05-31 19:11:52,251 - motleycrew_logger - INFO - Node TaskUnit(status=running) does not exist, creating\n", - "INFO:motleycrew_logger:Node TaskUnit(status=running) does not exist, creating\n", - "2024-05-31 19:11:52,252 - motleycrew_logger - INFO - Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", - "INFO:motleycrew_logger:Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", - "2024-05-31 19:11:52,253 - motleycrew_logger - WARNING - No known Cypher type matching annotation , will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation , will use JSON string\n", - "2024-05-31 19:11:52,255 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:11:52,260 - motleycrew_logger - INFO - Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", - "INFO:motleycrew_logger:Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", - "2024-05-31 19:11:52,263 - motleycrew_logger - INFO - Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:1 to TaskNode:1\n", - "INFO:motleycrew_logger:Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:1 to TaskNode:1\n", - "2024-05-31 19:11:52,266 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:12:04,015 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "2024-05-31 19:12:04,019 - motleycrew_logger - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", - "INFO:motleycrew_logger:Task unit TaskUnit(status=running) completed, marking as done\n", - "2024-05-31 19:12:04,028 - motleycrew_logger - INFO - Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", - "INFO:motleycrew_logger:Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", - "2024-05-31 19:12:04,029 - motleycrew_logger - INFO - Processing task: AnswerTask(name=AnswerTask, done=False)\n", - "INFO:motleycrew_logger:Processing task: AnswerTask(name=AnswerTask, done=False)\n", - "2024-05-31 19:12:04,033 - motleycrew_logger - INFO - Available questions: [Question(id=0, question=Why did Arjuna kill Karna, his half-brother?, answer=None, context=[\"That way, when this war is ove...])]\n", - "INFO:motleycrew_logger:Available questions: [Question(id=0, question=Why did Arjuna kill Karna, his half-brother?, answer=None, context=[\"That way, when this war is ove...])]\n", - "2024-05-31 19:12:04,037 - motleycrew_logger - INFO - Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", - "INFO:motleycrew_logger:Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", - "2024-05-31 19:12:04,037 - motleycrew_logger - INFO - Processing task: TaskUnit(status=pending)\n", - "INFO:motleycrew_logger:Processing task: TaskUnit(status=pending)\n", - "2024-05-31 19:12:04,037 - motleycrew_logger - INFO - Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "INFO:motleycrew_logger:Assigned unit TaskUnit(status=pending) to agent , dispatching\n", - "2024-05-31 19:12:04,038 - motleycrew_logger - INFO - Node TaskUnit(status=running) does not exist, creating\n", - "INFO:motleycrew_logger:Node TaskUnit(status=running) does not exist, creating\n", - "2024-05-31 19:12:04,039 - motleycrew_logger - INFO - Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", - "INFO:motleycrew_logger:Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", - "2024-05-31 19:12:04,039 - motleycrew_logger - WARNING - No known Cypher type matching annotation , will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation , will use JSON string\n", - "2024-05-31 19:12:04,042 - motleycrew_logger - INFO - Node created OK\n", - "INFO:motleycrew_logger:Node created OK\n", - "2024-05-31 19:12:04,047 - motleycrew_logger - INFO - Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", - "INFO:motleycrew_logger:Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", - "2024-05-31 19:12:04,050 - motleycrew_logger - INFO - Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:2 to TaskNode:1\n", - "INFO:motleycrew_logger:Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:2 to TaskNode:1\n", - "2024-05-31 19:12:04,055 - motleycrew_logger - INFO - Relation created OK\n", - "INFO:motleycrew_logger:Relation created OK\n", - "2024-05-31 19:12:14,520 - motleycrew_logger - WARNING - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "WARNING:motleycrew_logger:No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", - "2024-05-31 19:12:14,524 - motleycrew_logger - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", - "INFO:motleycrew_logger:Task unit TaskUnit(status=running) completed, marking as done\n", - "2024-05-31 19:12:14,533 - motleycrew_logger - INFO - Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", - "INFO:motleycrew_logger:Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", - "2024-05-31 19:12:14,533 - motleycrew_logger - INFO - Processing task: AnswerTask(name=AnswerTask, done=False)\n", - "INFO:motleycrew_logger:Processing task: AnswerTask(name=AnswerTask, done=False)\n", - "2024-05-31 19:12:14,537 - motleycrew_logger - INFO - Available questions: []\n", - "INFO:motleycrew_logger:Available questions: []\n", - "2024-05-31 19:12:14,541 - motleycrew_logger - INFO - Got no matching units for task AnswerTask(name=AnswerTask, done=False)\n", - "INFO:motleycrew_logger:Got no matching units for task AnswerTask(name=AnswerTask, done=False)\n", - "2024-05-31 19:12:14,541 - motleycrew_logger - INFO - Nothing left to do, exiting\n", - "INFO:motleycrew_logger:Nothing left to do, exiting\n" + "2024-09-27 22:33:39,069 - motleycrew - INFO - Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", + "2024-09-27 22:33:39,073 - motleycrew - INFO - Processing task: QuestionTask(name=QuestionTask, done=False)\n", + "2024-09-27 22:33:39,084 - motleycrew - INFO - Loaded unanswered questions: [Question(id=0, question=Why did Arjuna kill Karna, his half-brother?, answer=None, context=None)]\n", + "2024-09-27 22:33:39,515 - motleycrew - INFO - Most pertinent question according to the tool: question='Why did Arjuna kill Karna, his half-brother?' answer=None context=None\n", + "2024-09-27 22:33:39,515 - motleycrew - INFO - Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", + "2024-09-27 22:33:39,516 - motleycrew - INFO - Processing unit: TaskUnit(status=pending)\n", + "2024-09-27 22:33:39,516 - motleycrew - INFO - Assigned unit TaskUnit(status=pending) to agent MotleyTool(name=Question Generator Tool), dispatching\n", + "2024-09-27 22:33:39,516 - motleycrew - INFO - Node TaskUnit(status=running) does not exist, creating\n", + "2024-09-27 22:33:39,517 - motleycrew - INFO - Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", + "2024-09-27 22:33:39,518 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:39,518 - motleycrew - INFO - No known Cypher type matching annotation , will use JSON string\n", + "2024-09-27 22:33:39,522 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:39,528 - motleycrew - INFO - Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", + "2024-09-27 22:33:39,530 - motleycrew - INFO - Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:0 to TaskNode:0\n", + "2024-09-27 22:33:39,534 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:39,534 - motleycrew - INFO - ==== Started iteration 1 of 3 ====\n", + "2024-09-27 22:33:41,163 - motleycrew - INFO - Inserting question: What role did Krishna play in Arjuna's decision to kill Karna?\n", + "2024-09-27 22:33:41,166 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:41,167 - motleycrew - INFO - Inserting new node with label Question: question=\"What role did Krishna play in Arjuna's decision to kill Karna?\" answer=None context=None\n", + "2024-09-27 22:33:41,174 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:41,178 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:41,182 - motleycrew - INFO - Relation table is_subquestion from Question to Question does not exist in the database, creating\n", + "2024-09-27 22:33:41,185 - motleycrew - INFO - Creating relation is_subquestion from Question:0 to Question:1\n", + "2024-09-27 22:33:41,191 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:41,191 - motleycrew - INFO - Inserting question: How did Karna's chariot getting stuck in the mud influence the outcome of his duel with Arjuna?\n", + "2024-09-27 22:33:41,192 - motleycrew - INFO - Inserting new node with label Question: question=\"How did Karna's chariot getting stuck in the mud influence the outcome of his duel with Arjuna?\" answer=None context=None\n", + "2024-09-27 22:33:41,193 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:41,195 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:41,198 - motleycrew - INFO - Creating relation is_subquestion from Question:0 to Question:2\n", + "2024-09-27 22:33:41,200 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:41,200 - motleycrew - INFO - Inserting question: What was the significance of Karna forgetting the mantra during his battle with Arjuna?\n", + "2024-09-27 22:33:41,201 - motleycrew - INFO - Inserting new node with label Question: question='What was the significance of Karna forgetting the mantra during his battle with Arjuna?' answer=None context=None\n", + "2024-09-27 22:33:41,201 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:41,204 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:41,207 - motleycrew - INFO - Creating relation is_subquestion from Question:0 to Question:3\n", + "2024-09-27 22:33:41,209 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:41,210 - motleycrew - INFO - Inserted 3 questions\n", + "2024-09-27 22:33:41,211 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:41,212 - motleycrew - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", + "2024-09-27 22:33:41,216 - motleycrew - INFO - Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", + "2024-09-27 22:33:41,219 - motleycrew - INFO - Processing task: QuestionTask(name=QuestionTask, done=False)\n", + "2024-09-27 22:33:41,221 - motleycrew - INFO - Loaded unanswered questions: [Question(id=1, question=What role did Krishna play in Arjuna's decision to kill Karna?, answer=None, context=None), Question(id=2, question=How did Karna's chariot getting stuck in the mud influence the outcome of his duel with Arjuna?, answer=None, context=None), Question(id=3, question=What was the significance of Karna forgetting the mantra during his battle with Arjuna?, answer=None, context=None)]\n", + "2024-09-27 22:33:41,697 - motleycrew - INFO - Most pertinent question according to the tool: question=\"What role did Krishna play in Arjuna's decision to kill Karna?\" answer=None context=None\n", + "2024-09-27 22:33:41,698 - motleycrew - INFO - Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", + "2024-09-27 22:33:41,698 - motleycrew - INFO - Processing unit: TaskUnit(status=pending)\n", + "2024-09-27 22:33:41,698 - motleycrew - INFO - Assigned unit TaskUnit(status=pending) to agent MotleyTool(name=Question Generator Tool), dispatching\n", + "2024-09-27 22:33:41,699 - motleycrew - INFO - Node TaskUnit(status=running) does not exist, creating\n", + "2024-09-27 22:33:41,700 - motleycrew - INFO - Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", + "2024-09-27 22:33:41,700 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:41,701 - motleycrew - INFO - No known Cypher type matching annotation , will use JSON string\n", + "2024-09-27 22:33:41,704 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:41,712 - motleycrew - INFO - Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", + "2024-09-27 22:33:41,715 - motleycrew - INFO - Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:1 to TaskNode:0\n", + "2024-09-27 22:33:41,718 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:41,719 - motleycrew - INFO - ==== Started iteration 2 of 3 ====\n", + "2024-09-27 22:33:43,771 - motleycrew - INFO - Inserting question: What did Krishna say to Arjuna about duty and action on the battlefield?\n", + "2024-09-27 22:33:43,773 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:43,776 - motleycrew - INFO - Inserting new node with label Question: question='What did Krishna say to Arjuna about duty and action on the battlefield?' answer=None context=None\n", + "2024-09-27 22:33:43,776 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:43,781 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:43,785 - motleycrew - INFO - Creating relation is_subquestion from Question:1 to Question:4\n", + "2024-09-27 22:33:43,790 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:43,790 - motleycrew - INFO - Inserting question: How did Krishna intervene during the duel between Karna and Arjuna?\n", + "2024-09-27 22:33:43,791 - motleycrew - INFO - Inserting new node with label Question: question='How did Krishna intervene during the duel between Karna and Arjuna?' answer=None context=None\n", + "2024-09-27 22:33:43,791 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:43,793 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:43,796 - motleycrew - INFO - Creating relation is_subquestion from Question:1 to Question:5\n", + "2024-09-27 22:33:43,799 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:43,799 - motleycrew - INFO - Inserting question: What was Krishna's response to Karna's plea for honor while he was trying to free his chariot wheel?\n", + "2024-09-27 22:33:43,800 - motleycrew - INFO - Inserting new node with label Question: question=\"What was Krishna's response to Karna's plea for honor while he was trying to free his chariot wheel?\" answer=None context=None\n", + "2024-09-27 22:33:43,800 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:43,803 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:43,805 - motleycrew - INFO - Creating relation is_subquestion from Question:1 to Question:6\n", + "2024-09-27 22:33:43,808 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:43,808 - motleycrew - INFO - Inserted 3 questions\n", + "2024-09-27 22:33:43,809 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:43,811 - motleycrew - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", + "2024-09-27 22:33:43,816 - motleycrew - INFO - Available tasks: [QuestionTask(name=QuestionTask, done=False)]\n", + "2024-09-27 22:33:43,817 - motleycrew - INFO - Processing task: QuestionTask(name=QuestionTask, done=False)\n", + "2024-09-27 22:33:43,820 - motleycrew - INFO - Loaded unanswered questions: [Question(id=2, question=How did Karna's chariot getting stuck in the mud influence the outcome of his duel with Arjuna?, answer=None, context=None), Question(id=3, question=What was the significance of Karna forgetting the mantra during his battle with Arjuna?, answer=None, context=None), Question(id=4, question=What did Krishna say to Arjuna about duty and action on the battlefield?, answer=None, context=None), Question(id=5, question=How did Krishna intervene during the duel between Karna and Arjuna?, answer=None, context=None), Question(id=6, question=What was Krishna's response to Karna's plea for honor while he was trying to free his chariot wheel?, answer=None, context=None)]\n", + "2024-09-27 22:33:44,307 - motleycrew - INFO - Most pertinent question according to the tool: question='How did Krishna intervene during the duel between Karna and Arjuna?' answer=None context=None\n", + "2024-09-27 22:33:44,308 - motleycrew - INFO - Got a matching unit for task QuestionTask(name=QuestionTask, done=False)\n", + "2024-09-27 22:33:44,309 - motleycrew - INFO - Processing unit: TaskUnit(status=pending)\n", + "2024-09-27 22:33:44,309 - motleycrew - INFO - Assigned unit TaskUnit(status=pending) to agent MotleyTool(name=Question Generator Tool), dispatching\n", + "2024-09-27 22:33:44,310 - motleycrew - INFO - Node TaskUnit(status=running) does not exist, creating\n", + "2024-09-27 22:33:44,311 - motleycrew - INFO - Inserting new node with label QuestionGenerationTaskUnit: TaskUnit(status=running)\n", + "2024-09-27 22:33:44,312 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:44,312 - motleycrew - INFO - No known Cypher type matching annotation , will use JSON string\n", + "2024-09-27 22:33:44,316 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:44,325 - motleycrew - INFO - Relation from TaskUnit(status=running) to name='QuestionTask' done=False does not exist, creating\n", + "2024-09-27 22:33:44,328 - motleycrew - INFO - Creating relation QuestionGenerationTaskUnit_belongs from QuestionGenerationTaskUnit:2 to TaskNode:0\n", + "2024-09-27 22:33:44,331 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:44,332 - motleycrew - INFO - ==== Started iteration 3 of 3 ====\n", + "2024-09-27 22:33:46,317 - motleycrew - INFO - Inserting question: How did Krishna intervene when Karna fired the serpent-arrow at Arjuna?\n", + "2024-09-27 22:33:46,320 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:46,322 - motleycrew - INFO - Inserting new node with label Question: question='How did Krishna intervene when Karna fired the serpent-arrow at Arjuna?' answer=None context=None\n", + "2024-09-27 22:33:46,323 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:46,327 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:46,330 - motleycrew - INFO - Creating relation is_subquestion from Question:5 to Question:7\n", + "2024-09-27 22:33:46,333 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:46,334 - motleycrew - INFO - Inserting question: What did Krishna say to Karna when Karna's chariot got stuck in the mud during his duel with Arjuna?\n", + "2024-09-27 22:33:46,335 - motleycrew - INFO - Inserting new node with label Question: question=\"What did Krishna say to Karna when Karna's chariot got stuck in the mud during his duel with Arjuna?\" answer=None context=None\n", + "2024-09-27 22:33:46,335 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:46,338 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:46,341 - motleycrew - INFO - Creating relation is_subquestion from Question:5 to Question:8\n", + "2024-09-27 22:33:46,344 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:46,344 - motleycrew - INFO - Inserting question: How did Krishna assist Arjuna when King Bhagadatta attacked with the Vishnu-astra?\n", + "2024-09-27 22:33:46,345 - motleycrew - INFO - Inserting new node with label Question: question='How did Krishna assist Arjuna when King Bhagadatta attacked with the Vishnu-astra?' answer=None context=None\n", + "2024-09-27 22:33:46,345 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[list[str]], will use JSON string\n", + "2024-09-27 22:33:46,347 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:46,349 - motleycrew - INFO - Creating relation is_subquestion from Question:5 to Question:9\n", + "2024-09-27 22:33:46,351 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:46,351 - motleycrew - INFO - Inserted 3 questions\n", + "2024-09-27 22:33:46,353 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:46,355 - motleycrew - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", + "2024-09-27 22:33:46,361 - motleycrew - INFO - Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", + "2024-09-27 22:33:46,363 - motleycrew - INFO - Processing task: AnswerTask(name=AnswerTask, done=False)\n", + "2024-09-27 22:33:46,369 - motleycrew - INFO - Available questions: [Question(id=5, question=How did Krishna intervene during the duel between Karna and Arjuna?, answer=None, context=[\"Krishna, however, intervened. ...])]\n", + "2024-09-27 22:33:46,373 - motleycrew - INFO - Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", + "2024-09-27 22:33:46,373 - motleycrew - INFO - Processing unit: TaskUnit(status=pending)\n", + "2024-09-27 22:33:46,373 - motleycrew - INFO - Assigned unit TaskUnit(status=pending) to agent MotleyTool(name=Answer Sub-Question Tool), dispatching\n", + "2024-09-27 22:33:46,373 - motleycrew - INFO - Node TaskUnit(status=running) does not exist, creating\n", + "2024-09-27 22:33:46,374 - motleycrew - INFO - Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", + "2024-09-27 22:33:46,374 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:46,374 - motleycrew - INFO - No known Cypher type matching annotation , will use JSON string\n", + "2024-09-27 22:33:46,376 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:46,380 - motleycrew - INFO - Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", + "2024-09-27 22:33:46,382 - motleycrew - INFO - Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:0 to TaskNode:1\n", + "2024-09-27 22:33:46,385 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:48,629 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:48,633 - motleycrew - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", + "2024-09-27 22:33:48,640 - motleycrew - INFO - Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", + "2024-09-27 22:33:48,643 - motleycrew - INFO - Processing task: AnswerTask(name=AnswerTask, done=False)\n", + "2024-09-27 22:33:48,647 - motleycrew - INFO - Available questions: [Question(id=1, question=What role did Krishna play in Arjuna's decision to kill Karna?, answer=None, context=[\"That way, when this war is ove...])]\n", + "2024-09-27 22:33:48,650 - motleycrew - INFO - Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", + "2024-09-27 22:33:48,651 - motleycrew - INFO - Processing unit: TaskUnit(status=pending)\n", + "2024-09-27 22:33:48,651 - motleycrew - INFO - Assigned unit TaskUnit(status=pending) to agent MotleyTool(name=Answer Sub-Question Tool), dispatching\n", + "2024-09-27 22:33:48,651 - motleycrew - INFO - Node TaskUnit(status=running) does not exist, creating\n", + "2024-09-27 22:33:48,653 - motleycrew - INFO - Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", + "2024-09-27 22:33:48,653 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:48,653 - motleycrew - INFO - No known Cypher type matching annotation , will use JSON string\n", + "2024-09-27 22:33:48,656 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:48,660 - motleycrew - INFO - Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", + "2024-09-27 22:33:48,663 - motleycrew - INFO - Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:1 to TaskNode:1\n", + "2024-09-27 22:33:48,665 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:51,405 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:51,408 - motleycrew - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", + "2024-09-27 22:33:51,415 - motleycrew - INFO - Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", + "2024-09-27 22:33:51,419 - motleycrew - INFO - Processing task: AnswerTask(name=AnswerTask, done=False)\n", + "2024-09-27 22:33:51,423 - motleycrew - INFO - Available questions: [Question(id=0, question=Why did Arjuna kill Karna, his half-brother?, answer=None, context=[\"That way, when this war is ove...])]\n", + "2024-09-27 22:33:51,426 - motleycrew - INFO - Got a matching unit for task AnswerTask(name=AnswerTask, done=False)\n", + "2024-09-27 22:33:51,426 - motleycrew - INFO - Processing unit: TaskUnit(status=pending)\n", + "2024-09-27 22:33:51,426 - motleycrew - INFO - Assigned unit TaskUnit(status=pending) to agent MotleyTool(name=Answer Sub-Question Tool), dispatching\n", + "2024-09-27 22:33:51,427 - motleycrew - INFO - Node TaskUnit(status=running) does not exist, creating\n", + "2024-09-27 22:33:51,427 - motleycrew - INFO - Inserting new node with label QuestionAnsweringTaskUnit: TaskUnit(status=running)\n", + "2024-09-27 22:33:51,428 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:51,428 - motleycrew - INFO - No known Cypher type matching annotation , will use JSON string\n", + "2024-09-27 22:33:51,430 - motleycrew - INFO - Node created OK\n", + "2024-09-27 22:33:51,435 - motleycrew - INFO - Relation from TaskUnit(status=running) to name='AnswerTask' done=False does not exist, creating\n", + "2024-09-27 22:33:51,438 - motleycrew - INFO - Creating relation QuestionAnsweringTaskUnit_belongs from QuestionAnsweringTaskUnit:2 to TaskNode:1\n", + "2024-09-27 22:33:51,441 - motleycrew - INFO - Relation created OK\n", + "2024-09-27 22:33:53,941 - motleycrew - INFO - No known Cypher type matching annotation typing.Optional[typing.Any], will use JSON string\n", + "2024-09-27 22:33:53,945 - motleycrew - INFO - Task unit TaskUnit(status=running) completed, marking as done\n", + "2024-09-27 22:33:53,953 - motleycrew - INFO - Available tasks: [AnswerTask(name=AnswerTask, done=False)]\n", + "2024-09-27 22:33:53,956 - motleycrew - INFO - Processing task: AnswerTask(name=AnswerTask, done=False)\n", + "2024-09-27 22:33:53,960 - motleycrew - INFO - Available questions: []\n", + "2024-09-27 22:33:53,963 - motleycrew - INFO - Got no matching units for task AnswerTask(name=AnswerTask, done=False)\n", + "2024-09-27 22:33:53,963 - motleycrew - INFO - Nothing left to do, exiting\n" ] } ], @@ -569,11 +390,9 @@ "output_type": "stream", "text": [ "Question: Why did Arjuna kill Karna, his half-brother?\n", - "Answer: Arjuna killed Karna during their duel in the Mahabharata under complex and tragic circumstances. During the intense battle, Karna's chariot wheel became stuck in the mud, and he requested a pause in fighting, appealing to the codes of honorable warfare. However, Krishna, serving as Arjuna's charioteer, reminded Karna of his past dishonorable actions, such as his involvement in the humiliation of Draupadi and the unfair killing of Abhimanyu. This dialogue underscored the prevailing themes of karma and dharma influencing the battle's outcome.\n", - "\n", - "Compounding Karna's misfortune, he was unable to invoke the Brahmastra, a powerful celestial weapon, because he had forgotten the necessary mantra due to a curse from his former teacher Parashurama, who had cursed him for deceiving about his true lineage. This critical moment of vulnerability was seized by Arjuna, who, under Krishna's guidance, struck Karna down while he was defenseless and attempting to free his chariot wheel. This act marked a pivotal and decisive moment in the Kurukshetra war, fulfilling the curses and prophecies that had haunted Karna's life.\n", + "Answer: Arjuna killed Karna, his half-brother, during their duel on the battlefield of Kurukshetra. The pivotal moment came when Karna's chariot got stuck in the mud, and he requested Arjuna and Krishna to honorably allow him to free his chariot. Krishna responded by reminding Karna of his past dishonorable actions, such as humiliating Draupadi and killing Abhimanyu, thereby justifying Arjuna's actions against Karna. Additionally, when Karna attempted to use the Brahmastra, he suddenly forgot the mantra, which can be seen as divine intervention. Krishna's words and the subsequent events reinforced Arjuna's resolve to kill Karna, aligning with his duty and dharma as a warrior.\n", "To explore the graph:\n", - "docker run -p 8000:8000 -v /var/folders/fv/tyhll76x0fn6l7j_q2nhvyg00000gn/T/tmp3dn3ez5x/kuzu_db:/database --rm kuzudb/explorer:latest\n", + "docker run -p 8000:8000 -v /var/folders/fv/tyhll76x0fn6l7j_q2nhvyg00000gn/T/tmp4obi9n3p/kuzu_db:/database --rm kuzudb/explorer:latest\n", "And in the kuzu explorer at http://localhost:8000 enter\n", "MATCH (A)-[r]->(B) RETURN *;\n" ] diff --git a/examples/research_agent/research_agent_main.py b/examples/research_agent/research_agent_main.py index e003701c..d349812f 100644 --- a/examples/research_agent/research_agent_main.py +++ b/examples/research_agent/research_agent_main.py @@ -1,20 +1,19 @@ -from pathlib import Path -import shutil import os import platform +import shutil +from pathlib import Path import kuzu from dotenv import load_dotenv from motleycrew import MotleyCrew -from motleycrew.storage import MotleyKuzuGraphStore -from motleycrew.common import configure_logging -from motleycrew.applications.research_agent.question_task import QuestionTask from motleycrew.applications.research_agent.answer_task import AnswerTask - +from motleycrew.applications.research_agent.question_task import QuestionTask +from motleycrew.common import LLMFramework, configure_logging +from motleycrew.common.llms import init_llm +from motleycrew.storage import MotleyKuzuGraphStore from motleycrew.tools.simple_retriever_tool import SimpleRetrieverTool - WORKING_DIR = Path(__file__).parent if "Dropbox" in WORKING_DIR.parts and platform.system() == "Windows": # On Windows, kuzu has file locking issues with Dropbox @@ -31,11 +30,16 @@ def main(): + llm = init_llm( + llm_framework=LLMFramework.LANGCHAIN + ) # throughout this project, we use LangChain's LLM wrappers + load_dotenv() configure_logging(verbose=True) shutil.rmtree(DB_PATH) + # You can pass any LlamaIndex embedding to the retriever tool, default is OpenAI's text-embedding-ada-002 query_tool = SimpleRetrieverTool(DATA_DIR, PERSIST_DIR, return_strings_only=True) db = kuzu.Database(DB_PATH) @@ -43,9 +47,13 @@ def main(): crew = MotleyCrew(graph_store=graph_store) question_task = QuestionTask( - crew=crew, question=QUESTION, query_tool=query_tool, max_iter=MAX_ITER + crew=crew, + question=QUESTION, + query_tool=query_tool, + max_iter=MAX_ITER, + llm=llm, ) - answer_task = AnswerTask(answer_length=ANSWER_LENGTH, crew=crew) + answer_task = AnswerTask(answer_length=ANSWER_LENGTH, crew=crew, llm=llm) question_task >> answer_task diff --git a/motleycrew/applications/research_agent/answer_task.py b/motleycrew/applications/research_agent/answer_task.py index aaf76413..72b2c167 100644 --- a/motleycrew/applications/research_agent/answer_task.py +++ b/motleycrew/applications/research_agent/answer_task.py @@ -1,6 +1,7 @@ from typing import List, Optional from langchain_core.runnables import Runnable +from langchain_core.language_models import BaseLanguageModel from motleycrew.applications.research_agent.question import Question from motleycrew.applications.research_agent.question_answerer import AnswerSubQuestionTool @@ -21,6 +22,7 @@ def __init__( self, crew: MotleyCrew, answer_length: int = 1000, + llm: Optional[BaseLanguageModel] = None, ): super().__init__( name="AnswerTask", @@ -30,7 +32,7 @@ def __init__( ) self.answer_length = answer_length self.answerer = AnswerSubQuestionTool( - graph=self.graph_store, answer_length=self.answer_length + graph=self.graph_store, answer_length=self.answer_length, llm=llm ) def get_next_unit(self) -> QuestionAnsweringTaskUnit | None: diff --git a/motleycrew/applications/research_agent/question_answerer.py b/motleycrew/applications/research_agent/question_answerer.py index 9301887b..766c7413 100644 --- a/motleycrew/applications/research_agent/question_answerer.py +++ b/motleycrew/applications/research_agent/question_answerer.py @@ -1,17 +1,16 @@ +from typing import Optional + from langchain.prompts import PromptTemplate +from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts.base import BasePromptTemplate from langchain_core.pydantic_v1 import BaseModel, Field -from langchain_core.runnables import ( - RunnablePassthrough, - RunnableLambda, - chain, -) +from langchain_core.runnables import RunnableLambda, RunnablePassthrough, chain from langchain_core.tools import Tool from motleycrew.applications.research_agent.question import Question from motleycrew.common.utils import print_passthrough from motleycrew.storage import MotleyGraphStore -from motleycrew.tools import MotleyTool, LLMTool +from motleycrew.tools import LLMTool, MotleyTool _default_prompt = PromptTemplate.from_template( """ @@ -37,11 +36,13 @@ def __init__( graph: MotleyGraphStore, answer_length: int, prompt: str | BasePromptTemplate = None, + llm: Optional[BaseLanguageModel] = None, ): langchain_tool = create_answer_question_langchain_tool( graph=graph, answer_length=answer_length, prompt=prompt, + llm=llm, ) super().__init__(langchain_tool) @@ -70,6 +71,7 @@ def create_answer_question_langchain_tool( graph: MotleyGraphStore, answer_length: int, prompt: str | BasePromptTemplate = None, + llm: Optional[BaseLanguageModel] = None, ) -> Tool: if prompt is None: prompt = _default_prompt @@ -78,6 +80,7 @@ def create_answer_question_langchain_tool( prompt=prompt.partial(answer_length=str(answer_length)), name="Question answerer", description="Tool to answer a question from notes and sub-questions", + llm=llm, ) """ Gets a valid question node ID, question, and context as input dict diff --git a/motleycrew/applications/research_agent/question_task.py b/motleycrew/applications/research_agent/question_task.py index 1ef85603..039703a3 100644 --- a/motleycrew/applications/research_agent/question_task.py +++ b/motleycrew/applications/research_agent/question_task.py @@ -1,5 +1,6 @@ from typing import List, Optional +from langchain_core.language_models import BaseLanguageModel from langchain_core.runnables import Runnable from motleycrew.common import logger @@ -26,6 +27,7 @@ def __init__( crew: MotleyCrew, max_iter: int = 10, allow_async_units: bool = False, + llm: Optional[BaseLanguageModel] = None, name: str = "QuestionTask", ): super().__init__( @@ -41,7 +43,7 @@ def __init__( self.graph_store.insert_node(self.question) self.question_prioritization_tool = QuestionPrioritizerTool() self.question_generation_tool = QuestionGeneratorTool( - query_tool=query_tool, graph=self.graph_store + query_tool=query_tool, graph=self.graph_store, llm=llm ) def get_next_unit(self) -> QuestionGenerationTaskUnit | None: diff --git a/motleycrew/tools/simple_retriever_tool.py b/motleycrew/tools/simple_retriever_tool.py index b8db5659..012a40a2 100644 --- a/motleycrew/tools/simple_retriever_tool.py +++ b/motleycrew/tools/simple_retriever_tool.py @@ -10,6 +10,7 @@ load_index_from_storage, ) from llama_index.core.node_parser import SentenceSplitter +from llama_index.core.embeddings import BaseEmbedding from llama_index.embeddings.openai import OpenAIEmbedding from motleycrew.applications.research_agent.question import Question @@ -26,6 +27,7 @@ def __init__( return_strings_only: bool = False, return_direct: bool = False, exceptions_to_reflect: Optional[List[Exception]] = None, + embeddings: Optional[BaseEmbedding] = None, ): """ Args: @@ -34,7 +36,7 @@ def __init__( return_strings_only: Whether to return only the text of the retrieved documents. """ tool = make_retriever_langchain_tool( - data_dir, persist_dir, return_strings_only=return_strings_only + data_dir, persist_dir, return_strings_only=return_strings_only, embeddings=embeddings ) super().__init__( tool=tool, return_direct=return_direct, exceptions_to_reflect=exceptions_to_reflect @@ -49,9 +51,15 @@ class RetrieverToolInput(BaseModel, arbitrary_types_allowed=True): ) -def make_retriever_langchain_tool(data_dir, persist_dir, return_strings_only: bool = False): - text_embedding_model = "text-embedding-ada-002" - embeddings = OpenAIEmbedding(model=text_embedding_model) +def make_retriever_langchain_tool( + data_dir, + persist_dir, + return_strings_only: bool = False, + embeddings: Optional[BaseEmbedding] = None, +): + if embeddings is None: + text_embedding_model = "text-embedding-ada-002" + embeddings = OpenAIEmbedding(model=text_embedding_model) if not os.path.exists(persist_dir): # load the documents and create the index