# Class AzureOpenAiChatCompletionStream<Item>

Chat completion stream containing post-processing functions.

#### Type Parameters

- Item

#### Hierarchy (View Summary)

- SseStream<Item>
  - AzureOpenAiChatCompletionStream

- Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:9

##### Index

### Constructors

constructor

### Properties

controller
iterator

### Methods

_pipe
[asyncIterator]
toContentStream
_create
_processChunk
_processContentStream
_processFinishReason
_processTokenUsage
_processToolCalls
transformToSseStream

## Constructors

### constructor

- new AzureOpenAiChatCompletionStream<Item>(
  iterator: () => AsyncIterator<Item>,
  controller: AbortController,
  ): AzureOpenAiChatCompletionStream<Item>

  #### Type Parameters

  - Item

  #### Parameters

  - iterator: () => AsyncIterator<Item>
  - controller: AbortController

  #### Returns AzureOpenAiChatCompletionStream<Item>

  Overrides SseStream.constructor

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:43

## Properties

### controller

controller: AbortController

Inherited from SseStream.controller

- Defined in packages/core/dist/stream/sse-stream.d.ts:9

### iterator

iterator: () => AsyncIterator<Item>

Overrides SseStream.iterator

- Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:10

## Methods

### _pipe

- _pipe<TReturn>(
  processFn: (
  stream: AzureOpenAiChatCompletionStream<Item>,
  response?: AzureOpenAiChatCompletionStreamResponse<any>,
  ) => AsyncIterator<TReturn>,
  response?: AzureOpenAiChatCompletionStreamResponse<any>,
  ): AzureOpenAiChatCompletionStream<TReturn>
  `Internal`

  Pipe the stream through a processing function.

  #### Type Parameters

  - TReturn

  #### Parameters

  - processFn: (
    stream: AzureOpenAiChatCompletionStream<Item>,
    response?: AzureOpenAiChatCompletionStreamResponse<any>,
    ) => AsyncIterator<TReturn>

    The function to process the input stream.

  - `Optional` response: AzureOpenAiChatCompletionStreamResponse<any>

    The `AzureOpenAiChatCompletionStreamResponse` object for process function to store finish reason, token usage, etc.

  #### Returns AzureOpenAiChatCompletionStream<TReturn>

  The output stream containing processed items.

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:51

### [asyncIterator]

- "[asyncIterator]"(): AsyncIterator<Item>

  #### Returns AsyncIterator<Item>

  Inherited from SseStream.[asyncIterator]

  - Defined in packages/core/dist/stream/sse-stream.d.ts:11

### toContentStream

- toContentStream(
  this: AzureOpenAiChatCompletionStream<
  AzureOpenAiChatCompletionStreamChunkResponse,
  >,
  choiceIndex?: number,
  ): AzureOpenAiChatCompletionStream<string>

  #### Parameters

  - this: AzureOpenAiChatCompletionStream<AzureOpenAiChatCompletionStreamChunkResponse>
  - `Optional` choiceIndex: number

  #### Returns AzureOpenAiChatCompletionStream<string>

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:52

### `Static`_create

- _create(
  response: HttpResponse,
  controller: AbortController,
  ): AzureOpenAiChatCompletionStream<
  AzureOpenAiCreateChatCompletionStreamResponse,
  >
  `Internal`

  Create a chat completion stream based on the http response.

  #### Parameters

  - response: HttpResponse

    Http response.

  - controller: AbortController

  #### Returns AzureOpenAiChatCompletionStream<AzureOpenAiCreateChatCompletionStreamResponse>

  Chat completion stream.

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:17

### `Static`_processChunk

- _processChunk(
  stream: AzureOpenAiChatCompletionStream<
  AzureOpenAiCreateChatCompletionStreamResponse,
  >,
  ): AsyncGenerator<AzureOpenAiChatCompletionStreamChunkResponse>
  `Internal`

  Wrap raw chunk data with chunk response class to provide helper functions.

  #### Parameters

  - stream: AzureOpenAiChatCompletionStream<AzureOpenAiCreateChatCompletionStreamResponse>

    Chat completion stream.

  #### Returns AsyncGenerator<AzureOpenAiChatCompletionStreamChunkResponse>

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:23

