# Function transformStream

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

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

  Transforms stream chunks using a mapping function.

  #### Type Parameters

  - T
  - U

  #### Parameters

  - stream: AsyncIterable<T>

    The source stream

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

    Transformation function

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

    Options including optional AbortSignal

  #### Returns AsyncIterable<U>

  Transformed stream

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