26 references to InvokeAsync
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (1)
648
result = await context.Function.
InvokeAsync
(context.CallContent.Arguments, cancellationToken).ConfigureAwait(false);
Functions\AIFunctionContext.cs (1)
14
/// context into the method's invocation. For example, any <see cref="CancellationToken"/> passed to the <see cref="AIFunction.
InvokeAsync
"/>
Microsoft.Extensions.AI.Abstractions.Tests (9)
Contents\FunctionCallContentTests..cs (7)
114
var result = await function.
InvokeAsync
(arguments);
136
var result = await function.
InvokeAsync
(arguments);
169
var result = await function.
InvokeAsync
(arguments);
190
var result = await function.
InvokeAsync
(arguments);
208
var result = await NetTypelessAIFunction.Instance.
InvokeAsync
(arguments);
226
var result = await NetTypelessAIFunction.Instance.
InvokeAsync
(arguments);
244
var result = await NetTypelessAIFunction.Instance.
InvokeAsync
(arguments);
Functions\AIFunctionTests.cs (2)
19
var result1 = ((IEnumerable<KeyValuePair<string, object?>>, CancellationToken))(await f.
InvokeAsync
(null, cts.Token))!;
25
var result2 = ((IEnumerable<KeyValuePair<string, object?>>, CancellationToken))(await f.
InvokeAsync
(null, cts.Token))!;
Microsoft.Extensions.AI.OpenAI (1)
OpenAIRealtimeExtensions.cs (1)
126
var result = await aiFunction.
InvokeAsync
(functionCallContent.Arguments, cancellationToken).ConfigureAwait(false);
Microsoft.Extensions.AI.Tests (14)
Functions\AIFunctionFactoryTest.cs (14)
31
AssertExtensions.EqualFunctionCallResults("test test", await func.
InvokeAsync
([new KeyValuePair<string, object?>("a", "test")]));
34
AssertExtensions.EqualFunctionCallResults("hello world", await func.
InvokeAsync
([new KeyValuePair<string, object?>("b", "hello"), new KeyValuePair<string, object?>("a", "world")]));
37
AssertExtensions.EqualFunctionCallResults(3L, await func.
InvokeAsync
([new KeyValuePair<string, object?>("a", 1), new KeyValuePair<string, object?>("b", 2L)]));
44
AssertExtensions.EqualFunctionCallResults("test test", await func.
InvokeAsync
());
45
AssertExtensions.EqualFunctionCallResults("hello hello", await func.
InvokeAsync
([new KeyValuePair<string, object?>("a", "hello")]));
62
AssertExtensions.EqualFunctionCallResults(null, await func.
InvokeAsync
(cancellationToken: cts.Token));
72
AssertExtensions.EqualFunctionCallResults(null, await func.
InvokeAsync
(new Dictionary<string, object?> { ["somethingFirst"] = 1, ["ctx"] = new AIFunctionContext() }, cts.Token));
82
AssertExtensions.EqualFunctionCallResults(null, await func.
InvokeAsync
(cancellationToken: cts.Token));
92
AssertExtensions.EqualFunctionCallResults("test test", await func.
InvokeAsync
([new KeyValuePair<string, object?>("a", "test")]));
95
AssertExtensions.EqualFunctionCallResults("hello world", await func.
InvokeAsync
([new KeyValuePair<string, object?>("b", "hello"), new KeyValuePair<string, object?>("a", "world")]));
99
AssertExtensions.EqualFunctionCallResults(null, await func.
InvokeAsync
([new KeyValuePair<string, object?>("a", 1), new KeyValuePair<string, object?>("b", 2L)]));
104
AssertExtensions.EqualFunctionCallResults(null, await func.
InvokeAsync
([new KeyValuePair<string, object?>("a", 1), new KeyValuePair<string, object?>("b", 2L)]));
108
AssertExtensions.EqualFunctionCallResults(new int[] { 0, 1, 2, 3, 4 }, await func.
InvokeAsync
([new("count", 5)]));
120
await Assert.ThrowsAsync<NotImplementedException>(() => func.
InvokeAsync
());