# Function tapStream

Adapters exports - Model adapters (Claude, OpenAI, Gemini, Ollama) Split from index.ts for file size compliance (Issue #285)

- tapStream<T>(
  stream: AsyncIterable<T>,
  fn: (chunk: T, index: number) => void | Promise<void>,
  options?: { signal?: AbortSignal },
  ): AsyncIterable<T>

  Taps into a stream without modifying it (for side effects like logging).

  #### Type Parameters

  - T

  #### Parameters

  - stream: AsyncIterable<T>

    The source stream

  - fn: (chunk: T, index: number) => void | Promise<void>

    Side effect function called for each chunk

  - options: { signal?: AbortSignal } = {}

    Options including optional AbortSignal

  #### Returns AsyncIterable<T>

  Original stream unchanged

  - Defined in packages/nexus-agents/src/adapters/stream-operators-helpers.ts:119