AzureOpenAIModelFactory StreamingChatCompletions throws System NullReferenceException

65 views Asked by At

Calling the AzureOpenAIModelFactory.StreamingChatCompletions() method never works and always results in an immediate System.NullReferenceException.

This seems to be due to the internal constructor calling .Add() on a private field that hasn't been initialized at that point.

public class StreamingChatCompletions : IDisposable
{
    private readonly IList<ChatCompletions> _baseChatCompletions;

    //...
        
    internal StreamingChatCompletions(
            ChatCompletions baseChatCompletions = null,
            List<StreamingChatChoice> streamingChatChoices = null)
    {
        _baseChatCompletions.Add(baseChatCompletions);
        _streamingChatChoices = streamingChatChoices;
        _streamingTaskComplete = true;
    }
}
1

There are 1 answers

0
Ram On BEST ANSWER

AzureOpenAIModelFactory class seems to use the one that does not initialize the variable that is causing the nullreference. I have raised the backlog item to check on this.