DSPy: The framework for programming—not prompting—language models
Python
Some type improvements for floats
Thomas D Ahle1c0c47190f75
diff --git a/dspy/functional/functional.py b/dspy/functional/functional.pyindex f349fa2e4..d6e2e3dba 100644--- a/dspy/functional/functional.py+++ b/dspy/functional/functional.py@@ -104,7 +104,7 @@ class TypedPredictor(dspy.Module):signature = signature.with_updated_fields(name,desc=field.json_schema_extra.get("desc", "")- + (f". Respond with a single {type_.__name__} value"),+ + (f" (Respond with a single {type_.__name__} value)" if type_ != str else ""),format=lambda x: x if isinstance(x, str) else str(x),parser=type_,)@@ -195,7 +195,7 @@ def _format_error(error: Exception):errors.append(f"{e['msg']}: {fields} (error type: {e['type']})")return "; ".join(errors)else:- return str(error)+ return repr(error)def _func_to_signature(func):