constructor({ stream, passThroughParams, onComplete }) {
    this.passThroughParams = passThroughParams
    this.stream = stream
    this.onComplete = onComplete
    this.segment = passThroughParams.segment

    const { bedrockCommand } = passThroughParams

    // Each model returns a unique-ish response stream. To handle this, we
    // attach a generator specific to the model that will process the stream
    // events and collect them into `this.response` such that `this.response`
    // ultimately has the shape of a non-streamed response that is expected
    // by BedrockResponse.
    //
    // Important: each of the handler function uses a `try/finally` block
    // to process the original stream. Of particular note is that there is NOT
    // a `catch` block. As of 2024-01-17, we are not able to determine a viable
    // means of inducing an error in the stream such that a `catch` block in
    // our wrapping handler would be hit.
    if (bedrockCommand.isClaude() === true) {
      this.stopReasonKey = 'stop_reason'
      this.generator = handleClaude
    } else if (bedrockCommand.isClaude3() === true) {
      this.stopReasonKey = 'stop_reason'
      this.generator = handleClaude3
    } else if (bedrockCommand.isCohere() === true) {
      this.stopReasonKey = 'generations.0.finish_reason'
      this.generator = handleCohere
    } else if (bedrockCommand.isCohereEmbed() === true) {
      this.stopReasonKey = 'nr_none'
      this.generator = handleCohereEmbed
    } else if (bedrockCommand.isLlama() === true) {
      this.stopReasonKey = 'stop_reason'
      this.generator = handleLlama
    } else if (bedrockCommand.isTitan() === true) {
      this.stopReasonKey = 'completionReason'
      this.generator = handleTitan
    } else {
      // The model doesn't support streaming, or we have not instrumented it.
      this.generator = stream
    }
  }
The function that will be invoked once the stream processing has finished.
It will receive `this.passThroughParams` as the only parameter.