diff --git a/parea/utils/universal_encoder.py b/parea/utils/universal_encoder.py index 9628a72b..c7c242be 100644 --- a/parea/utils/universal_encoder.py +++ b/parea/utils/universal_encoder.py @@ -110,16 +110,19 @@ def default(self, obj: Any): return str(obj) elif isinstance(obj, Decimal): return float(obj) - elif callable(obj): - return f"" - elif isinstance(obj, bytes): - return obj.decode(errors="ignore") elif is_numpy_instance(obj): return obj.tolist() elif is_pandas_instance(obj): return obj.to_dict(orient="records") elif dspy_response := self.handle_dspy_response(obj): return dspy_response + elif callable(obj): + try: + return f"" + except AttributeError: + return str(obj) + elif isinstance(obj, bytes): + return obj.decode(errors="ignore") else: return super().default(obj) diff --git a/pyproject.toml b/pyproject.toml index 23ad232f..abb0743d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "parea-ai" packages = [{ include = "parea" }] -version = "0.2.173" +version = "0.2.174" description = "Parea python sdk" readme = "README.md" authors = ["joel-parea-ai "]