providerplaneai
    Preparing search index...
    • Wraps a streaming provider call with request-scoped tracing metadata.

      This helper:

      • Generates a unique requestId
      • Captures start time
      • Injects request context into the AIRequest
      • Attaches timing and request metadata to each streamed chunk

      Designed for streaming chat, image generation, or any provider API that emits incremental results.

      Type Parameters

      • TInput

        The input payload type sent to the provider.

      • TOutput

        The output payload type for each streamed chunk.

      Parameters

      Returns AsyncGenerator<AIResponseChunk<TOutput>>

      An async generator emitting response chunks with metadata attached.