Skip to content

Conversation

@shijinpjlab
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @shijinpjlab, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant refactoring of the evaluation result handling within the dingo framework. It streamlines the data model by eliminating the EvalDetail class and embedding its properties directly into the ModelRes object. This change allows for a more flexible and detailed representation of evaluation outcomes, as ResultInfo can now aggregate multiple ModelRes instances per field. The associated processing and serialization logic across various modules have been updated to align with this new, simplified structure, improving clarity and maintainability.

Highlights

  • Refactored Evaluation Result Model: The EvalDetail class has been removed, and its attributes (label, metric, reason) have been integrated directly into the ModelRes class, simplifying the data structure.
  • Simplified ModelRes Structure: The ModelRes class now directly holds status (renamed from eval_status), label, and reason attributes, making its usage more straightforward.
  • Enhanced ResultInfo Aggregation: The ResultInfo class now stores a list of ModelRes objects for each evaluated field, allowing for the collection of multiple, distinct evaluation outcomes per field, rather than a single aggregated object.
  • Updated Result Processing Logic: The execution, merging, and writing logic in dingo/exec/local.py has been adapted to correctly handle the new List[ModelRes] structure within ResultInfo.eval_details, including a mechanism to prevent duplicate label entries during writing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant and beneficial refactoring of the ModelRes data structure, simplifying the handling of evaluation results. The changes in dingo/exec/local.py and dingo/io/output/result_info.py correctly adapt to this new structure. However, the refactoring is incomplete and introduces a critical issue: most of the rule implementations in dingo/model/rule/rule_common.py have not been updated to use the new ModelRes format. This will lead to runtime failures. Additionally, I've suggested some minor code cleanup by removing commented-out code blocks to improve readability.

Comment on lines 220 to +224
if key in existing_item.eval_details:
existing_item.eval_details[key].merge(value)
# 第一层是字段名,如果不存在,则创建副本
existing_item.eval_details[key].extend(value)
# 第一层是字段名,如果不存在,则直接赋值
else:
existing_item.eval_details[key] = value.copy()
existing_item.eval_details[key] = value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When merging eval_details, the value list is assigned directly. While this is likely safe because new_item is transient, if value were to be modified elsewhere, it would affect existing_item.eval_details[key] as they would point to the same list object. Using value.copy() would prevent such potential side effects and make the code more robust against future changes.

Suggested change
if key in existing_item.eval_details:
existing_item.eval_details[key].merge(value)
# 第一层是字段名,如果不存在,则创建副本
existing_item.eval_details[key].extend(value)
# 第一层是字段名,如果不存在,则直接赋值
else:
existing_item.eval_details[key] = value.copy()
existing_item.eval_details[key] = value
if key in existing_item.eval_details:
existing_item.eval_details[key].extend(value)
# 第一层是字段名,如果不存在,则直接赋值
else:
existing_item.eval_details[key] = value.copy()

Comment on lines +342 to +355
# res.eval_status = True
# res.eval_details = {
# "label": [f"{cls.metric_type}.{cls.__name__}"],
# "metric": [cls.__name__],
# "reason": [content[-100:]]
# }
res.status = True
res.label = [f"{cls.metric_type}.{cls.__name__}"]
res.reason = [content[-100:]]
else:
res.eval_details = {
"label": [QualityLabel.QUALITY_GOOD]
}
# res.eval_details = {
# "label": [QualityLabel.QUALITY_GOOD]
# }
res.label = [QualityLabel.QUALITY_GOOD]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve code clarity and maintainability, it's best to remove the commented-out old code.

            res.status = True
            res.label = [f"{cls.metric_type}.{cls.__name__}"]
            res.reason = [content[-100:]]
        else:
            res.label = [QualityLabel.QUALITY_GOOD]

Comment on lines +2070 to +2083
# res.eval_status = True
# res.eval_details = {
# "label": [f"{cls.metric_type}.{cls.__name__}"],
# "metric": [cls.__name__],
# "reason": list(set(matches))
# }
res.status = True
res.label = [f"{cls.metric_type}.{cls.__name__}"]
res.reason = list(set(matches))
else:
res.eval_details = {
"label": [QualityLabel.QUALITY_GOOD]
}
# res.eval_details = {
# "label": [QualityLabel.QUALITY_GOOD]
# }
res.label = [QualityLabel.QUALITY_GOOD]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve code clarity and maintainability, it's best to remove the commented-out old code.

            res.status = True
            res.label = [f"{cls.metric_type}.{cls.__name__}"]
            res.reason = list(set(matches))
        else:
            res.label = [QualityLabel.QUALITY_GOOD]

}


class ModelRes(BaseModel):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EvalDetail这个class不用了么

@e06084 e06084 merged commit 040fa6f into MigoXLab:dev Dec 11, 2025
2 checks passed
@shijinpjlab shijinpjlab deleted the dev_1210 branch December 31, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants