Skip to content

Conversation

@CHERRY-ui8
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CHERRY-ui8, 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 significantly enhances the knowledge graph evaluation capabilities by introducing robust multi-language support for prompts and providing more comprehensive and detailed evaluation criteria. The changes aim to improve the clarity, specificity, and accuracy of the evaluation process, making it more effective for assessing knowledge graph quality across different linguistic contexts.

Highlights

  • Multi-language Prompt Support: The evaluation system now supports multi-language prompts, primarily English and Chinese, for consistency evaluations. The ConsistencyEvaluator dynamically selects prompts based on the detected language of the input chunk for entity extraction.
  • Improved Evaluation Prompt Details: The accuracy evaluation prompts for both entity and relation extraction have been significantly expanded. They now include more detailed explanations, specific checks, and illustrative examples for Accuracy, Completeness, and Precision dimensions, along with refined scoring criteria that incorporate error rate percentages.
  • Prompt Refactoring and Consolidation: All consistency evaluation prompts (entity type conflict, entity description conflict, relation conflict, and entity extraction) have been refactored into a single, unified dictionary (CONSISTENCY_EVALUATION_PROMPT), organized by language and prompt type for easier management and extensibility.
  • Standardized Conflict Detection Language: Conflict detection prompts (entity type, description, and relation consistency) are now standardized to use Chinese (zh) by default, with a note that this can be made configurable in the future.
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 significantly improves the evaluation prompts by making them more detailed and adding support for both English and Chinese. The refactoring of prompt templates into a language-keyed dictionary is a clean solution for internationalization. The use of a language detection utility to select the appropriate prompt is also a great addition. My main feedback concerns the hardcoding of the language to 'zh' for conflict detection logic. While the reasoning is noted in comments, making this configurable would greatly improve the flexibility and maintainability of the evaluator. Overall, these are valuable enhancements to the project's evaluation capabilities.

prompt = ENTITY_TYPE_CONFLICT_PROMPT.format(
# Use default language (zh) for conflict detection prompts
# as they compare multiple chunks which may have different languages
lang = "zh" # Default to Chinese, can be made configurable
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Hardcoding the language to 'zh' here is not ideal. It makes the evaluator less flexible and might produce poor results if the content being evaluated is in another language. The comment indicates this could be configurable, which is the right direction. To improve maintainability and avoid magic strings, consider defining this default language as a constant at the module level (e.g., DEFAULT_CONFLICT_LANG = 'zh') or, even better, making it a configurable instance attribute set in the __init__ method (e.g., self.default_lang). This would allow for easier changes in the future.


prompt = ENTITY_DESCRIPTION_CONFLICT_PROMPT.format(
# Use default language (zh) for conflict detection prompts
lang = "zh" # Default to Chinese, can be made configurable
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Similar to the entity type consistency check, the language for conflict detection is hardcoded to 'zh'. This reduces flexibility and maintainability. This should be made configurable to handle content in other languages correctly. Using a module-level constant or a class attribute would be a better practice than a magic string.


prompt = RELATION_CONFLICT_PROMPT.format(
# Use default language (zh) for conflict detection prompts
lang = "zh" # Default to Chinese, can be made configurable
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The language is again hardcoded to 'zh' for relation consistency checks. For the same reasons of flexibility and maintainability, this should be refactored to use a configurable value, such as a class attribute or a constant, instead of a hardcoded string.

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.

1 participant