Skip to content

Commit

Permalink
exp1-3 with new prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
qcampbel committed Aug 7, 2024
1 parent 8dc7d4e commit 84547c6
Show file tree
Hide file tree
Showing 16 changed files with 5,860 additions and 6 deletions.
486 changes: 486 additions & 0 deletions notebooks/experiments/exps_new_prompt/gpt-3.5-turbo-0125/exp_1.ipynb

Large diffs are not rendered by default.

234 changes: 234 additions & 0 deletions notebooks/experiments/exps_new_prompt/gpt-3.5-turbo-0125/exp_2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import datetime\n",
"import os\n",
"from mdagent import MDAgent"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"date and time: 2024-08-06\n",
"time: 21:02:32\n",
"LLM: gpt-3.5-turbo-0125 \n",
"Temperature: 0.1\n"
]
}
],
"source": [
"prompt2 = \"Download the pdb file for PDB ID 1LYZ.\"\n",
"llm_var = \"gpt-3.5-turbo-0125\"\n",
"tools = \"all\"\n",
"agent = MDAgent(agent_type=\"Structured\", model=llm_var, top_k_tools=tools)\n",
"now = datetime.datetime.now()\n",
"date = now.strftime(\"%Y-%m-%d\")\n",
"print(\"date and time:\",date)\n",
"time = now.strftime(\"%H:%M:%S\")\n",
"print(\"time:\",time)\n",
"print(\"LLM: \",agent.llm.model_name,\"\\nTemperature: \",agent.llm.temperature)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
"Thought: The task requires downloading the PDB file for the specified PDB ID 1LYZ. The appropriate tool for this is the PDBFileDownloader tool.\n",
"\n",
"Action:\n",
"```\n",
"{\n",
" \"action\": \"PDBFileDownloader\",\n",
" \"action_input\": \"1LYZ\"\n",
"}\n",
"```\u001b[32;1m\u001b[1;3mThought: The task requires downloading the PDB file for the specified PDB ID 1LYZ. The appropriate tool for this is the PDBFileDownloader tool.\n",
"\n",
"Action:\n",
"```\n",
"{\n",
" \"action\": \"PDBFileDownloader\",\n",
" \"action_input\": \"1LYZ\"\n",
"}\n",
"```\u001b[0m"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-08-06 21:02:36.499 \n",
" \u001b[33m\u001b[1mWarning:\u001b[0m to view this Streamlit app on a browser, run it with the following\n",
" command:\n",
"\n",
" streamlit run /opt/anaconda3/envs/llama-mdagent/lib/python3.11/site-packages/ipykernel_launcher.py [ARGUMENTS]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"PDB file found with this ID: 1LYZ\n",
"\n",
"Observation: \u001b[38;5;200m\u001b[1;3mSucceeded. Downloaded the PDB file:1LYZ_210236\u001b[0m\n",
"Thought:Final Answer: The PDB file for PDB ID 1LYZ has been successfully downloaded and is available as file ID 1LYZ_210236.\u001b[32;1m\u001b[1;3mFinal Answer: The PDB file for PDB ID 1LYZ has been successfully downloaded and is available as file ID 1LYZ_210236.\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n",
"The agent was tasked with downloading the pdb file for PDB ID 1LYZ. The agent followed the prompt and provided a final answer stating that the PDB file for PDB ID 1LYZ has been successfully downloaded and is available as file ID 1LYZ_210236. The agent did not provide any intermediate steps or thought process, but directly provided the final solution to the problem.Your run id is: 4Z9KRL3L\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, should be the name of a tool),\\n action_input: (the input string to the action)\\n }\\n \\'\\'\\'\\n\\n OR\\n\\n Final Answer: (the final response to the original input\\n question, when 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 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 for PDB ID 1LYZ. ',\n",
" 'output': 'Final Answer: The PDB file for PDB ID 1LYZ has been successfully downloaded and is available as file ID 1LYZ_210236.'},\n",
" '4Z9KRL3L')"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agent.run(prompt2)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"date and time: 2024-08-06\n",
"time: 21:02:40\n"
]
}
],
"source": [
"now = datetime.datetime.now()\n",
"date = now.strftime(\"%Y-%m-%d\")\n",
"print(\"date and time:\",date)\n",
"time = now.strftime(\"%H:%M:%S\")\n",
"print(\"time:\",time)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"registry = agent.path_registry"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Files found in registry: 1LYZ_210236: PDB file downloaded from RSCB, PDBFile ID: 1LYZ_210236\n"
]
}
],
"source": [
"print(registry.list_path_names_and_descriptions())"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b8ae37dca48249308bda9ed92899aa92",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"NGLWidget()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#show the image from the path of the registry and the ID \n",
"import nglview as nv\n",
"path = registry.get_mapped_path(\"1LYZ_210236\")\n",
"view = nv.show_file(path)\n",
"view"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"assert os.path.exists(path), \"This file path doesn't exist\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Experiment Result: \n",
"### Completed without Exception or TimeOut Errors ✅\n",
"### Attempted all necessary steps ✅\n",
"### Completed without Hallucination ✅\n",
"### Logic make sense ✅\n",
"### Correct Answer ✅ \n"
]
}
],
"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.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 84547c6

Please sign in to comment.