-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make the metric call function async #758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
DavdGao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see inline comments, others look good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR changes the metric __call__ function from synchronous to asynchronous to support more general usage patterns, particularly LLM-as-a-judge metrics that require async operations.
Key changes:
- Made the
MetricBase.__call__method abstract and async - Updated all evaluator classes to handle async metric calls
- Added comprehensive test coverage for the evaluation module
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/evaluation_test.py | Added comprehensive test suite for evaluators with async metric support |
| src/agentscope/evaluate/_task.py | Made task evaluation method async to support async metric calls |
| src/agentscope/evaluate/_metric_base.py | Changed abstract metric __call__ method to async |
| src/agentscope/evaluate/_evaluator/_ray_evaluator.py | Refactored Ray evaluator to use async actors and proper async handling |
| src/agentscope/evaluate/_evaluator/_general_evaluator.py | Updated general evaluator to handle async metric evaluation |
| src/agentscope/evaluate/_ace_benchmark/_ace_metric.py | Made ACE benchmark metrics async-compatible |
| docs/tutorial/zh_CN/src/task_eval.py | Updated Chinese tutorial example with async metric and corrected name |
| docs/tutorial/en/src/task_eval.py | Updated English tutorial example with async metric and corrected name |
Comments suppressed due to low confidence (1)
src/agentscope/evaluate/_evaluator/_ray_evaluator.py:1
- Using
__file__in py_modules for Ray runtime_env is incorrect.__file__refers to the current Python file being executed, but py_modules expects module names or paths to modules that should be made available to Ray workers. This will likely cause import errors in Ray workers.
# -*- coding: utf-8 -*-
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
DavdGao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
AgentScope Version
1.0.2
Description
Change the
__call__function of metric toasyncfunction for more general usage (e.g., LLM as a judge metrics)evaluatemoduleChecklist
Please check the following items before code is ready to be reviewed.
pre-commit run --all-filescommand