Description
Adk evaluation failing with: "AttributeError: 'float' object has no attribute 'item'"
Steps to reproduce the behavior:
-
Install google adk latest version. I'm using google-adk version 1.1.1, but I've also tried 0.0.4 and 1.0.0 with the same error.
Install pytest and its dependencies -
I can reproduce this issue calling adk eval or runinng my test using pytest.
Running adk eval:
adk eval --config_file_path tests/evaluation/test_config.json --print_detailed_results sub_agents/analyze tests/evaluation/analyze_agent.test.json
Running test using pytest:
pytest tests/evaluation/test_analyze_agent.py -v --capture=no
- Error:
self = <google.adk.evaluation.response_evaluator.ResponseEvaluator object at 0x00000141C47D2030>
eval_result = EvalResult(summary_metrics={'row_count': 1, 'rouge_1/mean': nan, 'rouge_1/std': np.float64(nan)}, metrics_table= ...e_1/score
0 { "audit_transaction": { "request_docume... ... None
[1 rows x 6 columns], metadata=None)
def _get_score(self, eval_result) -> float:
> return eval_result.summary_metrics[f"{self._metric_name}/mean"].item()
E AttributeError: 'float' object has no attribute 'item'
..\.env\Lib\site-packages\google\adk\evaluation\response_evaluator.py:120: AttributeError
Expected behavior
Expect to run adk evaluation on my analyze_agent to evaluate trajectory and response matching without errors.
Desktop (please complete the following information):
- Windows Server 2022
- Python version 3.12.0
- ADK version 1.1.1
Additional context
I'm attempting to run ADK evaluation on my agent but I'm encountering the following error: "AttributeError: 'float' object has no attribute 'item'". Here are the details:
-
I'm using google-adk version 1.1.1, but I've also tried 0.0.4 and 1.0.0 with the same error.
-
The eval-set I'm using was generated via ADK Web.
-
I've executed the tests using both pytest and the adk eval CLI, and both produce the same results.
-
The error appears to originate from the response_evaluator, specifically this line
These are the files Im using to run the evaluation including the test output:
test_config.json.txt
TestResults.txt
test_analyze_agent.py.txt
analyze_agent.test.json.txt
Any guidance would be appreciated!