How to Retrieve Citations Using Azure OpenAI Client's 'Async with Streaming' Approach in .NET?

Ganesh Penke 5 Reputation points
2024-03-18T09:08:35.66+00:00

I am using the Azure OpenAI client in .NET to retrieve responses based on 'Use your own data'. I'm successfully receiving responses in a streaming manner, but I'm encountering difficulty in retrieving citations using the 'Async with streaming' approach, which is available in the non-streaming response.

await foreach (StreamingChatCompletionsUpdate chatUpdate in client.GetChatCompletionsStreaming(chatCompletionsOptions))
{
    if (chatUpdate.Role.HasValue)
    {
        Console.Write($"{chatUpdate.Role.Value.ToString().ToUpperInvariant()}: ");
    }
    if (!string.IsNullOrEmpty(chatUpdate.ContentUpdate))
    {
        Console.Write(chatUpdate.ContentUpdate);
    }
}


Is there any solution available to help me retrieve citations using the streaming approach?

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,646 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,645 questions
{count} vote