Commit d7c272b
committed
fix: Use convert_tooldef_to_openai_tool for function tool serialization
The Responses API function tool conversion used model_dump() to build
the ChatCompletionToolParam function dict, which leaked the "type"
field (and would leak any future fields like defer_loading) into the
FunctionDefinition. OpenAI silently ignores extra fields, but stricter
endpoints (e.g. Gemini) reject them.
Instead of a fragile denylist (exclude={"type"}), reuse
convert_tooldef_to_openai_tool which explicitly picks only the fields
that belong in a FunctionDefinition. Added strict parameter support to
convert_tooldef_to_openai_tool so function tools can pass it through.
Signed-off-by: Dan Prince <dprince@redhat.com>1 parent be260b4 commit d7c272b
3 files changed
Lines changed: 52 additions & 10 deletions
File tree
- src/ogx/providers
- inline/responses/builtin/responses
- utils/inference
- tests/unit/providers/responses/builtin
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1570 | 1570 | | |
1571 | 1571 | | |
1572 | 1572 | | |
1573 | | - | |
1574 | | - | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
1575 | 1578 | | |
| 1579 | + | |
1576 | 1580 | | |
1577 | 1581 | | |
1578 | 1582 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
| |||
Lines changed: 40 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
678 | 679 | | |
679 | 680 | | |
680 | 681 | | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | 682 | | |
685 | 683 | | |
686 | 684 | | |
| |||
781 | 779 | | |
782 | 780 | | |
783 | 781 | | |
784 | | - | |
785 | | - | |
786 | 782 | | |
787 | 783 | | |
788 | 784 | | |
| |||
837 | 833 | | |
838 | 834 | | |
839 | 835 | | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | 836 | | |
844 | 837 | | |
845 | 838 | | |
| |||
963 | 956 | | |
964 | 957 | | |
965 | 958 | | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
0 commit comments