providerplaneai
    Preparing search index...

    Interface contract for AIClientLifecycleHooks.

    interface AIClientLifecycleHooks {
        onAttemptFailure?: (result: ProviderAttemptResult) => void;
        onAttemptStart?: (ctx: ProviderAttemptContext) => void;
        onAttemptSuccess?: (result: ProviderAttemptResult) => void;
        onChunkEmitted?: (
            chunkMetrics: {
                capability: CapabilityKeyType;
                chunkIndex: number;
                chunkTimeMs: number;
                connectionName?: string;
                providerType: AIProviderType;
            },
        ) => void;
        onExecutionEnd?: (
            capability: CapabilityKeyType,
            providerChain: ProviderRef[],
        ) => void;
        onExecutionFailure?: (
            capability: CapabilityKeyType,
            providerChain: ProviderRef[],
            errors: ProviderAttemptResult[],
        ) => void;
        onExecutionStart?: (
            capability: CapabilityKeyType,
            providerChain: ProviderRef[],
        ) => void;
    }
    Index

    Properties

    onAttemptFailure?: (result: ProviderAttemptResult) => void

    Called when a provider attempt fails

    onAttemptStart?: (ctx: ProviderAttemptContext) => void

    Called when a provider attempt starts

    onAttemptSuccess?: (result: ProviderAttemptResult) => void

    Called when a provider attempt completes successfully

    onChunkEmitted?: (
        chunkMetrics: {
            capability: CapabilityKeyType;
            chunkIndex: number;
            chunkTimeMs: number;
            connectionName?: string;
            providerType: AIProviderType;
        },
    ) => void

    Called each time a chunk is emitted to the consumer (may be buffered by orchestration).

    onExecutionEnd?: (
        capability: CapabilityKeyType,
        providerChain: ProviderRef[],
    ) => void

    Called once at the end of execution (success or failure).

    onExecutionFailure?: (
        capability: CapabilityKeyType,
        providerChain: ProviderRef[],
        errors: ProviderAttemptResult[],
    ) => void

    Called once if the entire execution fails (all providers fail)

    onExecutionStart?: (
        capability: CapabilityKeyType,
        providerChain: ProviderRef[],
    ) => void

    Called once at the start of an execution