-
Notifications
You must be signed in to change notification settings - Fork 849
Closed
Labels
area-aiMicrosoft.Extensions.AI librariesMicrosoft.Extensions.AI librariesbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.
Description
Description
AsChatMessages in MicrosoftExtensionsAIChatExtensions converts from OpenAI messages to ext messages.
This is used in AIAgentWithOpenAIExtensions to accept OpenAI messages and return OpenAI updates.
Unfortunately the code does not map the role across, so all messages end up as User role. This results in a predictably misbehaving agent that does not respect my authoritah! 😆
Reproduction Steps
In LinqPad
using Microsoft.Extensions.AI;
using OpenAI.Chat;
List<OpenAI.Chat.ChatMessage> msgs = [new SystemChatMessage("Foo")];
msgs.AsChatMessages().ToList().ForEach(m => m.Role.Dump());
The resulting role will be user.
Expected behavior
The role should be system.
Actual behavior
The resulting role will be user.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
area-aiMicrosoft.Extensions.AI librariesMicrosoft.Extensions.AI librariesbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.