Interface for callbacks used in parallel chat completions

interface ParallelChatCompletionsCallbacks {
    OnAllCompleted?: ((responses) => void);
    OnCompletion?: ((response, index) => void);
    OnError?: ((error, index) => void);
}

Properties

OnAllCompleted?: ((responses) => void)

Called when all completions in the batch are completed (successfully or with errors)

Type declaration

    • (responses): void
    • Parameters

      • responses: ChatResult[]

        Array of all ChatResults in the same order as the request params

      Returns void

OnCompletion?: ((response, index) => void)

Called when a single completion from the batch is completed

Type declaration

    • (response, index): void
    • Parameters

      • response: ChatResult

        The completed ChatResult

      • index: number

        The index of the completion in the original request array

      Returns void

OnError?: ((error, index) => void)

Called when any completion in the batch encounters an error

Type declaration

    • (error, index): void
    • Parameters

      • error: any

        The error that occurred

      • index: number

        The index of the completion that failed

      Returns void