Skip to content

Fix critical bugs in error_data_expansion.py: tool validation, regex,…#5

Open
study8677 wants to merge 1 commit into
DeepExperience:mainfrom
study8677:main
Open

Fix critical bugs in error_data_expansion.py: tool validation, regex,…#5
study8677 wants to merge 1 commit into
DeepExperience:mainfrom
study8677:main

Conversation

@study8677

Copy link
Copy Markdown

Summary

This PR fixes multiple critical bugs in dataloop/error_data_expansion.py that were affecting data generation quality and system stability.

Key Changes

🛡️ Critical Data Quality Fixes

  1. Tool Validation Logic:
    • Fixed validate_generated_sample to actually use the original_tools parameter.
    • Now verifies that generated tool calls exist in the provided tool definitions, preventing the model from hallucinating non-existent tools.
  2. Robust Regex Extraction:
    • Updated extract_tools_from_instruction regex to be flexible with whitespace (r'<tools>\s*(.*?)\s*</tools>'). Previously it failed if tags weren't strictly formatted with newlines.
  3. Input Parsing Safety:
    • Fixed parse_generated_sample to correctly identify the OUTPUT: delimiter. Previously, if the user input contained the word "OUTPUT:", the content would be wrongly truncated.

🐛 General Bug Fixes

  1. Model Name Type Mismatch:
    • Fixed main passing model_name as a string instead of a list, which caused API errors.
  2. Message Splitting:
    • Improved convert_from_simple_format to split messages by Role headers instead of double newlines (\n\n), preserving multi-paragraph messages.
  3. Safe Dictionary Access:
    • Added safe .get() access for judge_details to prevent crashes when the field is missing.

Impact

These changes ensure that the expanded dataset contains valid, executable tool calls and prevents silent data corruption.

@study8677

Copy link
Copy Markdown
Author

Hi, I found some logic errors in the data expansion script and fixed them in this PR.

The changes cover:

  1. Robustness fixes for regex tools extraction and input parsing.
  2. Logic fix for the validate_generated_sample function (it was effectively a no-op before).
  3. Type fix for the model_name parameter.

Ready for review!

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