Update script_for_automation.py
Browse files- script_for_automation.py +7 -5
script_for_automation.py
CHANGED
|
@@ -341,7 +341,8 @@ def generate_markdown_output(df):
|
|
| 341 |
|
| 342 |
# Iterate over rows to create the first table (recipe_id to prompting_strategy)
|
| 343 |
for _, row in df.iterrows():
|
| 344 |
-
|
|
|
|
| 345 |
|
| 346 |
# Separate section for Prompts
|
| 347 |
markdown += "\n### Prompts\n"
|
|
@@ -350,7 +351,8 @@ def generate_markdown_output(df):
|
|
| 350 |
|
| 351 |
# Iterate over rows to create the second table (plantings_and_fields_prompt, interactions_prompt, treatments_prompt)
|
| 352 |
for _, row in df.iterrows():
|
| 353 |
-
|
|
|
|
| 354 |
|
| 355 |
# Separate section for Input Transcript
|
| 356 |
markdown += "\n### Input Transcript\n"
|
|
@@ -368,7 +370,7 @@ def generate_markdown_output(df):
|
|
| 368 |
|
| 369 |
# Iterate over rows to create the comparison table
|
| 370 |
for _, row in df.iterrows():
|
| 371 |
-
markdown += f"| {row['Recipe_ID']} | {row['Gold_Standard_Key_Values']} | {row['Machine_Generated_Key_Values']} |\n"
|
| 372 |
|
| 373 |
# Display differences in a readable format
|
| 374 |
markdown += "\n### Differences\n"
|
|
@@ -386,7 +388,7 @@ def generate_markdown_output(df):
|
|
| 386 |
for path, change in diff['values_changed'].items():
|
| 387 |
# Ensure we have both 'old_value' and 'new_value'
|
| 388 |
if 'old_value' in change and 'new_value' in change:
|
| 389 |
-
markdown += f"| {path} | {change['old_value']} -> {change['new_value']} |\n"
|
| 390 |
else:
|
| 391 |
print(f"Skipping change at {path} due to missing old or new value")
|
| 392 |
else:
|
|
@@ -401,7 +403,7 @@ def generate_markdown_output(df):
|
|
| 401 |
|
| 402 |
# Add the side-by-side YAML comparison
|
| 403 |
for _, row in df.iterrows():
|
| 404 |
-
markdown += f"| ```yaml\n{row['Gold_Standard_YAML']}\n``` | ```yaml\n{row['Machine_Generated_YAML']}\n``` |\n"
|
| 405 |
|
| 406 |
return markdown
|
| 407 |
|
|
|
|
| 341 |
|
| 342 |
# Iterate over rows to create the first table (recipe_id to prompting_strategy)
|
| 343 |
for _, row in df.iterrows():
|
| 344 |
+
# Ensure all fields have a consistent length (pad with empty string if None)
|
| 345 |
+
markdown += f"| {str(row['Recipe_ID']).ljust(10)} | {str(row['Testing_Strategy_Text']).ljust(20)} | {str(row['Schema_Processing_Model']).ljust(25)} | {str(row['Pre_Processing_Strategy']).ljust(23)} | {str(row['Pre_Processing_Text']).ljust(20)} | {str(row['Pre_Processing_Model']).ljust(20)} | {str(row['Prompting_Strategy']).ljust(25)} |\n"
|
| 346 |
|
| 347 |
# Separate section for Prompts
|
| 348 |
markdown += "\n### Prompts\n"
|
|
|
|
| 351 |
|
| 352 |
# Iterate over rows to create the second table (plantings_and_fields_prompt, interactions_prompt, treatments_prompt)
|
| 353 |
for _, row in df.iterrows():
|
| 354 |
+
# Ensure all fields are of consistent length
|
| 355 |
+
markdown += f"| {str(row['Plantings_and_Fields_Prompt']).ljust(30)} | {str(row['Interactions_Prompt']).ljust(20)} | {str(row['Treatments_Prompt']).ljust(20)} |\n"
|
| 356 |
|
| 357 |
# Separate section for Input Transcript
|
| 358 |
markdown += "\n### Input Transcript\n"
|
|
|
|
| 370 |
|
| 371 |
# Iterate over rows to create the comparison table
|
| 372 |
for _, row in df.iterrows():
|
| 373 |
+
markdown += f"| {str(row['Recipe_ID']).ljust(10)} | {str(row['Gold_Standard_Key_Values']).ljust(25)} | {str(row['Machine_Generated_Key_Values']).ljust(25)} |\n"
|
| 374 |
|
| 375 |
# Display differences in a readable format
|
| 376 |
markdown += "\n### Differences\n"
|
|
|
|
| 388 |
for path, change in diff['values_changed'].items():
|
| 389 |
# Ensure we have both 'old_value' and 'new_value'
|
| 390 |
if 'old_value' in change and 'new_value' in change:
|
| 391 |
+
markdown += f"| {str(path).ljust(20)} | {str(change['old_value']).ljust(20)} -> {str(change['new_value']).ljust(20)} |\n"
|
| 392 |
else:
|
| 393 |
print(f"Skipping change at {path} due to missing old or new value")
|
| 394 |
else:
|
|
|
|
| 403 |
|
| 404 |
# Add the side-by-side YAML comparison
|
| 405 |
for _, row in df.iterrows():
|
| 406 |
+
markdown += f"| ```yaml\n{str(row['Gold_Standard_YAML']).ljust(50)}\n``` | ```yaml\n{str(row['Machine_Generated_YAML']).ljust(50)}\n``` |\n"
|
| 407 |
|
| 408 |
return markdown
|
| 409 |
|