35 references to new
Microsoft.Extensions.AI.Abstractions (1)
Contents\FunctionApprovalRequestContent.cs (1)
41public FunctionApprovalResponseContent CreateResponse(bool approved, string? reason = null) => new(Id, approved, FunctionCall) { Reason = reason };
Microsoft.Extensions.AI.Abstractions.Tests (9)
Contents\AIContentTests.cs (1)
74new FunctionApprovalResponseContent("request123", approved: true, new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
Contents\FunctionApprovalResponseContentTests.cs (6)
17Assert.Throws<ArgumentNullException>("id", () => new FunctionApprovalResponseContent(null!, true, functionCall)); 18Assert.Throws<ArgumentException>("id", () => new FunctionApprovalResponseContent("", true, functionCall)); 19Assert.Throws<ArgumentException>("id", () => new FunctionApprovalResponseContent("\r\t\n ", true, functionCall)); 21Assert.Throws<ArgumentNullException>("functionCall", () => new FunctionApprovalResponseContent("id", true, null!)); 31FunctionApprovalResponseContent content = new(id, approved, functionCall); 43var content = new FunctionApprovalResponseContent("request123", true, new FunctionCallContent("call123", "functionName"))
Contents\UserInputResponseContentTests.cs (2)
34UserInputResponseContent content = new FunctionApprovalResponseContent("request123", true, new FunctionCallContent("call123", "functionName")); 42new FunctionApprovalResponseContent("request123", true, new FunctionCallContent("call123", "functionName")),
Microsoft.Extensions.AI.Tests (25)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (25)
160new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 161new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 212new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 213new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 267new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 271new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 323new FunctionApprovalResponseContent("callId1", false, new FunctionCallContent("callId1", "Func1")), 324new FunctionApprovalResponseContent("callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 382new FunctionApprovalResponseContent("callId1", false, new FunctionCallContent("callId1", "Func1")), 383new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 446new FunctionApprovalResponseContent("callId1", false, new FunctionCallContent("callId1", "Func1")) 450new FunctionApprovalResponseContent("callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 513new FunctionApprovalResponseContent("callId1", false, new FunctionCallContent("callId1", "Func1")) { Reason = "Custom rejection for Func1" }, 514new FunctionApprovalResponseContent("callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })), 515new FunctionApprovalResponseContent("callId3", true, new FunctionCallContent("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } })) 603new FunctionApprovalResponseContent("callId1", false, new FunctionCallContent("callId1", "Func1")) 662new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 663new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 716new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 717new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 727new FunctionApprovalResponseContent("callId3", true, new FunctionCallContent("callId3", "Func1")), 867new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 868new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })) 913new FunctionApprovalResponseContent("callId1", true, new FunctionCallContent("callId1", "Func1")), 914new FunctionApprovalResponseContent("callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))