Skip to content

Commit

Permalink
unit test for mdagent learn flag
Browse files Browse the repository at this point in the history
  • Loading branch information
SamCox822 committed Feb 14, 2024
1 parent f6fd1d9 commit cfdbe56
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mdagent/tools/maketools.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def make_all_tools(
ModifyBaseSimulationScriptTool(path_registry=path_instance, llm=llm),
SimulationOutputFigures(),
]
if subagent_settings is None:
subagent_settings = SubAgentSettings(path_registry=path_instance)

# tools using subagents
subagents_tools = []
if not skip_subagents:
if subagent_settings is None:
subagent_settings = SubAgentSettings(path_registry=path_instance)
subagents_tools = [
CreateNewTool(subagent_settings=subagent_settings),
RetryExecuteSkill(subagent_settings=subagent_settings),
Expand Down
16 changes: 16 additions & 0 deletions tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import pytest

from mdagent.mainagent.agent import MDAgent
from mdagent.mainagent.prompt import openaifxn_prompt, structured_prompt
from mdagent.subagents.agents.action import Action
from mdagent.subagents.agents.skill import SkillManager
from mdagent.subagents.subagent_fxns import Iterator
Expand Down Expand Up @@ -231,3 +233,17 @@ def test_update_skill_library(skill_manager):
path="/mock_dir/code/test_function.py",
description="Code for new tool test_function",
)


# test initiating mdagent with learn = false
def test_mdagent_init():
mdagent_skill = MDAgent(learn=False)
assert (
mdagent_skill.prompt == openaifxn_prompt
or mdagent_skill.prompt == structured_prompt
)
assert mdagent_skill.skip_subagents is True

mdagent_learn = MDAgent(learn=True)
assert mdagent_learn.prompt == openaifxn_prompt
assert mdagent_learn.skip_subagents is False

0 comments on commit cfdbe56

Please sign in to comment.