Interface: InvokeFunctionArgs<Input, Output, Stream>
Arguments for the invoke
function.
Type parameters
Name | Type |
---|---|
Input | Input |
Output | Output |
Stream | extends boolean = false |
Properties
function_id
• Optional
function_id: string
The ID of the function to invoke.
global_function
• Optional
global_function: 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.
project_name
• Optional
project_name: string
The name of the project containing the function to invoke.
prompt_session_function_id
• Optional
prompt_session_function_id: string
The ID of the function in the prompt session to invoke.
prompt_session_id
• Optional
prompt_session_id: 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.