Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Refactor exception handling in ReAct class

Tom Dörrdaedd430c9cc
diff --git a/dspy/predict/react.py b/dspy/predict/react.py
index 5077d7219..feda67aec 100644
--- a/dspy/predict/react.py
+++ b/dspy/predict/react.py
@@ -95,7 +95,7 @@ class ReAct(Module):
# Handle the case where 'passages' attribute is missing
output[f"Observation_{hop+1}"] = getattr(result, "passages", result)
- except Exception as e:
+ except Exception:
output[f"Observation_{hop+1}"] = (
"Failed to parse action. Bad formatting or incorrect action name."
)