Commit d752baf
committed
fix: support functools.partial objects as tools in t_tool()
Fixes #907
inspect.isfunction() returns False for functools.partial objects, so
passing a partial to tools= would silently fall through to the else
branch and return the partial object unchanged. The API then received
an invalid tool object and rejected it with 400 INVALID_ARGUMENT.
Add functools.partial to the callable check so partial functions get
wrapped in a FunctionDeclaration the same way regular functions do.1 parent 2afdeff commit d752baf
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
959 | 960 | | |
960 | 961 | | |
961 | 962 | | |
962 | | - | |
| 963 | + | |
963 | 964 | | |
964 | 965 | | |
965 | 966 | | |
| |||
0 commit comments