Skip to content

Conversation

@ChenZiHong-Gavin
Copy link
Collaborator

This PR refactors the GraphGen generator modules to use a structured XML-like format for LLM prompts and responses, replacing fragile string-splitting logic with robust regex-based parsing.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ChenZiHong-Gavin, 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 stability and maintainability of the GraphGen system by overhauling how Large Language Model (LLM) responses are processed. It moves away from simple string manipulations to a more resilient, regex-based parsing mechanism that expects and utilizes a structured XML-like output format from the LLMs. This change is crucial for preventing parsing errors and ensuring the accurate extraction of generated content. Additionally, it includes minor adjustments to LLM generation parameters to optimize output quality and introduces better error handling for parsing failures.

Highlights

  • Robust LLM Response Parsing: Refactored LLM response parsing across multiple generator modules (aggregated, atomic, CoT, multi-hop, VQA) to use regular expressions with a structured XML-like format (e.g., ..., ...) instead of fragile string-splitting methods. This significantly improves parsing reliability and error handling.
  • Updated LLM Prompt Templates: Modified all relevant prompt templates to explicitly instruct LLMs to output responses in the new XML-like format, ensuring consistency with the updated parsing logic.
  • LLM Generation Parameter Adjustments: Increased the default max_tokens for LLM generation from 512 to 2048 and adjusted the default temperature from 0.0 to 0.6 in the vllm_wrapper to potentially encourage more diverse and complete responses.
  • Improved Error Handling: Added explicit checks and logging for parsing failures in generator modules, allowing for early returns or warnings when expected data cannot be extracted from LLM responses.
  • Refactored File Reading Parameter: Renamed the cache_dir parameter to working_dir in the read operator for better clarity and consistency.
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 is a significant improvement, refactoring the GraphGen generator modules to use a structured XML-like format for LLM prompts and responses. This replaces fragile string-splitting logic with robust regex-based parsing, which greatly enhances the reliability of the data generation process. The changes are consistently applied across all relevant generator modules and their prompt templates. The error handling has also been improved. I have one suggestion to simplify the code structure in vqa_generator.py. Overall, this is an excellent refactoring that improves code quality and maintainability.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ChenZiHong-Gavin ChenZiHong-Gavin merged commit c4093df into main Dec 23, 2025
4 checks passed
@ChenZiHong-Gavin ChenZiHong-Gavin deleted the refactor/refactor-generators branch December 23, 2025 13:00
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.

2 participants