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 @@ -500,6 +500,9 @@ internal AgentResponseUpdate ConvertToolCompleteToAgentResponseUpdate(ToolExecut
JsonValueKind.Number => property.Value.TryGetInt64(out long l)
? (object?)l
: property.Value.GetDouble(),
JsonValueKind.Object => property.Value.Clone(),
JsonValueKind.Array => property.Value.Clone(),
JsonValueKind.Undefined => null,
_ => property.Value.GetRawText()
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ public void ConvertToolStartToAgentResponseUpdate_WithAllJsonValueKinds_Converts
nullVal = (string?)null,
intVal = 100,
floatVal = 3.14,
objVal = new { nested = "value" }
objVal = new { nested = "value" },
arrVal = new List<int> { 1, 2, 3 }
})
}
};
Expand All @@ -367,8 +368,12 @@ public void ConvertToolStartToAgentResponseUpdate_WithAllJsonValueKinds_Converts
Assert.Null(content.Arguments["nullVal"]);
Assert.Equal(100L, content.Arguments["intVal"]);
Assert.Equal(3.14, (double)content.Arguments["floatVal"]!, 2);
// Non-primitive values fall back to raw JSON text
Assert.IsType<string>(content.Arguments["objVal"]);
JsonElement objValElement = Assert.IsType<JsonElement>(content.Arguments["objVal"]);
Assert.Equal(JsonValueKind.Object, objValElement.ValueKind);
Assert.Equal("value", objValElement.GetProperty("nested").GetString());
JsonElement arrValElement = Assert.IsType<JsonElement>(content.Arguments["arrVal"]);
Assert.Equal(JsonValueKind.Array, arrValElement.ValueKind);
Assert.Equal(3, arrValElement.GetArrayLength());
}

[Fact]
Expand Down
Loading