-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix top sample data #45214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix top sample data #45214
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2353,15 +2353,31 @@ def _convert_single_row_to_aoai_format( | |||||||||||||
| # Convert criteria groups to results | ||||||||||||||
| run_output_results = [] | ||||||||||||||
| top_sample = {} | ||||||||||||||
| if input_data and len(input_data) > 0 and "sample.generated_sample_data" in input_data: | ||||||||||||||
| top_sample_str = input_data["sample.generated_sample_data"] | ||||||||||||||
| if top_sample_str and isinstance(top_sample_str, str): | ||||||||||||||
| try: | ||||||||||||||
| top_sample_dict = json.loads(top_sample_str) | ||||||||||||||
| if top_sample_dict and isinstance(top_sample_dict, dict): | ||||||||||||||
| top_sample = top_sample_dict | ||||||||||||||
| input_data.pop("sample.generated_sample_data", None) | ||||||||||||||
| if "sample.output_status" in input_data: | ||||||||||||||
| input_data.pop("sample.output_status", None) | ||||||||||||||
| if "sample.output_status.status" in input_data: | ||||||||||||||
| input_data.pop("sample.output_status.status", None) | ||||||||||||||
| if "sample.output_status.message" in input_data: | ||||||||||||||
| input_data.pop("sample.output_status.message", None) | ||||||||||||||
| except Exception as e: | ||||||||||||||
| logger.error( | ||||||||||||||
| f"Failed to parse generated_sample_data as JSON for row {row_idx}, eval_id: {eval_id}, eval_run_id: {eval_run_id}. Storing as string. Error: {e}" | ||||||||||||||
| ) | ||||||||||||||
|
||||||||||||||
| ) | |
| ) | |
| # Fallback: store the raw string value in the sample when JSON parsing fails | |
| top_sample = {"generated_sample_data": top_sample_str} | |
| # Remove the raw string from input_data to keep behavior consistent | |
| input_data.pop("sample.generated_sample_data", None) |
Copilot
AI
Feb 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The int(float(metric_value)) conversion can raise ValueError if metric_value is a string that cannot be converted to float. Consider adding exception handling or validation before conversion to handle edge cases gracefully. For example, if metric_value is an empty string or contains non-numeric characters, this will crash.
Copilot
AI
Feb 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The int(float(metric_value)) conversion can raise ValueError if metric_value is a string that cannot be converted to float. Consider adding exception handling or validation before conversion to handle edge cases gracefully. For example, if metric_value is an empty string or contains non-numeric characters, this will crash.
Copilot
AI
Feb 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The int(float(metric_value)) conversion can raise ValueError if metric_value is a string that cannot be converted to float. Consider adding exception handling or validation before conversion to handle edge cases gracefully. For example, if metric_value is an empty string or contains non-numeric characters, this will crash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error log message may expose sensitive user content from generated_sample_data. According to the repository's security practices for log redaction, user-provided content should be redacted from log messages to prevent credentials or sensitive information from appearing in telemetry. The generated_sample_data can contain queries, responses, and other user inputs that should not be logged. Consider using logger.debug instead of logger.error, or ensure the exception message doesn't contain the actual data content.