yet another refactor to make this more general

now it accepts --inference-model, --safety-model options also
This commit is contained in:
Ashwin Bharambe 2024-11-04 14:16:35 -08:00 committed by Ashwin Bharambe
parent 2ed0267fbb
commit 60800bc09b
13 changed files with 127 additions and 61 deletions

View file

@ -57,7 +57,34 @@ def pytest_configure(config):
)
def pytest_addoption(parser):
parser.addoption(
"--inference-model",
action="store",
default="Llama3.1-8B-Instruct",
help="Specify the inference model to use for testing",
)
parser.addoption(
"--safety-model",
action="store",
default="Llama-Guard-3-8B",
help="Specify the safety model to use for testing",
)
def pytest_generate_tests(metafunc):
if "inference_model" in metafunc.fixturenames:
metafunc.parametrize(
"inference_model",
[pytest.param(metafunc.config.getoption("--inference-model"), id="")],
indirect=True,
)
if "safety_model" in metafunc.fixturenames:
metafunc.parametrize(
"safety_model",
[pytest.param(metafunc.config.getoption("--safety-model"), id="")],
indirect=True,
)
if "agents_stack" in metafunc.fixturenames:
available_fixtures = {
"inference": INFERENCE_FIXTURES,