Skip to content

Commit 9c63f50

Browse files
committed
Fix conversation deserialization issue
1 parent 197a80c commit 9c63f50

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

sdk/agentserver/Azure.AI.AgentServer.AgentFramework/src/Converters/RequestConverterExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static IReadOnlyCollection<ChatMessage> GetInputMessages(this CreateRespo
5959
var content = rawContent == null
6060
? null
6161
: rawContent.ToObject<IList<ItemContent>>() ??
62-
[new ItemContentInputText(rawContent.ToString())];
62+
[new ItemContentInputText(rawContent.ToObject<string>())];
6363

6464
var aiContents = (content ?? ReadOnlyCollection<ItemContent>.Empty)
6565
.Select(c => c is ItemContentInputText textContent ? textContent : null)
@@ -74,7 +74,7 @@ public static IReadOnlyCollection<ChatMessage> GetInputMessages(this CreateRespo
7474
return messages as IReadOnlyCollection<ChatMessage>;
7575
}
7676

77-
var strMessage = request.Input.ToString();
77+
var strMessage = request.Input.ToObject<string>();
7878
return [new ChatMessage(ChatRole.User, strMessage)];
7979
}
8080

sdk/agentserver/Azure.AI.AgentServer.Core/src/Responses/Invocation/ResponsesExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ public static Contracts.Generated.Responses.Response ToResponse(
9191
/// <returns>The conversation ID, or null if not present.</returns>
9292
public static string? GetConversationId(this CreateResponseRequest request)
9393
{
94-
return request.Conversation?.ToObject<ResponseConversation1>()?.Id ?? request.Conversation?.ToString();
94+
return request.Conversation?.ToObject<ResponseConversation1>()?.Id ?? request.Conversation?.ToObject<string>();
9595
}
9696
}

sdk/agentserver/Azure.AI.AgentServer.Core/tests/Agents.Customized.Integration.Tests/CustomizedAgentInvocation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private static string GetInputText(CreateResponseRequest request)
110110
}
111111

112112
// implicit user message of text input
113-
return request.Input.ToString();
113+
return request.Input.ToObject<string>() ?? string.Empty;
114114
}
115115

116116
private static Response ToResponse(CreateResponseRequest request, AgentInvocationContext context,

0 commit comments

Comments
 (0)