diff --git a/evoprompt/evolution/evolution.py b/evoprompt/evolution/evolution.py index b5d71f9739eaea6ca182df6be221b17380a087ed..7eae7c2af18d1fbd7fc1eb4e6852f64a66f13e28 100644 --- a/evoprompt/evolution/evolution.py +++ b/evoprompt/evolution/evolution.py @@ -426,6 +426,13 @@ class DifferentialEvolution(EvolutionAlgorithm): if evolved_prompt is None: logger.info(f"Could not extract prompt from response: {evolved_prompt}") + + # no prompt was returned (e.g., evolved prompt could not be extracted), therefore, for DE, we use the basic prompt + return ( + prompts_current_evolution[current_iteration].content, + [judgement], + usage, + ) else: logger.info( "DE-evolved prompts '%s', '%s' and '%s' with basic prompt '%s' into '%s'", @@ -569,6 +576,13 @@ class DifferentialEvolutionWithCot(DifferentialEvolution): if evolved_prompt is None: logger.info(f"Could not extract prompt from response: {evolved_prompt}") + + # no prompt was returned (e.g., evolved prompt could not be extracted), therefore, for DE, we use the basic prompt + return ( + prompts_current_evolution[current_iteration].content, + judgements, + usage, + ) else: logger.info( "DE-evolved prompts '%s', '%s' and '%s' with basic prompt '%s' into '%s'",