From 24116c96fd0ce87a1c3fc90cabaafe828d5d9b8e Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Mon, 15 Jul 2024 14:14:57 -0400 Subject: [PATCH] Fixed Bug Nicholas found during our call. The error was a missing tag in output, but that error wasn't making it into LLM prompt, so couldn't fix --- management/recipe_sync.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/management/recipe_sync.py b/management/recipe_sync.py index 638e91c4..5d39bef5 100644 --- a/management/recipe_sync.py +++ b/management/recipe_sync.py @@ -1020,6 +1020,8 @@ def create_new_recipe(recipe_intent, recipe_author): print("Running recipe to capture errors for LLM ...") result = run_recipe(recipe_path) + print("JJJJJJ") + sys.exit() print(result.stderr) # If there was an error, call edit recipe to try and fix it one round @@ -1338,12 +1340,14 @@ def run_recipe(recipe_path): # Extract output if output_start_string in result.stdout: output = result.stdout.split(output_start_string)[1] + # output is JSON + validate_output(output) + output = json.loads(output) else: - raise ValueError("Output of recipe must contain 'OUTPUT:'") - - # output is JSON - validate_output(output) - output = json.loads(output) + error_str = "ERROR: Output of recipe must contain 'OUTPUT:'" + print(error_str) + result.stderr += f"\n\n{error_str}" + output = {} recipe_folder = os.path.dirname(recipe_path)