Skip to content

Commit

Permalink
renaming MDCrow
Browse files Browse the repository at this point in the history
  • Loading branch information
SamCox822 committed Feb 13, 2025
1 parent 9375bf4 commit b5bdbb7
Show file tree
Hide file tree
Showing 73 changed files with 150 additions and 153 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ To get started with contributing to md-agent, follow these steps:
```
git clone https://github.com/ur-whitelab/md-agent.git
cd md-agent
conda env create -n mdagent -f environment.yaml
conda activate mdagent
conda env create -n mdcrow -f environment.yaml
conda activate mdcrow
```

### Installing the Package and Dependencies and Configuring Pre-commit Hooks
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
MDAgent is a LLM-agent based toolset for Molecular Dynamics.
MDCrow is a LLM-agent based toolset for Molecular Dynamics.
It's built using Langchain and uses a collection of tools to set up and execute molecular dynamics simulations, particularly in OpenMM.


## Environment Setup
To use the OpenMM features in the agent, please set up a conda environment, following these steps.
```
conda env create -n mdagent -f environment.yaml
conda activate mdagent
conda env create -n mdcrow -f environment.yaml
conda activate mdcrow
```

If you already have a conda environment, you can install dependencies before you activate it with the following step.
Expand All @@ -25,14 +25,14 @@ Other tools require API keys, such as paper-qa for literature searches. We recom
1. Copy the `.env.example` file and rename it to `.env`: `cp .env.example .env`
2. Replace the placeholder values in `.env` with your actual keys

You can ask MDAgent to conduct molecular dynamics tasks using OpenAI's GPT model
You can ask MDCrow to conduct molecular dynamics tasks using OpenAI's GPT model
```
from mdagent import MDAgent
from mdcrow import MDCrow
agent = MDAgent(model="gpt-3.5-turbo")
agent = MDCrow(model="gpt-3.5-turbo")
agent.run("Simulate protein 1ZNI at 300 K for 0.1 ps and calculate the RMSD over time.")
```
Note: to distinguish Together models from the rest, you'll need to add "together\" prefix in model flag, such as `agent = MDAgent(model="together/meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo")`
Note: to distinguish Together models from the rest, you'll need to add "together\" prefix in model flag, such as `agent = MDCrow(model="together/meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo")`

## LLM Providers
By default, we support LLMs through OpenAI API. However, feel free to use other LLM providers. Make sure to install the necessary package for it. Here's list of packages required for alternative LLM providers we support:
Expand All @@ -43,6 +43,6 @@ By default, we support LLMs through OpenAI API. However, feel free to use other

## Contributing

We welcome contributions to MDAgent! If you're interested in contributing to the project, please check out our [Contributor's Guide](CONTRIBUTING.md) for detailed instructions on getting started, feature development, and the pull request process.
We welcome contributions to MDCrow! If you're interested in contributing to the project, please check out our [Contributor's Guide](CONTRIBUTING.md) for detailed instructions on getting started, feature development, and the pull request process.

We value and appreciate all contributions to MDAgent.
We value and appreciate all contributions to MDCrow.
3 changes: 0 additions & 3 deletions mdagent/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions mdagent/agent/__init__.py

This file was deleted.

3 changes: 3 additions & 0 deletions mdcrow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .agent import Evaluator, MDCrow

__all__ = ["MDCrow", "Evaluator"]
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# README for Evaluate.py

## Overview
`evaluate.py` is a Python script designed to facilitate the evaluation of MDAgent. It supports multiple use cases, including automated evaluation across different agent settings, loading previous evaluation results, and creating structured output tables. A list of generated or loaded evaluations can be accessed via `evaluator.evaluations`. Use `evaluator.reset()` to clear the evaluations list.
`evaluate.py` is a Python script designed to facilitate the evaluation of MDCrow. It supports multiple use cases, including automated evaluation across different agent settings, loading previous evaluation results, and creating structured output tables. A list of generated or loaded evaluations can be accessed via `evaluator.evaluations`. Use `evaluator.reset()` to clear the evaluations list.

## Getting Started
To use `evaluate.py`, ensure that `mdagent` package is installed in your Python environment (see main README for installation instructions).
To use `evaluate.py`, ensure that `mdcrow` package is installed in your Python environment (see main README for installation instructions).

## Usage Examples

### Example 1: Evaluate Prompts with default MD-Agent Parameters
Evaluate specific prompts with default settings:
```python
from mdagent import Evaluator
from mdcrow import Evaluator

evaluator = Evaluator()
prompts = [
Expand All @@ -21,13 +21,13 @@ prompts = [
df = evaluator.automate(prompts)
df # this displays DataFrame table in Jupyter notebook
```
This will run MDAgent and evaluate the prompts using the default settings. The results will be
This will run MDCrow and evaluate the prompts using the default settings. The results will be
saved to json file in the "evaluation_results" directory and used to create pandas DataFrame.

