Skip to content

Commit

Permalink
merge main into test_rmsd
Browse files Browse the repository at this point in the history
  • Loading branch information
qcampbel committed Mar 6, 2024
2 parents 853846e + 8645e70 commit 5d8990e
Show file tree
Hide file tree
Showing 50 changed files with 5,964 additions and 2,467 deletions.
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
# OpenAI API Key
OPENAI_API_KEY=YOUR_OPENAI_API_KEY_GOES_HERE # pragma: allowlist secret

# PQA API Key
PQA_API_KEY=YOUR_PQA_API_KEY_GOES_HERE # pragma: allowlist secret

# Serp API key
SERP_API_KEY=YOUR_SERP_API_KEY_GOES_HERE # pragma: allowlist secret
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python "3.9"
- name: Set up Python "3.11"
uses: actions/setup-python@v2
with:
python-version: "3.9"
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
environment-file: environment.yaml
python-version: ${{ matrix.python-version }}
auto-activate-base: true
- name: Install openmm pdbfixer mdanalysis with conda
- name: Install pdbfixer with conda
shell: bash -l {0}
run: |
conda install -c conda-forge openmm pdbfixer mdanalysis
conda install -c conda-forge pdbfixer
- name: Install dependencies
shell: bash -l {0}
run: |
Expand All @@ -45,6 +45,5 @@ jobs:
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SEMANTIC_SCHOLAR_API_KEY: ${{ secrets.SEMANTIC_SCHOLAR_API_KEY }}
PQA_API_KEY : ${{ secrets.PQA_API_TOKEN }}
run: |
pytest -m "not skip" tests
3 changes: 0 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
# Rule for detecting OpenAI API keys
OpenAI API Key: \b[secrets]{3}_[a-zA-Z0-9]{32}\b

# Rule for detecting pqa API keys
PQA API Key: "pqa[a-zA-Z0-9-._]+"

# Rule for detecting serp API keys
# Serp API Key: "[a-zA-Z0-9]{64}"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ To use the OpenMM features in the agent, please set up a conda environment, foll
- Create conda environment: `conda env create -n mdagent -f environment.yaml`
- Activate your environment: `conda activate mdagent`

If you already have a conda environment, you can install the necessary dependencies with the following steps.
- Install the necessary conda dependencies: `conda install -c conda-forge openmm pdbfixer mdanalysis`
If you already have a conda environment, you can install, pdbfixer, a necessary dependency with the following steps.
- Install the necessary conda dependencies: `conda install -c conda-forge pdbfixer`


## Installation
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pre-commit
pytest
pytest-mock
11 changes: 10 additions & 1 deletion mdagent/mainagent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ def __init__(
subagents_model="gpt-4-1106-preview",
ckpt_dir="ckpt",
resume=False,
learn=True,
top_k_tools=20, # set "all" if you want to use all tools (& skills if resume)
use_human_tool=False,
curriculum=True,
uploaded_files=[], # user input files to add to path registry
):
if path_registry is None:
Expand All @@ -69,7 +71,11 @@ def __init__(
callbacks=[StreamingStdOutCallbackHandler()],
)

# assign prompt
if learn:
self.skip_subagents = False
else:
self.skip_subagents = True

if agent_type == "Structured":
self.prompt = structured_prompt
elif agent_type == "OpenAIFunctionsAgent":
Expand All @@ -83,6 +89,7 @@ def __init__(
verbose=verbose,
ckpt_dir=ckpt_dir,
resume=resume,
curriculum=curriculum,
)

