From 67e20ce4427ea264c1aae4dcaab49b8e57b7df96 Mon Sep 17 00:00:00 2001 From: Quin Hoxie Date: Wed, 1 May 2024 14:25:08 -0700 Subject: [PATCH] fix(dspy): remove unreachable type condition in TypedPredictor --- dspy/functional/functional.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dspy/functional/functional.py b/dspy/functional/functional.py index 7624ac6f22..667c86d4bf 100644 --- a/dspy/functional/functional.py +++ b/dspy/functional/functional.py @@ -22,7 +22,7 @@ def _predictor(func) -> dspy.Module: return _StripOutput(TypedPredictor(signature, **kwargs), output_key) # if we have only a single callable argument, the decorator was invoked with no key word arguments - # so we just return the wrapped function + # so we just return the wrapped function if len(args) == 1 and callable(args[0]) and len(kwargs) == 0: return _predictor(args[0]) return _predictor @@ -36,7 +36,7 @@ def _cot(func) -> dspy.Module: return _StripOutput(TypedChainOfThought(signature, **kwargs), output_key) # if we have only a single callable argument, the decorator was invoked with no key word arguments - # so we just return the wrapped function + # so we just return the wrapped function if len(args) == 1 and callable(args[0]) and len(kwargs) == 0: return _cot(args[0]) return _cot @@ -217,7 +217,7 @@ def parse(x): format=lambda x: x if isinstance(x, str) else str(x), parser=parse, ) - elif type_ in (str, int, float, bool): + elif type_ in (str, int, float): signature = signature.with_updated_fields( name, desc=field.json_schema_extra.get("desc", "")