Skip to content

Conversation

@XiaoBoAI
Copy link
Collaborator

@XiaoBoAI XiaoBoAI commented Jan 12, 2026

OpenJudge Version

0.2.0

Description

  • Fix import paths in docstrings to use correct module paths
  • Rename deprecated 'grader_mode' parameter to 'mode' in multiple graders
  • Add input type validation to format graders (json_validator, length_penalty, ngram_repetition_penalty, reasoning_format, reasoning_tool_format)
  • Fix think pattern regex in ngram_repetition_penalty to include tags
  • Fix error handling in relevance.py to return GraderScore instead of GraderError
  • Fix parameter name 'output' to 'response' in instruction_following docstring example

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with pre-commit run --all-files command
  • All tests are passing
  • Docstrings are in Google style
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

…tion

- Fix import paths in docstrings to use correct module paths
- Rename deprecated 'grader_mode' parameter to 'mode' in multiple graders
- Add input type validation to format graders (json_validator, length_penalty,
  ngram_repetition_penalty, reasoning_format, reasoning_tool_format)
- Fix think pattern regex in ngram_repetition_penalty to include <think></think> tags
- Fix error handling in relevance.py to return GraderScore instead of GraderError
- Fix parameter name 'output' to 'response' in instruction_following docstring example
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @XiaoBoAI, 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 focuses on enhancing the stability and maintainability of the grading system by addressing several technical debts. It standardizes parameter names, strengthens input validation across various format graders, and refines error handling mechanisms. These changes collectively contribute to a more robust and predictable grading process, ensuring that graders operate correctly with expected inputs and provide consistent outputs even in error scenarios.

Highlights

  • Deprecated Parameter Renaming: The deprecated 'grader_mode' parameter has been consistently renamed to 'mode' across multiple grader implementations for better consistency and adherence to current API standards.
  • Input Validation Enhancement: Input type validation has been added to several format graders (json_validator, length_penalty, ngram_repetition_penalty, reasoning_format, reasoning_tool_format) to ensure that the 'response' parameter is always a string, improving robustness and preventing unexpected errors.
  • Docstring and Example Corrections: Import paths in docstrings have been fixed to reflect correct module locations, and a parameter name in the 'instruction_following' docstring example was corrected from 'output' to 'response'.
  • Regex Pattern Refinement: The regular expression for detecting 'think' patterns in the 'ngram_repetition_penalty' grader has been updated to correctly include the <think></think> tags.
  • Error Handling Improvement: Error handling in 'relevance.py' has been modified to return a 'GraderScore' with a score of 0.0 and a descriptive reason upon evaluation failure, rather than raising a 'GraderError', providing a more consistent grading output.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

…ndling

GraderScore does not have an 'error' attribute. When RelevanceGrader
catches an exception, it stores the error message in the 'reason' field.
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 several valuable refactorings and fixes across the grader modules. The changes include updating deprecated parameters, fixing incorrect import paths in docstrings, and improving input validation for several format graders. Key bug fixes include correcting a regex pattern in ngram_repetition_penalty and fixing the error handling in relevance.py to return the correct type.

My review includes a couple of suggestions for further improvement:

  • In relevance.py, I've noted that metadata from the super-class evaluation is being discarded, which could be preserved.
  • For the format graders, I've suggested refactoring the duplicated input validation logic into a reusable decorator to improve maintainability.

Overall, these are solid improvements that enhance the robustness and consistency of the codebase.

…ceGrader

Address review feedback: preserve result.metadata from super().aevaluate()
to avoid losing important evaluation details from the LLM.
…ed params

- Replace grader_mode with mode parameter in graders (deprecated param)
- Return GraderError instead of GraderScore on evaluation errors
- Add input validation for response type in format graders
- Update tests to check error field instead of reason for errors
- Fix docstring import paths in common graders
- Add require_string_response decorator for format graders
- Fix mode parameter naming (grader_mode -> mode)
- Add threshold param to RelevanceGrader
- Fix think pattern regex in ngram_repetition_penalty
- Remove require_string_response decorator from base_grader.py
- Rely on Python type annotations instead of runtime type checks
- Follow project guidelines: trust internal code, validate only at system boundaries
@ployts ployts changed the title refactor(graders): fix deprecated parameters and improve input valida… refactor(graders): fix deprecated parameters and improve input validation Jan 12, 2026
score=score,
reason=reason,
)
return GraderError(
Copy link
Contributor

Choose a reason for hiding this comment

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

It's supposed to be the same data type with error message in the return object

Copy link
Collaborator

@ployts ployts left a comment

Choose a reason for hiding this comment

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

LGTM

@helloml0326 helloml0326 merged commit 4659eac into main Jan 13, 2026
2 checks passed
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.

5 participants