We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b0564f commit 926fccbCopy full SHA for 926fccb
src/humanloop/decorators/tool.py
@@ -116,7 +116,13 @@ def _build_tool_kernel(
116
strict: bool,
117
) -> ToolKernelRequestParams:
118
"""Build ToolKernelRequest object from decorated function."""
119
- source_code = textwrap.dedent(inspect.getsource(func))
+ try:
120
+ source_code = textwrap.dedent(inspect.getsource(func))
121
+ except TypeError as e:
122
+ raise TypeError(
123
+ f"Cannot extract source code for function {func.__name__}. "
124
+ "Try decorating a plain function instead of a partial for example."
125
+ ) from e
126
# Remove decorator from source code by finding first 'def'
127
# This makes the source_code extraction idempotent whether
128
# the decorator is applied directly or used as a higher-order
0 commit comments