### `Static`_processContentStream

- _processContentStream(
  stream: AzureOpenAiChatCompletionStream<
  AzureOpenAiChatCompletionStreamChunkResponse,
  >,
  choiceIndex?: number,
  ): AsyncGenerator<string>
  `Internal`

  Transform a stream of chunks into a stream of content strings.

  #### Parameters

  - stream: AzureOpenAiChatCompletionStream<AzureOpenAiChatCompletionStreamChunkResponse>

    Chat completion stream.

  - `Optional` choiceIndex: number

    The index of the choice to parse.

    Copyright Ⓒ 2026 SAP SE or an SAP affiliate company. All rights reserved.

  #### Returns AsyncGenerator<string>

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:42

### `Static`_processFinishReason

- _processFinishReason(
  stream: AzureOpenAiChatCompletionStream<
  AzureOpenAiChatCompletionStreamChunkResponse,
  >,
  response?: AzureOpenAiChatCompletionStreamResponse<
  AzureOpenAiChatCompletionStreamChunkResponse,
  >,
  ): AsyncGenerator<AzureOpenAiChatCompletionStreamChunkResponse>
  `Internal`

  #### Parameters

  - stream: AzureOpenAiChatCompletionStream<AzureOpenAiChatCompletionStreamChunkResponse>
  - `Optional` response: AzureOpenAiChatCompletionStreamResponse<
    AzureOpenAiChatCompletionStreamChunkResponse,
    >

  #### Returns AsyncGenerator<AzureOpenAiChatCompletionStreamChunkResponse>

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:31

### `Static`_processTokenUsage

- _processTokenUsage(
  stream: AzureOpenAiChatCompletionStream<
  AzureOpenAiChatCompletionStreamChunkResponse,
  >,
  response?: AzureOpenAiChatCompletionStreamResponse<
  AzureOpenAiChatCompletionStreamChunkResponse,
  >,
  ): AsyncGenerator<AzureOpenAiChatCompletionStreamChunkResponse>
  `Internal`

  #### Parameters

  - stream: AzureOpenAiChatCompletionStream<AzureOpenAiChatCompletionStreamChunkResponse>
  - `Optional` response: AzureOpenAiChatCompletionStreamResponse<
    AzureOpenAiChatCompletionStreamChunkResponse,
    >

  #### Returns AsyncGenerator<AzureOpenAiChatCompletionStreamChunkResponse>

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:35

### `Static`_processToolCalls

- _processToolCalls(
  stream: AzureOpenAiChatCompletionStream<
  AzureOpenAiChatCompletionStreamChunkResponse,
  >,
  response?: AzureOpenAiChatCompletionStreamResponse<
  AzureOpenAiChatCompletionStreamChunkResponse,
  >,
  ): AsyncGenerator<AzureOpenAiChatCompletionStreamChunkResponse>
  `Internal`

  #### Parameters

  - stream: AzureOpenAiChatCompletionStream<AzureOpenAiChatCompletionStreamChunkResponse>
  - `Optional` response: AzureOpenAiChatCompletionStreamResponse<
    AzureOpenAiChatCompletionStreamChunkResponse,
    >

  #### Returns AsyncGenerator<AzureOpenAiChatCompletionStreamChunkResponse>

  - Defined in packages/foundation-models/dist/azure-openai/azure-openai-chat-completion-stream.d.ts:27

### `Protected` `Static` transformToSseStream

- transformToSseStream<Item>(
  response: HttpResponse,
  controller: AbortController,
  ): SseStream<Item>

  #### Type Parameters

  - Item

  #### Parameters

  - response: HttpResponse
  - controller: AbortController

  #### Returns SseStream<Item>

  Inherited from SseStream.transformToSseStream

  - Defined in packages/core/dist/stream/sse-stream.d.ts:8