From 639df144f50faa13b5aea166322c99898bf21323 Mon Sep 17 00:00:00 2001 From: paultancre-bt Date: Wed, 3 Jun 2026 12:58:14 +0100 Subject: [PATCH 1/3] feat(invoke): expose overrides field on invoke() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /function/invoke REST endpoint accepts an `overrides` field that deep-merges into the resolved function data server-side, but `invoke()` does not pass it through. The SDK destructures known fields and rebuilds the request, so the parameter was dropped before reaching the wire even via type assertion. Adds `overrides` to InvokeFunctionArgs and threads it through the request body. Purely additive — no schema or server changes. Documents the prompt-function limitation: overrides deep-merge into function_data only, so prompt parameters (which live on prompt_data) are not affected by this path. Pylon: braintrustdata/braintrust#17344 Co-Authored-By: Claude Opus 4.7 --- js/src/functions/invoke.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/src/functions/invoke.ts b/js/src/functions/invoke.ts index d56754d68..f7bbb35f5 100644 --- a/js/src/functions/invoke.ts +++ b/js/src/functions/invoke.ts @@ -111,6 +111,13 @@ export interface InvokeFunctionArgs< * if the variable names in the prompt do not match the input keys. */ strict?: boolean; + /** + * Per-call deep-merge into the resolved function data server-side. Useful for facet, + * code, global, and remote_eval functions (for example, overriding a facet's `model` + * or a global function's `config`). Has no effect on prompt functions, whose + * parameters live on a separate field that the override path does not touch. + */ + overrides?: Record; /** * A Zod schema to validate the output of the function and return a typed value. This * is only used if `stream` is false. @@ -159,6 +166,7 @@ export async function invoke( mode, schema, strict, + overrides, projectId, ...functionIdArgs } = args; @@ -204,6 +212,7 @@ export async function invoke( stream, mode, strict, + overrides, }; const headers: Record = { From deedbb9d7ad59d5704022ac4be4958cdfefaedba Mon Sep 17 00:00:00 2001 From: paultancre-bt Date: Wed, 3 Jun 2026 13:10:52 +0100 Subject: [PATCH 2/3] chore: add changeset for invoke overrides --- .changeset/invoke-overrides.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/invoke-overrides.md diff --git a/.changeset/invoke-overrides.md b/.changeset/invoke-overrides.md new file mode 100644 index 000000000..a29bbfce8 --- /dev/null +++ b/.changeset/invoke-overrides.md @@ -0,0 +1,5 @@ +--- +"braintrust": minor +--- + +feat(invoke): expose `overrides` field on `invoke()` so callers can deep-merge into the resolved function data server-side (facet, code, global, and remote_eval functions; no effect on prompt functions) From 1147d4b1cdc2a70c260593250b17f192ef4d4c49 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Wed, 3 Jun 2026 14:39:43 +0200 Subject: [PATCH 3/3] cs --- .changeset/invoke-overrides.md | 5 ----- .changeset/tidy-facts-admire.md | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 .changeset/invoke-overrides.md create mode 100644 .changeset/tidy-facts-admire.md diff --git a/.changeset/invoke-overrides.md b/.changeset/invoke-overrides.md deleted file mode 100644 index a29bbfce8..000000000 --- a/.changeset/invoke-overrides.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"braintrust": minor ---- - -feat(invoke): expose `overrides` field on `invoke()` so callers can deep-merge into the resolved function data server-side (facet, code, global, and remote_eval functions; no effect on prompt functions) diff --git a/.changeset/tidy-facts-admire.md b/.changeset/tidy-facts-admire.md new file mode 100644 index 000000000..c6414190a --- /dev/null +++ b/.changeset/tidy-facts-admire.md @@ -0,0 +1,5 @@ +--- +"braintrust": minor +--- + +feat(invoke): Allow passing `overrides` to `invoke()`