Closed dmytrostruk closed 1 week ago
As part of this solution, can we please ensure alignment between chat-completion and agent framework? Agent framework provides citations (annotation) for responses by an assistant-agent which is currently using:
This may require evolving or otherwise refactoring AnnotationContent
.
+1 too. It's kinda not useful as it is right now. In fact we actually need to remove [doc1]...[docX] from the response as it will confuse the user. Any ETA on this?
Yes, please add citation, looking forward to the solution.
+1 too, would currently need this feature for a customer project. Any workarounds? Or would you in general not use the AzureOpenAI with AiSearch as an API and just implement it as a RAG-Plugin?
If anybody is looking for a workaround, you can just access the underlying OpenAI object:
...
var chatService = Kernel.GetRequiredService<IChatCompletionService>();
var chatMessage = await chatService.GetChatMessageContentAsync(chat, executionSettings);
var openAiChatCompletion = content.InnerContent as OpenAI.Chat.ChatCompletion;
var context = openAiChatCompletion.GetMessageContext();
on the context element, you will have the Citation property. Have func with it
As per team's agreement, breaking glass approach would be the main one to access citations: https://github.com/microsoft/semantic-kernel/blob/f2df866541f5a17b402c7aed407ad85de327d244/dotnet/samples/Concepts/ChatCompletion/AzureOpenAIWithData_ChatCompletion.cs#L153-L159
We will consider adding it to the abstractions if more AI providers/connectors will have similar functionality.
Closing this issue for now and we will create a new one in case we decide to add it to abstractions in the future.
Based on discussion: https://github.com/microsoft/semantic-kernel/discussions/7406
Return citations information like
Title
andFilepath
in chat completion response metadata when using Azure OpenAI Chat Completion on your data feature.