Commit 9215c7c
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>1 parent 1ab78af commit 9215c7c
File tree
4 files changed
+10
-6
lines changed- packages/llm-mapper
- mappers/openai
- valhalla/jawn/src/tsoa-build
- private
- public
4 files changed
+10
-6
lines changed| 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 | |
|---|---|---|---|
| |||
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 | |
|---|---|---|---|
| |||
931 | 931 | | |
932 | 932 | | |
933 | 933 | | |
934 | | - | |
| 934 | + | |
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
| 499 | + | |
500 | 500 | | |
501 | 501 | | |
502 | 502 | | |
| |||
0 commit comments