Skip to content

Commit

Permalink
chore: address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nherment committed Nov 21, 2024
1 parent d38635b commit b30d5bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
16 changes: 1 addition & 15 deletions tests/llm/utils/mock_dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from holmes.core.supabase_dal import SupabaseDal
from holmes.core.tool_calling_llm import ResourceInstructions
from tests.llm.utils.constants import AUTO_GENERATED_FILE_SUFFIX
from tests.llm.utils.mock_utils import read_file
from tests.llm.utils.mock_utils import load_issue_data, load_resource_instructions, read_file

class MockSupabaseDal(SupabaseDal):

Expand Down Expand Up @@ -69,17 +69,3 @@ def load_mock_dal(test_case_folder:Path, dal_passthrough:bool = False):
resource_instructions=resource_instructions,
dal_passthrough=dal_passthrough
)

def load_issue_data(test_case_folder:Path) -> Optional[Dict]:

issue_data_mock_path = test_case_folder.joinpath(Path("issue_data.json"))
if issue_data_mock_path.exists():
return json.loads(read_file(issue_data_mock_path))
return None


def load_resource_instructions(test_case_folder:Path) -> Optional[ResourceInstructions]:
resource_instructions_mock_path = test_case_folder.joinpath(Path("resource_instructions.json"))
if resource_instructions_mock_path.exists():
return TypeAdapter(ResourceInstructions).validate_json(read_file(Path(resource_instructions_mock_path)))
return None
15 changes: 14 additions & 1 deletion tests/llm/utils/mock_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from holmes.core.models import InvestigateRequest
from holmes.core.tool_calling_llm import ResourceInstructions
from tests.llm.utils.constants import AUTO_GENERATED_FILE_SUFFIX
from tests.llm.utils.mock_dal import load_issue_data
from tests.llm.utils.mock_toolset import MockMetadata, ToolMock

def read_file(file_path:Path):
Expand Down Expand Up @@ -191,3 +190,17 @@ def load_investigate_request(test_case_folder:Path) -> InvestigateRequest:
if investigate_request_path.exists():
return TypeAdapter(InvestigateRequest).validate_json(read_file(Path(investigate_request_path)))
raise Exception(f"Investigate test case declared in folder {str(test_case_folder)} should have an investigate_request.json file but none is present")

def load_issue_data(test_case_folder:Path) -> Optional[Dict]:

issue_data_mock_path = test_case_folder.joinpath(Path("issue_data.json"))
if issue_data_mock_path.exists():
return json.loads(read_file(issue_data_mock_path))
return None


def load_resource_instructions(test_case_folder:Path) -> Optional[ResourceInstructions]:
resource_instructions_mock_path = test_case_folder.joinpath(Path("resource_instructions.json"))
if resource_instructions_mock_path.exists():
return TypeAdapter(ResourceInstructions).validate_json(read_file(Path(resource_instructions_mock_path)))
return None

0 comments on commit b30d5bb

Please sign in to comment.