### Example 2: Evaluate Prompts with specific MD-Agent Parameters
Evaluate specific prompts using single agent instance with specified parameters:
```python
from mdagent import Evaluator
from mdcrow import Evaluator

evaluator = Evaluator()
agent_params = {
Expand All @@ -46,7 +46,7 @@ df_full = evaluator.create_table(simple=False) # to get a table with all details
### Example 3: Evaluate Prompts with Multiple Agent Parameters
Evaluate specific prompts using multiple agent settings with `automate_all` method:
```python
from mdagent import Evaluator
from mdcrow import Evaluator

evaluator = Evaluator()
prompts = [
Expand All @@ -71,7 +71,7 @@ df = evaluator.automate_all(prompts, agent_params_list=agent_params_list)
### Example 4: Load Previous Evaluation Results and Create a Table
Load previous evaluation results from a JSON file:
```python
from mdagent import Evaluator
from mdcrow import Evaluator

evaluator = Evaluator()
evaluator.load('evaluation_results/mega_eval_20240422-181241.json')
Expand All @@ -83,7 +83,7 @@ You can load multiple evaluation files by calling `evaluator.load()` multiple ti
### Example 5: Make Multi-Prompt Query with Agent Memory
Use agent memory to link multiple prompts:
```python
from mdagent import Evaluator
from mdcrow import Evaluator

evaluator = Evaluator()
agent_params1 = {
Expand Down
4 changes: 4 additions & 0 deletions mdcrow/agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .agent import MDCrow
from .evaluate import Evaluator

__all__ = ["MDCrow", "Evaluator"]
2 changes: 1 addition & 1 deletion mdagent/agent/agent.py → mdcrow/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_agent(cls, model_name: str = "OpenAIFunctionsAgent"):
)


class MDAgent:
class MDCrow:
def __init__(
self,
tools=None,
Expand Down
24 changes: 12 additions & 12 deletions mdagent/agent/evaluate.py → mdcrow/agent/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pandas as pd

from .agent import MDAgent
from .agent import MDCrow


# TODO: turn off verbose for MD-Agent -- verbose option doesn't work
Expand All @@ -27,18 +27,18 @@ def __init__(self, eval_dir="evaluation_results"):

def create_agent(self, agent_params={}):
"""
initializes MDAgent with given parameters
initializes MDCrow with given parameters
Parameters:
- agent_params (dict): dictionary of parameters to initialize MDAgent
- agent_params (dict): dictionary of parameters to initialize MDCrow
Returns:
- initialized MDAgent object
- initialized MDCrow object
"""
# initialize MDAgent with given parameters.
# initialize MDCrow with given parameters.
if agent_params is None: # this shouldn't happen though
agent_params = {}
return MDAgent(**agent_params)
return MDCrow(**agent_params)

def reset(self):
"""
Expand Down Expand Up @@ -121,7 +121,7 @@ def _flatten_dict(self, d, sep="_"):
def _evaluate_all_steps(self, agent, user_prompt):
"""
core function that evaluates while iterating every step of
MDAgent's response to a user prompt. Evaluation details are
MDCrow's response to a user prompt. Evaluation details are
saved to json file.
Used in run_and_evaluate method.
Expand All @@ -130,7 +130,7 @@ def _evaluate_all_steps(self, agent, user_prompt):
which can be used to create a table.
Parameters:
- agent (MDAgent): MDAgent object
- agent (MDCrow): MDCrow object
- user_prompt (str): user prompt to evaluate
Returns:
Expand Down Expand Up @@ -222,7 +222,7 @@ def run_and_evaluate(self, prompts, agent_params={}):
Parameters:
- prompts (list): list of prompts to evaluate
- agent_params (dict): dictionary of parameters to initialize MDAgent
- agent_params (dict): dictionary of parameters to initialize MDCrow
Returns:
- None
Expand All @@ -248,7 +248,7 @@ def run_and_evaluate(self, prompts, agent_params={}):
"error_msg": f"{type(e).__name__}: {e}",
}
)
print(f"Error occurred while running MDAgent. {type(e).__name__}: {e}")
print(f"Error occurred while running MDCrow. {type(e).__name__}: {e}")

