45 instantiations of FunctionApprovalRequestContent
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (2)
1714
updatedContent[i] = new
FunctionApprovalRequestContent
(fcc.CallId, fcc);
1769
message.Contents[contentIndex] = new
FunctionApprovalRequestContent
(functionCall.CallId, functionCall);
Microsoft.Extensions.AI.Abstractions.Tests (11)
Contents\AIContentTests.cs (1)
73
new
FunctionApprovalRequestContent
("request123", new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
Contents\FunctionApprovalRequestContentTests.cs (8)
18
Assert.Throws<ArgumentNullException>("id", () => new
FunctionApprovalRequestContent
(null!, functionCall));
19
Assert.Throws<ArgumentException>("id", () => new
FunctionApprovalRequestContent
("", functionCall));
20
Assert.Throws<ArgumentException>("id", () => new
FunctionApprovalRequestContent
("\r\t\n ", functionCall));
22
Assert.Throws<ArgumentNullException>("functionCall", () => new
FunctionApprovalRequestContent
("id", null!));
33
FunctionApprovalRequestContent content =
new
(id, functionCall);
47
FunctionApprovalRequestContent content =
new
(id, functionCall);
68
FunctionApprovalRequestContent content =
new
(id, functionCall);
82
var content = new
FunctionApprovalRequestContent
("request123", new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } }));
Contents\UserInputRequestContentTests.cs (2)
36
UserInputRequestContent content = new
FunctionApprovalRequestContent
("request123", new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } }));
44
new
FunctionApprovalRequestContent
("request123", new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
Microsoft.Extensions.AI.Tests (32)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (29)
48
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
49
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
84
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
85
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
128
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
129
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
155
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
156
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
207
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
208
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
259
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
263
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
318
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
319
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
377
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
378
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
441
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
442
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
507
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
508
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })),
509
new
FunctionApprovalRequestContent
("callId3", new FunctionCallContent("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } }))
599
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
657
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
658
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
685
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 3 } }))
711
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
712
new
FunctionApprovalRequestContent
("callId2", new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
723
new
FunctionApprovalRequestContent
("callId3", new FunctionCallContent("callId3", "Func1")),
837
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1")),
ChatCompletion\FunctionInvokingChatClientTests.cs (3)
3294
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1"))
3330
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1"))
3367
new
FunctionApprovalRequestContent
("callId1", new FunctionCallContent("callId1", "Func1"))
27 references to FunctionApprovalRequestContent
Microsoft.Extensions.AI (7)
ChatCompletion\FunctionInvokingChatClient.cs (7)
44
/// attempt to invoke it directly. Instead, it will replace that <see cref="FunctionCallContent"/> with a <see cref="
FunctionApprovalRequestContent
"/>
804
/// Gets whether <paramref name="messages"/> contains any <see cref="
FunctionApprovalRequestContent
"/> or <see cref="FunctionApprovalResponseContent"/> instances.
807
messages.Exists(static m => m.Contents.Any(static c => c is
FunctionApprovalRequestContent
or FunctionApprovalResponseContent));
1384
/// 1. Remove all <see cref="
FunctionApprovalRequestContent
"/> and <see cref="FunctionApprovalResponseContent"/> from the <paramref name="originalMessages"/>.
1467
case
FunctionApprovalRequestContent
farc:
1700
/// Replaces all <see cref="FunctionCallContent"/> with <see cref="
FunctionApprovalRequestContent
"/> and ouputs a new list if any of them were replaced.
1723
/// Replaces all <see cref="FunctionCallContent"/> from <paramref name="messages"/> with <see cref="
FunctionApprovalRequestContent
"/>
Microsoft.Extensions.AI.Abstractions (4)
Contents\FunctionApprovalRequestContent.cs (1)
18
/// Initializes a new instance of the <see cref="
FunctionApprovalRequestContent
"/> class.
Contents\UserInputRequestContent.cs (1)
17
[JsonDerivedType(typeof(
FunctionApprovalRequestContent
), "functionApprovalRequest")]
Utilities\AIJsonUtilities.Defaults.cs (2)
54
AddAIContentType(options, typeof(
FunctionApprovalRequestContent
), typeDiscriminatorId: "functionApprovalRequest", checkBuiltIn: false);
128
[JsonSerializable(typeof(
FunctionApprovalRequestContent
))]
Microsoft.Extensions.AI.Abstractions.Tests (6)
Contents\FunctionApprovalRequestContentTests.cs (6)
33
FunctionApprovalRequestContent
content = new(id, functionCall);
47
FunctionApprovalRequestContent
content = new(id, functionCall);
68
FunctionApprovalRequestContent
content = new(id, functionCall);
82
var
content = new FunctionApprovalRequestContent("request123", new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } }));
85
var
deserializedContent = JsonSerializer.Deserialize<
FunctionApprovalRequestContent
>(json, AIJsonUtilities.DefaultOptions);
Microsoft.Extensions.AI.Tests (10)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (6)
1087
var
approvalRequest1 = update.Contents.OfType<
FunctionApprovalRequestContent
>().First();
1095
var
approvalRequest2 = update.Contents.OfType<
FunctionApprovalRequestContent
>().First();
1103
var
approvalRequest3 = update.Contents.OfType<
FunctionApprovalRequestContent
>().First();
ChatCompletion\FunctionInvokingChatClientTests.cs (4)
3048
Assert.Contains(result.Messages, m => m.Contents.OfType<
FunctionApprovalRequestContent
>().Any(frc => frc.FunctionCall.Name == "FunctionB"));
3058
Assert.Contains(result.Messages, m => m.Contents.OfType<
FunctionApprovalRequestContent
>().Any(frc => frc.FunctionCall.Name == "FunctionB"));
3154
Assert.Contains(result.Messages, m => m.Contents.OfType<
FunctionApprovalRequestContent
>().Any(frc => frc.FunctionCall.Name == "FunctionB"));
3165
Assert.Contains(result.Messages, m => m.Contents.OfType<
FunctionApprovalRequestContent
>().Any(frc => frc.FunctionCall.Name == "FunctionB"));