Skip to main content

Type Alias: AiMapResult<TOut>

AiMapResult<TOut> = { attempts: number; cost: number; id: string; index: number; inputTokens: number; outputTokens: number; result: TOut; status: "succeeded"; validated: boolean; } | { attempts: number; cost: number; error: string; errorName?: string; id: string; index: number; inputTokens: number; outputTokens: number; status: "failed"; }

Defined in: packages/workflow-engine/src/core/step-ai.ts:105

Type Parameters​

TOut​

TOut

Union Members​

Type Literal​

{ attempts: number; cost: number; id: string; index: number; inputTokens: number; outputTokens: number; result: TOut; status: "succeeded"; validated: boolean; }

attempts​

attempts: number

Model calls made for this item across batch and realtime attempts.

cost​

cost: number

Sum of the recorded cost of every attempt for this item.

id​

id: string

index​

index: number

inputTokens​

inputTokens: number

outputTokens​

outputTokens: number

result​

result: TOut

status​

status: "succeeded"

validated​

validated: boolean

True when a schema was given and the result passed it.


Type Literal​

{ attempts: number; cost: number; error: string; errorName?: string; id: string; index: number; inputTokens: number; outputTokens: number; status: "failed"; }

attempts​

attempts: number

cost​

cost: number

error​

error: string

errorName?​

optional errorName?: string

Error.name of the last failure, so a caller can tell a transport or quota error apart from a content failure without matching on the message. The batch path reports StepTimeoutError, AiMapBatchFailedError, AiMapBatchItemFailedError or AiMapBatchItemMissingError. Never carries the error cause: map results are stored in the step ledger and must stay JSON.

id​

id: string

index​

index: number

inputTokens​

inputTokens: number

outputTokens​

outputTokens: number

status​

status: "failed"