# Function filterStream

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

- filterStream<T>(
  stream: AsyncIterable<T>,
  predicate: (chunk: T, index: number) => boolean | Promise<boolean>,
  options?: { signal?: AbortSignal },
  ): AsyncIterable<T>

  Filters stream chunks based on a predicate.

  #### Type Parameters

  - T

  #### Parameters

  - stream: AsyncIterable<T>

    The source stream

  - predicate: (chunk: T, index: number) => boolean | Promise<boolean>

    Function that returns true to keep the chunk

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

    Options including optional AbortSignal

  #### Returns AsyncIterable<T>

  Filtered stream

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