def create_table(self, simple=True):
"""
Expand Down Expand Up @@ -291,7 +291,7 @@ def automate(self, prompts, agent_params={}):
Parameters:
- prompts (list): list of prompts to evaluate
- agent_params (dict): dictionary of parameters to initialize MDAgent
- agent_params (dict): dictionary of parameters to initialize MDCrow
Returns:
- DataFrame table of evaluations
Expand All @@ -310,7 +310,7 @@ def automate_all(self, prompts, agent_params_list=None):
Parameters:
- prompts (list): list of prompts to evaluate
- agent_params_list (list): list of dictionaries containing parameters
to initialize MDAgent. If None, it will evaluate with default agents.
to initialize MDCrow. If None, it will evaluate with default agents.
Returns:
- DataFrame table of evaluations
Expand Down
2 changes: 1 addition & 1 deletion mdagent/agent/memory.py → mdcrow/agent/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from langchain.prompts import PromptTemplate
from langchain_core.output_parsers import StrOutputParser

from mdagent.utils import PathRegistry
from mdcrow.utils import PathRegistry

agent_summary_template = PromptTemplate(
input_variables=["agent_trace"],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from matplotlib.animation import FuncAnimation
from pydantic import BaseModel, Field

from mdagent.utils import FileType, PathRegistry, load_single_traj
from mdcrow.utils import FileType, PathRegistry, load_single_traj


class DistanceToolsUtils:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import mdtraj as md
from langchain.tools import BaseTool

from mdagent.utils import FileType, PathRegistry, load_single_traj
from mdcrow.utils import FileType, PathRegistry, load_single_traj


class HydrogenBondTool(BaseTool):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from langchain.tools import BaseTool

from mdagent.utils import FileType, PathRegistry, load_single_traj, save_to_csv
from mdcrow.utils import FileType, PathRegistry, load_single_traj, save_to_csv


class MOIFunctions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pydantic import BaseModel, Field
from sklearn.decomposition import PCA

from mdagent.utils import FileType, PathRegistry, load_single_traj
from mdcrow.utils import FileType, PathRegistry, load_single_traj


class PCA_analysis:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import matplotlib.pyplot as plt
from langchain.tools import BaseTool

from mdagent.utils import FileType, PathRegistry
from mdcrow.utils import FileType, PathRegistry


class PlottingTools:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from langchain.tools import BaseTool
from pydantic import BaseModel, Field

from mdagent.utils import PathRegistry
from mdcrow.utils import PathRegistry


def ppi_distance(file_path, binding_site="protein"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from langchain.tools import BaseTool
from pydantic import BaseModel, Field

from mdagent.utils import FileType, PathRegistry
from mdcrow.utils import FileType, PathRegistry


class RDFToolInput(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from langchain.tools import BaseTool

from mdagent.utils import FileType, PathRegistry, load_single_traj
from mdcrow.utils import FileType, PathRegistry, load_single_traj


class RadiusofGyration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from langchain.tools import BaseTool
from pydantic import BaseModel, Field

from mdagent.utils import PathRegistry, load_traj_with_ref, save_plot, save_to_csv
from mdcrow.utils import PathRegistry, load_traj_with_ref, save_plot, save_to_csv


def rmsd(path_registry, traj, ref_traj, mol_name, select="protein"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from langchain.tools import BaseTool

from mdagent.utils import FileType, PathRegistry, load_single_traj, save_to_csv
from mdcrow.utils import FileType, PathRegistry, load_single_traj, save_to_csv


class SASAFunctions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from langchain.tools import BaseTool

from mdagent.utils import FileType, PathRegistry, load_single_traj
from mdcrow.utils import FileType, PathRegistry, load_single_traj


def write_raw_x(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import nbformat as nbf
from langchain.tools import BaseTool

from mdagent.utils import PathRegistry
from mdcrow.utils import PathRegistry


class VisFunctions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pdbfixer import PDBFixer
from pydantic import BaseModel, Field

from mdagent.utils import FileType, PathRegistry
from mdcrow.utils import FileType, PathRegistry


class CleaningToolFunctionInput(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from langchain.tools import BaseTool
from pydantic import BaseModel, Field, ValidationError

from mdagent.utils import PathRegistry
from mdcrow.utils import PathRegistry

from .pdb_fix import Validate_Fix_PDB
from .pdb_get import MolPDB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pdbfixer import PDBFixer
from pydantic import BaseModel, Field, ValidationError

from mdagent.utils import PathRegistry
from mdcrow.utils import PathRegistry

from .elements import list_of_elements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from rdkit import Chem
from rdkit.Chem import AllChem

from mdagent.utils import FileType, PathRegistry
from mdcrow.utils import FileType, PathRegistry


def get_pdb(query_string: str, path_registry: PathRegistry):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from langchain_core.output_parsers import StrOutputParser
from pydantic import BaseModel, Field

from mdagent.utils import FileType, PathRegistry
from mdcrow.utils import FileType, PathRegistry


class ModifyScriptUtils:
Expand Down
Loading

0 comments on commit b5bdbb7

Please sign in to comment.