Commit dfa37ff
fix: add strict mode support for OpenAI tool definitions in prompt-2025 endpoint (#5538)
* fix: add strict mode support for OpenAI tool definitions in prompt-2025 endpoint
Users were receiving a 422 Unprocessable Entity error when creating prompts
with tool definitions that include OpenAI's strict mode (strict: true) and
additionalProperties: false in the function parameters.
Changes:
- Add `strict` field to OpenAIChatRequest tools function interface
- Make `description` and `parameters` optional in tool function definition
to match OpenAI's API behavior
- Update internal Tool type to include `strict` property
- Update toExternalTools and convertTools functions to preserve the strict field
- Update TSOA validation schemas in routes.ts to accept strict mode
This allows prompts with tool calls using OpenAI's strict mode for function
calling to be created and validated correctly.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Hammad Shami <hammad@helicone.ai>
* fix: handle optional description in tool conversion functions
Fix TypeScript compilation errors by providing default empty string
when tool.description is undefined in toExternalTools functions for
Anthropic and OpenAI responses mappers.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* auto generated file commit
* Revert "fix: handle optional description in tool conversion functions"
This reverts commit 00ce337. The nullish coalescing changes were not
necessary - the actual fix was regenerating the TSOA routes files to
pick up the updated type definitions.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: handle optional description in tool conversion functions
Since the Tool interface's description field is now optional (string | undefined),
the toExternalTools functions need to provide a default empty string when
converting to external API types that expect a required string field.
This fixes TypeScript compilation errors in anthropic/chat-v2.ts and
openai/responses.ts mappers.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: replicas-connector[bot] <replicas-connector[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Hammad Shami <hammad@helicone.ai>1 parent 7e146fa commit dfa37ff
File tree
14 files changed
+62
-37
lines changed- bifrost/lib/clients/jawnTypes
- docs
- helicone-mcp/src/types
- packages/llm-mapper
- mappers
- anthropic
- openai
- valhalla/jawn/src/tsoa-build
- private
- public
- web/lib/clients/jawnTypes
14 files changed
+62
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1621 | 1621 | | |
1622 | 1622 | | |
1623 | 1623 | | |
1624 | | - | |
1625 | | - | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
1626 | 1627 | | |
1627 | 1628 | | |
1628 | 1629 | | |
| |||
2041 | 2042 | | |
2042 | 2043 | | |
2043 | 2044 | | |
2044 | | - | |
| 2045 | + | |
2045 | 2046 | | |
| 2047 | + | |
2046 | 2048 | | |
2047 | 2049 | | |
2048 | 2050 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1189 | 1189 | | |
1190 | 1190 | | |
1191 | 1191 | | |
1192 | | - | |
1193 | | - | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
1194 | 1195 | | |
1195 | 1196 | | |
1196 | 1197 | | |
| |||
2117 | 2118 | | |
2118 | 2119 | | |
2119 | 2120 | | |
2120 | | - | |
| 2121 | + | |
2121 | 2122 | | |
| 2123 | + | |
2122 | 2124 | | |
2123 | 2125 | | |
2124 | 2126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1346 | 1346 | | |
1347 | 1347 | | |
1348 | 1348 | | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
1349 | 1352 | | |
1350 | 1353 | | |
1351 | 1354 | | |
| |||
1357 | 1360 | | |
1358 | 1361 | | |
1359 | 1362 | | |
1360 | | - | |
1361 | | - | |
1362 | 1363 | | |
1363 | 1364 | | |
1364 | 1365 | | |
| |||
4893 | 4894 | | |
4894 | 4895 | | |
4895 | 4896 | | |
| 4897 | + | |
| 4898 | + | |
| 4899 | + | |
4896 | 4900 | | |
4897 | 4901 | | |
4898 | 4902 | | |
4899 | | - | |
4900 | | - | |
| 4903 | + | |
4901 | 4904 | | |
4902 | 4905 | | |
4903 | 4906 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1189 | 1189 | | |
1190 | 1190 | | |
1191 | 1191 | | |
1192 | | - | |
1193 | | - | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
1194 | 1195 | | |
1195 | 1196 | | |
1196 | 1197 | | |
| |||
2117 | 2118 | | |
2118 | 2119 | | |
2119 | 2120 | | |
2120 | | - | |
| 2121 | + | |
2121 | 2122 | | |
| 2123 | + | |
2122 | 2124 | | |
2123 | 2125 | | |
2124 | 2126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
294 | 295 | | |
295 | 296 | | |
296 | 297 | | |
297 | | - | |
| 298 | + | |
| 299 | + | |
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
| |||
311 | 313 | | |
312 | 314 | | |
313 | 315 | | |
| 316 | + | |
314 | 317 | | |
315 | 318 | | |
316 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
562 | 562 | | |
563 | 563 | | |
564 | 564 | | |
565 | | - | |
| 565 | + | |
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
229 | 229 | | |
| 230 | + | |
230 | 231 | | |
231 | 232 | | |
232 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
933 | 933 | | |
934 | 934 | | |
935 | 935 | | |
936 | | - | |
| 936 | + | |
937 | 937 | | |
938 | 938 | | |
939 | 939 | | |
| |||
1256 | 1256 | | |
1257 | 1257 | | |
1258 | 1258 | | |
1259 | | - | |
| 1259 | + | |
1260 | 1260 | | |
| 1261 | + | |
1261 | 1262 | | |
1262 | 1263 | | |
1263 | 1264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3262 | 3262 | | |
3263 | 3263 | | |
3264 | 3264 | | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
3265 | 3268 | | |
3266 | 3269 | | |
3267 | 3270 | | |
| |||
3273 | 3276 | | |
3274 | 3277 | | |
3275 | 3278 | | |
3276 | | - | |
3277 | | - | |
3278 | 3279 | | |
3279 | 3280 | | |
3280 | 3281 | | |
| |||
4750 | 4751 | | |
4751 | 4752 | | |
4752 | 4753 | | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
4753 | 4757 | | |
4754 | 4758 | | |
4755 | 4759 | | |
4756 | | - | |
4757 | | - | |
| 4760 | + | |
4758 | 4761 | | |
4759 | 4762 | | |
4760 | 4763 | | |
| |||
0 commit comments