Allow propagating a 'strict' argument in the JS SDK to fail invalid prompts - #621
Merged
Conversation
Ankur Goyal (ankrgyl)
requested review from
Hurshal Patel (choochootrain),
Manu Goyal (manugoyal) and
Sachin Padmanabhan (sachinpad)
March 30, 2025 20:21
Hurshal Patel (choochootrain)
approved these changes
Mar 31, 2025
| let curr: unknown = row; | ||
| for (const p of path) { | ||
| if (!isObjectOrArray(curr)) { | ||
| return null; |
Contributor
There was a problem hiding this comment.
nit: probably want to return undefined to disambiguate from a path with a value of null
| for (const strict of [true, false]) { | ||
| for (const shouldFail of [true, false]) { | ||
| for (const testNull of [true, false]) { | ||
| testPromptBuild({ |
Contributor
There was a problem hiding this comment.
should we add a nested object and array path test in the template as well?
Sachin Padmanabhan (sachinpad)
approved these changes
Mar 31, 2025
Sachin Padmanabhan (sachinpad)
left a comment
Contributor
There was a problem hiding this comment.
Cool! Should we add it in Python too?
Contributor
Author
|
Not yet. |
6 tasks
Luca Forstner (lforst)
added a commit
that referenced
this pull request
Jun 3, 2026
## Summary - Add `overrides` field to `InvokeFunctionArgs` and pass it through in the request body to `/function/invoke`. ## Context The `/function/invoke` REST endpoint accepts an `overrides` field that deep-merges into the resolved function data server-side (see `applyFunctionDataOverrides` in `api-ts/src/proxy/call.ts`). The wire schema in `generated_types.ts` includes `overrides`, and the proxy applies it, but the SDK destructures known fields and rebuilds the request, so the parameter was dropped before reaching the wire even via type assertion. The change is purely additive — no schema or server changes. Mirrors how `strict` was added in #621. **Limitation:** overrides deep-merge into `function_data` only. Prompt-type functions have their parameters (model, options.params, messages, tool_functions, etc.) on a separate `prompt_data` field that the override path does not touch — for prompt functions this passthrough has no effect. The JSDoc on the new field documents this. The matching docs PR (braintrustdata/braintrust#15157) documents the same limitation user-facing. Related Pylon ticket: braintrustdata/braintrust#17344. ## Test plan - [x] `pnpm run fix:formatting` — clean - [x] `pnpm run lint` — 0 errors (pre-existing warnings only) - [x] `npx tsc --noEmit -p .` — passes - [x] `npx vitest run src/functions/invoke.test.ts` — 5/5 passing - [x] `npx vitest run src/logger.test.ts -t loadPrompt` — passes - [ ] CI green --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: Luca Forstner <luca.forstner@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.