Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ internal static string SerializeChatMessages(
message.Role == ChatRole.Tool ? "tool" :
message.Role == ChatRole.System || message.Role == new ChatRole("developer") ? "system" :
"user",
Name = message.AuthorName,
};

foreach (AIContent content in message.Contents)
Expand Down Expand Up @@ -595,6 +596,7 @@ private void AddOutputMessagesTags(ChatResponse response, Activity? activity)
private sealed class OtelMessage
{
public string? Role { get; set; }
public string? Name { get; set; }
public List<object> Parts { get; set; } = [];
public string? FinishReason { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ async static IAsyncEnumerable<ChatResponseUpdate> CallbackAsync(
List<ChatMessage> messages =
[
new(ChatRole.System, "You are a close friend."),
new(ChatRole.User, "Hey!"),
new(ChatRole.User, "Hey!") { AuthorName = "Alice" },
new(ChatRole.Assistant, [new FunctionCallContent("12345", "GetPersonName")]),
new(ChatRole.Tool, [new FunctionResultContent("12345", "John")]),
new(ChatRole.Assistant, "Hey John, what's up?"),
new(ChatRole.Assistant, "Hey John, what's up?") { AuthorName = "BotAssistant" },
new(ChatRole.User, "What's the biggest animal?")
];

Expand Down Expand Up @@ -201,6 +201,7 @@ async static IAsyncEnumerable<ChatResponseUpdate> CallbackAsync(
},
{
"role": "user",
"name": "Alice",
"parts": [
{
"type": "text",
Expand Down Expand Up @@ -230,6 +231,7 @@ async static IAsyncEnumerable<ChatResponseUpdate> CallbackAsync(
},
{
"role": "assistant",
"name": "BotAssistant",
"parts": [
{
"type": "text",
Expand Down
Loading