def _initialize_tools_and_agent(self, user_input=None):
Expand All @@ -97,13 +104,15 @@ def _initialize_tools_and_agent(self, user_input=None):
llm=self.tools_llm,
subagent_settings=self.subagents_settings,
human=self.use_human_tool,
skip_subagents=self.skip_subagents,
)
else:
# retrieve all tools, including new tools if any
self.tools = make_all_tools(
self.tools_llm,
subagent_settings=self.subagents_settings,
human=self.use_human_tool,
skip_subagents=self.skip_subagents,
)
return AgentExecutor.from_agent_and_tools(
tools=self.tools,
Expand Down
5 changes: 5 additions & 0 deletions mdagent/subagents/subagent_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def __init__(
ckpt_dir="ckpt",
resume=False,
retrieval_top_k=5,
curriculum=True,
):
self.path_registry = path_registry
self.subagents_model = subagents_model
Expand All @@ -24,6 +25,7 @@ def __init__(
self.ckpt_dir = ckpt_dir
self.resume = resume
self.retrieval_top_k = retrieval_top_k
self.curriculum = curriculum


class SubAgentInitializer:
Expand All @@ -40,6 +42,7 @@ def __init__(self, settings: Optional[SubAgentSettings] = None):
self.ckpt_dir = settings.ckpt_dir
self.resume = settings.resume
self.retrieval_top_k = settings.retrieval_top_k
self.curriculum = settings.curriculum

def create_action(self, **overrides):
params = {
Expand All @@ -61,6 +64,8 @@ def create_critic(self, **overrides):
return Critic(**params)

def create_curriculum(self, **overrides):
if not self.curriculum:
return None
params = {
"model": self.subagents_model,
"temp": self.temp,
Expand Down
25 changes: 11 additions & 14 deletions mdagent/tools/base_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
from .analysis_tools.plot_tools import SimulationOutputFigures
from .analysis_tools.ppi_tools import PPIDistance
from .analysis_tools.rmsd_tools import RMSDCalculator
from .analysis_tools.vis_tools import (
CheckDirectoryFiles,
VisFunctions,
VisualizeProtein,
from .analysis_tools.rgy import (
RadiusofGyrationAverage,
RadiusofGyrationPerFrame,
RadiusofGyrationPlot,
)
from .analysis_tools.rmsd_tools import RMSDCalculator
from .analysis_tools.vis_tools import VisFunctions, VisualizeProtein
from .preprocess_tools.clean_tools import (
AddHydrogensCleaningTool,
CleaningToolFunction,
CleaningTools,
RemoveWaterCleaningTool,
SpecializedCleanTool,
)
from .preprocess_tools.pdb_tools import (
PackMolTool,
ProteinName2PDBTool,
SmallMolPDB,
get_pdb,
)
from .preprocess_tools.packing import PackMolTool
from .preprocess_tools.pdb_get import ProteinName2PDBTool, SmallMolPDB, get_pdb
from .simulation_tools.create_simulation import ModifyBaseSimulationScriptTool
from .simulation_tools.setup_and_run import (
InstructionSummary,
SetUpandRunFunction,
SetUpAndRunTool,
SimulationFunctions,
Expand All @@ -32,9 +28,7 @@

__all__ = [
"AddHydrogensCleaningTool",
"CheckDirectoryFiles",
"CleaningTools",
"InstructionSummary",
"ListRegistryPaths",
"MapPath2Name",
"ProteinName2PDBTool",
Expand All @@ -44,6 +38,9 @@
"VisualizeProtein",
"RMSDCalculator",
"RemoveWaterCleaningTool",
"RadiusofGyrationAverage",
"RadiusofGyrationPerFrame",
"RadiusofGyrationPlot",
"Scholar2ResultLLM",
"SerpGitTool",
"SetUpAndRunTool",
Expand Down
7 changes: 5 additions & 2 deletions mdagent/tools/base_tools/analysis_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from .plot_tools import SimulationOutputFigures
from .ppi_tools import PPIDistance
from .rgy import RadiusofGyrationAverage, RadiusofGyrationPerFrame, RadiusofGyrationPlot
from .rmsd_tools import RMSDCalculator
from .vis_tools import CheckDirectoryFiles, VisFunctions, VisualizeProtein
from .vis_tools import VisFunctions, VisualizeProtein

__all__ = [
"PPIDistance",
"RMSDCalculator",
"RadiusofGyrationPerFrame",
"RadiusofGyrationPlot",
"SimulationOutputFigures",
"CheckDirectoryFiles",
"VisualizeProtein",
"VisFunctions",
"RadiusofGyrationAverage",
]
Loading

0 comments on commit 5d8990e

Please sign in to comment.