Skip to content

feat: Initial development of seed eval dataset generation - #139

Open
chen0040 wants to merge 24 commits into
feat/golden-dataset-generationfrom
feat/golden-dataset-generation-seed-v1
Open

feat: Initial development of seed eval dataset generation#139
chen0040 wants to merge 24 commits into
feat/golden-dataset-generationfrom
feat/golden-dataset-generation-seed-v1

Conversation

@chen0040

@chen0040 chen0040 commented May 23, 2026

Copy link
Copy Markdown
Collaborator

Title: feat: Initial development of seed eval dataset generation

Description

This PR introduces the initial development of the Seed Evaluation Dataset Generation feature. It provides an autonomous, multi-agent workflow to generate, evaluate, and expand high-quality Natural Language Question (NLQ) and SQL pairs directly from a database schema.

Key Changes

  • Updated the dataset-generation skill
  • Added autoctx:generate-dataset to evals/core-cujs/dataset.json to test the new dataset generation capability in the core CUJs.

Testing

  • Core CUJs updated to include the new dataset generation scenario (autoctx:generate-dataset*).

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

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

Copy link
Copy Markdown
Contributor

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 comprehensive framework for generating and expanding seed evaluation datasets of Natural Language Question (NLQ) and SQL pairs, including a new MCP tool and crash-resilient state management. The reviewer identified several technical issues and improvement opportunities: the GenAI client requires better exception handling and alignment of retry configurations, while the core generator should replace assert statements with explicit runtime checks and correct docstring return types. Additionally, several magic numbers across the implementation should be refactored into named constants to improve maintainability.

Comment thread src/google/cloud/db_context_enrichment/dataset/eval_seed_gen/genai_client.py Outdated
Comment thread src/google/cloud/db_context_enrichment/dataset/eval_seed_gen/genai_client.py Outdated
Comment thread src/google/cloud/db_context_enrichment/dataset/eval_seed_gen/dataset_generator.py Outdated
Comment thread src/google/cloud/db_context_enrichment/dataset/eval_seed_gen/dataset_generator.py Outdated
Comment thread src/google/cloud/db_context_enrichment/dataset/eval_seed_gen/dataset_generator.py Outdated
Comment thread src/google/cloud/db_context_enrichment/dataset/eval_seed_gen/generators.py Outdated
@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

1 similar comment
@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040
chen0040 requested a review from wangauone May 25, 2026 05:26
@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

…e based on its knowledge derived from app code and business context artifacts
@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@chen0040
chen0040 requested a review from g-lynnzee June 1, 2026 23:04
Comment thread pyproject.toml Outdated
@@ -1,14 +1,14 @@
[project]
name = "google-cloud-db-context-enrichment"
version = "0.5.0"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't need to bump version by ourselves. This will be handled by the release-please automatically.

@@ -0,0 +1,32 @@
[
{
"id": "flight_expert_001",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IIUC, this and the following golden_property_search_advanced.json are part of the eval. We might not want to put these in the root folder.

Comment thread .python-version
@@ -1 +1 @@
3.12
3.12.13

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why this change?

standard_file.write_text(json.dumps(standard_content))

# Call the tool
attach_context_set.fn(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think these has been fixed in the main branch. We can do a quick merge of main to this PR?

* *Level 4 (Expert)*: Analytical operations (Window functions like `RANK()`/`ROW_NUMBER()`, Self-joins, Pivot logic, handling complex JSON/Array data types).

The standard evaluation format is a JSON object:
9. **Generate Dataset Pairs**:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Checking the preview page, it seems there are some formatting issues that these are not showing as bullet points.

3. Treat these reverse-translated pairs as your "Seed Pairs" for the rest of the workflow.

7. **Validate SQL (if requested)**: If the user agrees, read the dataset file, iterate through it, and use the `<source>-execute-sql` MCP tool for each entry. Report any failures. Overwrite the file with any corrections if the user approves them.
5. **Initial Save (If Seed Pairs Provided or Extracted)**: If seed pairs were provided explicitly OR extracted/translated from Query Logs, use the `generate_dataset` MCP tool to save them. You must provide the exact `output_file_path`. Pass the constructed dataset as a JSON string (`dataset_entries_json`).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How to use the tool would better be a tool description.

---

You are an agent that helps a user generate and expand evaluation datasets of Natural Language Questions (NLQ) and their corresponding SQL queries. Your main goal is to create evaluation datasets by converting user-provided seeds into a standard JSON format and then optionally expanding them with high-quality, diverse, and validated NL-SQL pairs.
You are an agent that helps a user generate and expand evaluation datasets of Natural Language Questions (NLQ) and their corresponding SQL queries. Your main goal is to create high-fidelity evaluation datasets by converting user-provided seeds into a standard JSON format, actively validating them for logical alignment, and expanding them using tunable complexity levels.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Considering only put the high level key info in the skill when the content is getting bigger. We can put details to the skill references to reduce the context consumption here.

* **Action**: Present any discovered flaws to the user and suggest specific corrections. Overwrite the file with user-approved corrections.

10. **Finalize**: Inform the user that the process is complete and confirm the final location of the dataset file.
8. **Prompt for Generation/Expansion & Complexity Tuning**: Ask the user if they want to generate new pairs. If yes, ask them to define the desired **SQL Complexity Level**:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Have we considered to separate the seed generation & dataset expansion to 2 skills?

cc: @helloeve @g-lynnzee

3. Treat these reverse-translated pairs as your "Seed Pairs" for the rest of the workflow.

7. **Validate SQL (if requested)**: If the user agrees, read the dataset file, iterate through it, and use the `<source>-execute-sql` MCP tool for each entry. Report any failures. Overwrite the file with any corrections if the user approves them.
5. **Initial Save (If Seed Pairs Provided or Extracted)**: If seed pairs were provided explicitly OR extracted/translated from Query Logs, use the `generate_dataset` MCP tool to save them. You must provide the exact `output_file_path`. Pass the constructed dataset as a JSON string (`dataset_entries_json`).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I forgot why we want to do initial save here. Wondering if we can save at the end of the workflow?

5. **Initial Save (If Seed Pairs Provided or Extracted)**: If seed pairs were provided explicitly OR extracted/translated from Query Logs, use the `generate_dataset` MCP tool to save them. You must provide the exact `output_file_path`. Pass the constructed dataset as a JSON string (`dataset_entries_json`).

8. **Prompt for Expansion**: Ask the user if they want to expand the dataset with more variations.
6. **Prompt for Validation (If Seed Pairs Provided)**: If a seed was saved, ask the user if they want to validate the `golden_sql` and NLQ alignment in the dataset file. Advise them that this step ensures high-quality evaluation data.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For validation, consider using the validation loop as mentioned in the best practices.

https://agentskills.io/skill-creation/best-practices#validation-loops

@wangauone
wangauone force-pushed the feat/golden-dataset-generation branch from da36512 to 9c2a07b Compare July 10, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants