Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
manthanguptaa committed Jan 23, 2025
1 parent 9a4ed01 commit 900b1b7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions libs/agno/agno/eval/reliability.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def set_debug_mode(self) -> None:
else:
set_log_level_to_info()

def run(self, *, print_summary: bool = False, print_results: bool = False) -> None:
def run(self, *, print_summary: bool = False, print_results: bool = False) -> Optional[ReliabilityResult]:
from rich.console import Console
from rich.live import Live
from rich.status import Status
Expand All @@ -95,20 +95,21 @@ def run(self, *, print_summary: bool = False, print_results: bool = False) -> No
live_log.update(status)

actual_tool_calls = None
for message in reversed(self.agent_response.messages):
if message.tool_calls:
if actual_tool_calls is None:
actual_tool_calls = message.tool_calls
if self.agent_response is not None:
for message in reversed(self.agent_response.messages): # type: ignore
if message.tool_calls:
if actual_tool_calls is None:
actual_tool_calls = message.tool_calls
else:
actual_tool_calls.append(message.tool_calls[0])
actual_tool_calls.append(message.tool_calls[0]) # type: ignore

failed_tool_calls = []
passed_tool_calls = []
for tool_call in actual_tool_calls:
if tool_call["function"]["name"] not in self.expected_tool_calls:
failed_tool_calls.append(tool_call["function"]["name"])
for tool_call in actual_tool_calls: # type: ignore
if tool_call.get("function", {}).get("name") not in self.expected_tool_calls: # type: ignore
failed_tool_calls.append(tool_call.get("function", {}).get("name"))
else:
passed_tool_calls.append(tool_call["function"]["name"])
passed_tool_calls.append(tool_call.get("function", {}).get("name"))

self.result = ReliabilityResult(
eval_status="PASSED" if len(failed_tool_calls) == 0 else "FAILED",
Expand Down

0 comments on commit 900b1b7

Please sign in to comment.