Hook Output Type Reference
The HookOutput
type defines the return type for BAML React hooks.
Type Parameters
The name of the BAML function being called. Used to infer input and output types.
Configuration object that determines streaming behavior. Defaults to { stream?: true }
.
Properties
The current response data. For streaming hooks, this contains either the latest streaming response or the final response. For non-streaming hooks, this only contains the final response.
The final response data. Only set when the request completes successfully.
The latest streaming response. Only available when Options['stream']
is true.
Any error that occurred during the request. See Error Types.
True if the request resulted in an error.
True if the request is in progress (either pending or streaming).
True if the request is pending (not yet streaming or completed).
True if the request completed successfully.
True if the request is currently streaming data. Only available when Options['stream']
is true.
The current status of the request. For streaming hooks: ‘idle’ | ‘pending’ | ‘streaming’ | ‘success’ | ‘error’. For non-streaming hooks: ‘idle’ | ‘pending’ | ‘success’ | ‘error’.
Function to trigger the BAML action. Returns a ReadableStream for streaming hooks, or a Promise of the final response for non-streaming hooks.
Function to reset the hook state back to its initial values.