DSPy: The framework for programming—not prompting—language models
Python
revert from match-case to if-else for python 3.9 compatibility
Herumb Shandilya35b50bf84c0c
diff --git a/dspy/teleprompt/avatar_optimizer.py b/dspy/teleprompt/avatar_optimizer.pyindex 23c4aa7c9..4e441971f 100644--- a/dspy/teleprompt/avatar_optimizer.py+++ b/dspy/teleprompt/avatar_optimizer.py@@ -106,20 +106,18 @@ class AvatarOptimizer(Teleprompter):prediction = actor(**example.inputs().toDict())score = self.metric(example, prediction)- match return_outputs:- case True:- return example, prediction, score- case False:- return score+ if return_outputs:+ return example, prediction, score+ else:+ return scoreexcept Exception as e:print(e)- match return_outputs:- case True:- return example, None, 0- case False:- return 0+ if return_outputs:+ return example, None, 0+ else:+ return 0def multi_thread_executor(self, devset, actor, return_outputs=False, num_threads=60):