Skip to content

[Microsoft.Extensions.AI.OpenAI] Azure prompt annotation causes empty ModelId throughout Chat Completions stream #7812

Closed

Description

@mattleibow

Problem

OpenAI.Chat.ChatClient.AsIChatClient() returns an empty ChatResponseUpdate.ModelId throughout an Azure OpenAI Chat Completions stream when the first event is a prompt-filter annotation with "model":"".

Confirmed with live calls using Microsoft.Extensions.AI.OpenAI 10.10.1 + OpenAI 2.14.0, and also 10.4.1 + 2.9.1. Single responses contain the model ID. This report concerns the Chat Completions adapter, not the Responses API adapter.

Reproduction shape

Azure sends an initial annotation with model: "", id: "", and choices: [], followed by normal completion chunks with a populated model. In the live test:

  • Native SDK: initial Model == ""; subsequent completion chunks consistently report gpt-4o-2024-08-06.
  • MEAI adapter: ModelId == "" on every update, including text updates.

Cause / expected behavior

OpenAIChatClient.FromOpenAIStreamingChatCompletionAsync caches the model with:

modelId ??= update.Model;

The initial empty string is non-null, so later real model IDs cannot replace it. Please ignore empty model values while acquiring the cached ID, then preserve the populated ID on subsequent updates. The initial annotation may legitimately remain unidentified; no fallback model ID is needed.

A credential-free regression can feed the annotation above followed by a normal completion chunk and assert that the latter's ChatResponseUpdate.ModelId is populated.

Related: #7790 / #7792 concern a separate null-delta annotation crash, not this model-ID caching issue.

Activity

  1. added a commit that references this issue on Oct 10, 2026
    daf1074
  2. locked and limited conversation to collaborators on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-aiMicrosoft.Extensions.AI libraries

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions