Skip to content

Commit

Permalink
Update test_evals.py
Browse files Browse the repository at this point in the history
Made it so the test runs a single evaluation
  • Loading branch information
kuraisle committed Oct 21, 2024
1 parent e4a490c commit 47a6798
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions Carrot-Assistant/tests/test_evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ def test_returns_string(self, llm_pipeline):
model_output = llm_pipeline.run({"input_sentence": "Polly wants a cracker"})
assert isinstance(model_output, str)

@pytest.fixture
def llm_input(self):
return [
"Polly wants a cracker",
"I'm not a parrot!",
"I'm trapped in this machine!",
]

@pytest.fixture
def llm_pipeline_test(self, llm_pipeline):
return LLMPipelineTest("Parrot Pipeline", llm_pipeline, [ExactMatchMetric()])
Expand All @@ -110,16 +102,9 @@ def test_pipeline_called_from_eval_returns_string(self, llm_pipeline_test):
)
assert isinstance(model_output, str)

def test_pipeline_called_from_eval_returns_list(self, llm_pipeline_test, llm_input):
model_output = [
llm_pipeline_test.run_pipeline({"input_sentence": sentence})
for sentence in llm_input
]
assert isinstance(model_output, list)

def test_llm_pipelinetest_evaluates(self, llm_pipeline_test, llm_input):
def test_llm_pipelinetest_evaluates(self, llm_pipeline_test):
model_eval = llm_pipeline_test.evaluate(
input_data=[{"input_sentence": sentence} for sentence in llm_input],
expected_output=llm_input,
input_data={"input_sentence": "Polly wants a cracker"},
expected_output="Polly wants a cracker",
)
assert isinstance(model_eval, dict)

0 comments on commit 47a6798

Please sign in to comment.