Reference/SDK/Typescript/Interfaces

Interface: InvokeFunctionArgs<Input, Output, Stream>

Arguments for the invoke function.

Type parameters

NameType
InputInput
OutputOutput
Streamextends boolean = false

Properties

function_id

Optional function_id: string

The ID of the function to invoke.


globalFunction

Optional globalFunction: string

The name of the global function to invoke.


input

input: Input

The input to the function. This will be logged as the input field in the span.


parent

Optional parent: string | Exportable

The parent of the function. This can be an existing span, logger, or experiment, or the output of .export() if you are distributed tracing. If unspecified, will use the same semantics as traced() to determine the parent and no-op if not in a tracing context.


projectName

Optional projectName: string

The name of the project containing the function to invoke.


promptSessionFunctionId

Optional promptSessionFunctionId: string

The ID of the function in the prompt session to invoke.


promptSessionId

Optional promptSessionId: string

The ID of the prompt session to invoke the function from.


schema

Optional schema: Stream extends true ? never : ZodType<Output, ZodTypeDef, Output>

A Zod schema to validate the output of the function and return a typed value. This is only used if stream is false.


slug

Optional slug: string

The slug of the function to invoke.


state

Optional state: BraintrustState

(Advanced) This parameter allows you to pass in a custom login state. This is useful for multi-tenant environments where you are running functions from different Braintrust organizations.


stream

Optional stream: Stream

Whether to stream the function's output. If true, the function will return a BraintrustStream, otherwise it will return the output of the function as a JSON object.


version

Optional version: string

The version of the function to invoke.

On this page