Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tidy-facts-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": minor
---

feat(invoke): Allow passing `overrides` to `invoke()`
9 changes: 9 additions & 0 deletions js/src/functions/invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>;
/**
* A Zod schema to validate the output of the function and return a typed value. This
* is only used if `stream` is false.
Expand Down Expand Up @@ -159,6 +166,7 @@ export async function invoke<Input, Output, Stream extends boolean = false>(
mode,
schema,
strict,
overrides,
projectId,
...functionIdArgs
} = args;
Expand Down Expand Up @@ -204,6 +212,7 @@ export async function invoke<Input, Output, Stream extends boolean = false>(
stream,
mode,
strict,
overrides,
};

const headers: Record<string, string> = {
Expand Down
Loading