mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-26 16:48:13 +00:00
fix: encode string before hashing
This commit is contained in:
@@ -34,7 +34,7 @@ class ExperimentRunner:
|
|||||||
def _run_test_case(self, test_case: Dict[str, Any], crew: Crew) -> ExperimentResult:
|
def _run_test_case(self, test_case: Dict[str, Any], crew: Crew) -> ExperimentResult:
|
||||||
inputs = test_case["inputs"]
|
inputs = test_case["inputs"]
|
||||||
expected_score = test_case["expected_score"]
|
expected_score = test_case["expected_score"]
|
||||||
identifier = test_case.get("identifier") or md5(str(test_case), usedforsecurity=False).hexdigest()
|
identifier = test_case.get("identifier") or md5(str(test_case).encode(), usedforsecurity=False).hexdigest()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.display.console.print(f"[dim]Running crew with input: {str(inputs)[:50]}...[/dim]")
|
self.display.console.print(f"[dim]Running crew with input: {str(inputs)[:50]}...[/dim]")
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ class TestExperimentRunner:
|
|||||||
"expected_score": {"goal_alignment": 7}
|
"expected_score": {"goal_alignment": 7}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identifier": "test-case-3",
|
|
||||||
"inputs": {"query": "Test query 3"},
|
"inputs": {"query": "Test query 3"},
|
||||||
"expected_score": {"tool_selection": 9}
|
"expected_score": {"tool_selection": 9}
|
||||||
}
|
}
|
||||||
@@ -88,7 +87,7 @@ class TestExperimentRunner:
|
|||||||
assert "goal_alignment" in result_2.expected_score
|
assert "goal_alignment" in result_2.expected_score
|
||||||
assert result_2.passed is True
|
assert result_2.passed is True
|
||||||
|
|
||||||
assert result_3.identifier == "test-case-3"
|
assert result_3.identifier == "c2ed49e63aa9a83af3ca382794134fd5"
|
||||||
assert result_3.inputs == {"query": "Test query 3"}
|
assert result_3.inputs == {"query": "Test query 3"}
|
||||||
assert isinstance(result_3.expected_score, dict)
|
assert isinstance(result_3.expected_score, dict)
|
||||||
assert "tool_selection" in result_3.expected_score
|
assert "tool_selection" in result_3.expected_score
|
||||||
|
|||||||
Reference in New Issue
Block a user