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