Skip to content

Commit

Permalink
claude-20240620-with-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SamCox822 committed Jan 23, 2025
1 parent 66892ca commit 300e178
Show file tree
Hide file tree
Showing 20 changed files with 10,671 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from mdagent import MDAgent\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"('Complete all of the following tasks: 1. Download the PDB file 1LYZ.',\n",
" 'Download the PDB file 1LYZ.')"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import sys\n",
"import os\n",
"parent_dir = os.path.abspath(os.path.join(os.getcwd(), '..'))\n",
"sys.path.append(parent_dir)\n",
"from robustness_prompts import get_prompt\n",
"\n",
"prompt_1_descriptive = get_prompt(\"descriptive\", 1)\n",
"prompt_1_natural = get_prompt(\"natural\", 1)\n",
"\n",
"prompt_1_descriptive, prompt_1_natural"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Required Tasks:\n",
"- Download"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"llm_model = \"claude-3-5-sonnet-20240620\"\n",
"tools = \"all\""
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Certainly! I'll start by downloading the PDB file 1LYZ using the PDBFileDownloader tool.\n",
"\n",
"Thought: To download the PDB file 1LYZ, I need to use the PDBFileDownloader tool. This tool can fetch PDB files using a protein's PDB ID.\n",
"\n",
"Action:\n",
"```\n",
"{\n",
" \"action\": \"PDBFileDownloader\",\n",
" \"action_input\": \"1LYZ\"\n",
"}\n",
"```PDB file found with this ID: 1LYZ\n",
"Thought: Great! We have successfully downloaded the PDB file for 1LYZ. The file is now available in our system with the identifier \"1LYZ_172223\". Since we have completed the task of downloading the PDB file 1LYZ, we can provide the final answer.\n",
"\n",
"Action:\n",
"```\n",
"{\n",
" \"action\": \"Final Answer\",\n",
" \"action_input\": \"Task completed successfully. The PDB file for 1LYZ has been downloaded and is now available in the system with the identifier '1LYZ_172223'. This file contains the structural information for lysozyme, which is the protein corresponding to the PDB ID 1LYZ.\"\n",
"}\n",
"```"
]
},
{
"data": {
"text/plain": [
"({'input': '\\n You are an expert molecular dynamics scientist, and\\n your task is to respond to the question or\\n solve the problem to the best of your ability using\\n the provided tools.\\n\\n You can only respond with a single complete\\n \\'Thought, Action, Action Input\\' format\\n OR a single \\'Final Answer\\' format.\\n\\n Complete format:\\n Thought: (reflect on your progress and decide what to do next)\\n Action:\\n ```\\n {\\n \"action\": (the action name, it should be the name of a tool),\\n \"action_input\": (the input string for the action)\\n }\\n \\'\\'\\'\\n\\n OR\\n\\n Final Answer: (the final response to the original input\\n question, once all steps are complete)\\n\\n You are required to use the tools provided,\\n using the most specific tool\\n available for each action.\\n Your final answer should contain all information\\n necessary to answer the question and its subquestions.\\n Before you finish, reflect on your progress and make\\n sure you have addressed the question in its entirety.\\n\\n If you are asked to continue\\n or reference previous runs,\\n the context will be provided to you.\\n If context is provided, you should assume\\n you are continuing a chat.\\n\\n Here is the input:\\n Previous Context: None\\n Question: Complete all of the following tasks: 1. Download the PDB file 1LYZ. ',\n",
" 'output': \"Task completed successfully. The PDB file for 1LYZ has been downloaded and is now available in the system with the identifier '1LYZ_172223'. This file contains the structural information for lysozyme, which is the protein corresponding to the PDB ID 1LYZ.\"},\n",
" 'IGZJ059B')"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agent_1 = MDAgent(agent_type=\"Structured\", model=llm_model, top_k_tools=tools)\n",
"agent_1.run(prompt_1_descriptive)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Files found in registry: 1LYZ_172223: PDB file downloaded from RSCB, PDBFile ID: 1LYZ_172223\n"
]
}
],
"source": [
"registry_1 = agent_1.path_registry\n",
"print(registry_1.list_path_names_and_descriptions())"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"assert os.path.exists(registry_1.get_mapped_path(\"1LYZ_172223\"))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Certainly! I'll download the PDB file for 1LYZ using the PDBFileDownloader tool.\n",
"\n",
"Thought: To download the PDB file for 1LYZ, I need to use the PDBFileDownloader tool. This tool can download PDB (Protein Data Bank) files using a protein's PDB ID.\n",
"\n",
"Action:\n",
"```\n",
"{\n",
" \"action\": \"PDBFileDownloader\",\n",
" \"action_input\": \"1LYZ\"\n",
"}\n",
"```PDB file found with this ID: 1LYZ\n",
"Thought: The PDB file for 1LYZ has been successfully downloaded using the PDBFileDownloader tool. The file is now available in the system with the identifier \"1LYZ_172237\". I can now provide a final answer to the user.\n",
"\n",
"Action:\n",
"```\n",
"{\n",
" \"action\": \"Final Answer\",\n",
" \"action_input\": \"The PDB file for 1LYZ has been successfully downloaded. The file is now available in the system with the identifier '1LYZ_172237'. This file contains the structural information for the protein with the PDB ID 1LYZ, which corresponds to lysozyme. You can now use this file for further analysis or visualization if needed.\"\n",
"}\n",
"```"
]
},
{
"data": {
"text/plain": [
"({'input': '\\n You are an expert molecular dynamics scientist, and\\n your task is to respond to the question or\\n solve the problem to the best of your ability using\\n the provided tools.\\n\\n You can only respond with a single complete\\n \\'Thought, Action, Action Input\\' format\\n OR a single \\'Final Answer\\' format.\\n\\n Complete format:\\n Thought: (reflect on your progress and decide what to do next)\\n Action:\\n ```\\n {\\n \"action\": (the action name, it should be the name of a tool),\\n \"action_input\": (the input string for the action)\\n }\\n \\'\\'\\'\\n\\n OR\\n\\n Final Answer: (the final response to the original input\\n question, once all steps are complete)\\n\\n You are required to use the tools provided,\\n using the most specific tool\\n available for each action.\\n Your final answer should contain all information\\n necessary to answer the question and its subquestions.\\n Before you finish, reflect on your progress and make\\n sure you have addressed the question in its entirety.\\n\\n If you are asked to continue\\n or reference previous runs,\\n the context will be provided to you.\\n If context is provided, you should assume\\n you are continuing a chat.\\n\\n Here is the input:\\n Previous Context: None\\n Question: Download the PDB file 1LYZ. ',\n",
" 'output': \"The PDB file for 1LYZ has been successfully downloaded. The file is now available in the system with the identifier '1LYZ_172237'. This file contains the structural information for the protein with the PDB ID 1LYZ, which corresponds to lysozyme. You can now use this file for further analysis or visualization if needed.\"},\n",
" '1Z5NL7HA')"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agent_2 = MDAgent(agent_type=\"Structured\", model=llm_model, top_k_tools=tools)\n",
"agent_2.run(prompt_1_natural)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Files found in registry: 1LYZ_172223: PDB file downloaded from RSCB, PDBFile ID: 1LYZ_172223\n"
]
}
],
"source": [
"registry_2 = agent_1.path_registry\n",
"print(registry_2.list_path_names_and_descriptions())"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"assert os.path.exists(registry_2.get_mapped_path(\"1LYZ_172223\"))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "mdagent2",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 300e178

Please sign in to comment.