279 references to AIFunctionFactory
Aspire.Dashboard (6)
Model\Assistant\AssistantChatViewModel.cs (6)
162
AIFunctionFactory
.Create(dataContext.GetResourceGraphAsync),
163
AIFunctionFactory
.Create(dataContext.GetConsoleLogsAsync),
164
AIFunctionFactory
.Create(dataContext.GetTraceAsync),
165
AIFunctionFactory
.Create(dataContext.GetStructuredLogsAsync),
166
AIFunctionFactory
.Create(dataContext.GetTracesAsync),
167
AIFunctionFactory
.Create(dataContext.GetTraceStructuredLogsAsync)
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvocationContext.cs (1)
18
private static readonly AIFunction _nopFunction =
AIFunctionFactory
.Create(() => { }, nameof(FunctionInvocationContext));
Microsoft.Extensions.AI.Abstractions (2)
Functions\AIFunctionFactoryOptions.cs (2)
79
/// By default, the return value of invoking the method wrapped into an <see cref="AIFunction"/> by <see cref="
AIFunctionFactory
"/>
89
/// method for <see cref="AIFunction"/> instances produced by <see cref="
AIFunctionFactory
"/> to wrap
Microsoft.Extensions.AI.Abstractions.Tests (19)
ChatCompletion\ChatOptionsTests.cs (4)
70
AIFunctionFactory
.Create(() => 42),
71
AIFunctionFactory
.Create(() => 43),
178
AIFunctionFactory
.Create(() => 42),
179
AIFunctionFactory
.Create(() => 43),
Contents\FunctionCallContentTests.cs (6)
111
AIFunction function =
AIFunctionFactory
.Create((DayOfWeek[] a, double b, Guid c, Dictionary<string, string> d) => b, serializerOptions: TestJsonSerializerContext.Default.Options);
133
AIFunction function =
AIFunctionFactory
.Create((DayOfWeek[] a, double b, Guid c, Dictionary<string, string> d) => b, serializerOptions: TestJsonSerializerContext.Default.Options);
141
var ex = Assert.Throws<NotSupportedException>(() =>
AIFunctionFactory
.Create((CustomType arg) => { }, serializerOptions: TestJsonSerializerContext.Default.Options));
145
ex = Assert.Throws<NotSupportedException>(() =>
AIFunctionFactory
.Create(() => new CustomType(), serializerOptions: TestJsonSerializerContext.Default.Options));
166
AIFunction function =
AIFunctionFactory
.Create((DayOfWeek[] a, double b, Guid c, Dictionary<string, string> d) => b, serializerOptions: TestJsonSerializerContext.Default.Options);
187
AIFunction function =
AIFunctionFactory
.Create((DayOfWeek[] a, double b, Guid c, Dictionary<string, string> d) => b, serializerOptions: TestJsonSerializerContext.Default.Options);
Functions\ApprovalRequiredAIFunctionTests.cs (2)
21
var inner =
AIFunctionFactory
.Create(() => 42);
37
var inner =
AIFunctionFactory
.Create(() => "result");
Functions\DelegatingAIFunctionTests.cs (2)
23
AIFunction expected = new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => 42));
65
AIFunction inner =
AIFunctionFactory
.Create(int () =>
Utilities\AIJsonSchemaTransformCacheTests.cs (1)
51
AIFunction func =
AIFunctionFactory
.Create((int x, int y) => x + y);
Utilities\AIJsonUtilitiesTests.cs (4)
285
AIFunction func =
AIFunctionFactory
.Create((int x, int y) => x + y, serializerOptions: options);
339
AIFunction func =
AIFunctionFactory
.Create((
360
AIFunction func =
AIFunctionFactory
.Create((int a, int? b, long c, short d, float e, double f, decimal g) => { }, serializerOptions: options);
410
AIFunction func =
AIFunctionFactory
.Create(([Range(1, 10)] int num, [StringLength(100, MinimumLength = 1)] string str) => num + str.Length, serializerOptions: options);
Microsoft.Extensions.AI.AzureAIInference.Tests (6)
AzureAIInferenceChatClientTests.cs (6)
328
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
412
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
501
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
576
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
1251
Tools = [
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
1338
Tools = [
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
Microsoft.Extensions.AI.Evaluation.Integration.Tests (2)
AgentQualityEvaluatorTests.cs (2)
43
Tools = [
AIFunctionFactory
.Create(GetOrders),
AIFunctionFactory
.Create(GetOrderStatus)]
Microsoft.Extensions.AI.Integration.Tests (46)
ChatClientIntegrationTests.cs (46)
246
Tools = [
AIFunctionFactory
.Create(() => secretNumber, "GetSecretNumber")]
262
Tools = [
AIFunctionFactory
.Create((int a, int b) => a * b, "SecretComputation")]
277
Tools = [
AIFunctionFactory
.Create((int a, int b) => a * b, "SecretComputation")]
311
AIFunction func =
AIFunctionFactory
.Create((string id = "defaultId") => id is "foo" ? secretNumber : -1, "GetSecretNumberById");
343
AIFunction func =
AIFunctionFactory
.Create((PersonRecord person) => person.Name is "John" ? secretNumber + person.Age : -1, "GetSecretNumberByPerson");
375
AIFunction func =
AIFunctionFactory
.Create((string[] items, string shopperId) => { shoppingCart.AddRange(items); shopperName = shopperId; }, "AddItemsToShoppingCart");
459
AIFunctionFactory
.Create((int? i) => i, createOptions()),
460
AIFunctionFactory
.Create((string? s) => s, createOptions()),
461
AIFunctionFactory
.Create((int? i = null) => i, createOptions()),
462
AIFunctionFactory
.Create((bool b) => b, createOptions()),
463
AIFunctionFactory
.Create((double d) => d, createOptions()),
464
AIFunctionFactory
.Create((decimal d) => d, createOptions()),
465
AIFunctionFactory
.Create((float f) => f, createOptions()),
466
AIFunctionFactory
.Create((long l) => l, createOptions()),
467
AIFunctionFactory
.Create((char c) => c, createOptions()),
468
AIFunctionFactory
.Create((DateTime dt) => dt, createOptions()),
469
AIFunctionFactory
.Create((DateTimeOffset? dt) => dt, createOptions()),
470
AIFunctionFactory
.Create((TimeSpan ts) => ts, createOptions()),
472
AIFunctionFactory
.Create((DateOnly d) => d, createOptions()),
473
AIFunctionFactory
.Create((TimeOnly t) => t, createOptions()),
475
AIFunctionFactory
.Create((Uri uri) => uri, createOptions()),
476
AIFunctionFactory
.Create((Guid guid) => guid, createOptions()),
477
AIFunctionFactory
.Create((List<int> list) => list, createOptions()),
478
AIFunctionFactory
.Create((int[] arr, ComplexObject? co) => arr, createOptions()),
479
AIFunctionFactory
.Create((string p1 = "str", int p2 = 42, BindingFlags p3 = BindingFlags.IgnoreCase, char p4 = 'x') => p1, createOptions()),
480
AIFunctionFactory
.Create((string? p1 = "str", int? p2 = 42, BindingFlags? p3 = BindingFlags.IgnoreCase, char? p4 = 'x') => p1, createOptions()),
584
Tools = [
AIFunctionFactory
.Create((string personName) =>
606
var tool =
AIFunctionFactory
.Create(() =>
629
var getSecretNumberTool =
AIFunctionFactory
.Create(() => 123, "GetSecretNumber");
630
var shieldsUpTool =
AIFunctionFactory
.Create(() => shieldsUp = true, "ShieldsUp");
726
var getTemperature =
AIFunctionFactory
.Create([Description("Gets the current temperature")] () =>
765
var getTemperature =
AIFunctionFactory
.Create([Description("Gets the current temperature")] () =>
807
var getTemperature =
AIFunctionFactory
.Create([Description("Gets the current temperature")] () =>
897
new ChatOptions { Tools = [
AIFunctionFactory
.Create(() => secretNumber, "GetSecretNumber")] });
923
new ChatOptions { Tools = [
AIFunctionFactory
.Create(() => secretNumber, "GetSecretNumber")] }))
1077
Tools = [
AIFunctionFactory
.Create((int personId) =>
1228
var getWeather =
AIFunctionFactory
.Create(([Description("Gets weather for a city")] string city) =>
1417
var weatherTool =
AIFunctionFactory
.Create(
1425
var translateTool =
AIFunctionFactory
.Create(
1433
var mathTool =
AIFunctionFactory
.Create(
1501
var translateTool =
AIFunctionFactory
.Create(
1509
var weatherTool =
AIFunctionFactory
.Create(
1558
var weatherTool =
AIFunctionFactory
.Create(
1634
var weatherTool =
AIFunctionFactory
.Create(
1642
var translateTool =
AIFunctionFactory
.Create(
1650
var mathTool =
AIFunctionFactory
.Create(
Microsoft.Extensions.AI.OllamaSharp.Integration.Tests (3)
OllamaSharpChatClientIntegrationTests.cs (3)
46
Tools = [
AIFunctionFactory
.Create(() => secretNumber, "GetSecretNumber")],
66
var stockPriceTool =
AIFunctionFactory
.Create([Description("Returns the stock price for a given ticker symbol")] (
76
var irrelevantTool =
AIFunctionFactory
.Create(() => { didCallIrrelevantTool = true; return 123; }, "GetSecretNumber");
Microsoft.Extensions.AI.OpenAI.Tests (18)
OpenAIChatClientTests.cs (8)
332
Tools = [
AIFunctionFactory
.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")],
382
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
459
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
542
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
616
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
729
Tools = [
AIFunctionFactory
.Create((string name) => 42, "GetPersonAge")],
1141
Tools = [
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
1325
Tools = [
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
OpenAIConversionTests.cs (1)
22
private static readonly AIFunction _testFunction =
AIFunctionFactory
.Create(
OpenAIResponseClientIntegrationTests.cs (7)
262
Tools = [
AIFunctionFactory
.Create(() => { callCount++; return "5:43"; }, new AIFunctionFactoryOptions { Name = "GetCurrentTime" })]
356
Tools = [
AIFunctionFactory
.Create(() => { callCount++; return "5:43"; }, new AIFunctionFactoryOptions { Name = "GetCurrentTime" })]
436
Tools = [
AIFunctionFactory
.Create((int a, int b) => new TextContent($"The sum is {a + b}"), "AddNumbers", "Adds two numbers together")]
456
Tools = [
AIFunctionFactory
.Create((string city) => new List<AIContent>
484
Tools = [
AIFunctionFactory
.Create(() => new DataContent(ImageDataUri.GetImageDataUri(), "image/png"), "GetDotnetLogo", "Returns the .NET logo image")]
509
Tools = [
AIFunctionFactory
.Create(() => new DataContent(ImageDataUri.GetPdfDataUri(), "application/pdf") { Name = "document.pdf" }, "GetDocument", "Returns a PDF document")]
532
Tools = [
AIFunctionFactory
.Create(() => new List<AIContent>
OpenAIResponseClientTests.cs (2)
535
Tools = [
AIFunctionFactory
.Create(() => 42, "GetPersonAge", "Gets the age of the specified person.")],
677
AIFunction tool =
AIFunctionFactory
.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.");
Microsoft.Extensions.AI.Tests (176)
ChatCompletion\FunctionInvocationContextTests.cs (1)
51
AIFunction function =
AIFunctionFactory
.Create(() => { }, nameof(Properties_Roundtrip));
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (31)
24
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
26
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2")),
65
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
66
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
99
AIFunction func1 =
AIFunctionFactory
.Create(() => "Result 1", "Func1");
100
AIFunction func2 =
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2");
145
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
146
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
196
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
197
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
255
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
256
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
314
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
315
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
378
AIFunctionFactory
.Create(() => "Result 1", "Func1"),
379
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2")),
432
AIFunctionFactory
.Create(() => "Result 1", "Func1"),
433
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2")),
503
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
504
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
558
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
559
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
588
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
589
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
634
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create(() => "Result 1", "Func1")),
635
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
686
AIFunctionFactory
.Create(() => "Result 1", "Func1"),
687
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
758
AIFunctionFactory
.Create(() => "Result 1", "Func1"),
759
new ApprovalRequiredAIFunction(
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2")),
760
AIFunctionFactory
.Create(() => "Result 3", "Func3"),
ChatCompletion\FunctionInvokingChatClientTests.cs (40)
72
IList<AITool> additionalTools = [
AIFunctionFactory
.Create(() => "Additional Tool")];
84
AIFunctionFactory
.Create(() => "Result 1", "Func1"),
85
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
86
AIFunctionFactory
.Create((int i) => { }, "VoidReturn"),
113
new() { Tools = [
AIFunctionFactory
.Create(() => "Shouldn't be invoked", "ChatOptionsFunc")] } :
119
AIFunctionFactory
.Create(() => "Result 1", "Func1"),
120
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
121
AIFunctionFactory
.Create((int i) => { }, "VoidReturn"),
146
Tools = [
AIFunctionFactory
.Create(() => "Result 1", "Func1")]
152
AIFunctionFactory
.Create(() => "Should never be invoked", "Func1"),
153
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
154
AIFunctionFactory
.Create((int i) => { }, "VoidReturn"),
183
AIFunctionFactory
.Create((int? i = 42) => "Result 1", "Func1"),
184
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
234
AIFunctionFactory
.Create(async (string arg) =>
281
AIFunctionFactory
.Create(async (string arg) =>
320
AIFunctionFactory
.Create(() => "Result 1", "Func1"),
321
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
322
AIFunctionFactory
.Create((int i) => { }, "VoidReturn"),
371
AIFunctionFactory
.Create(() => { actualCallCount++; }, "VoidReturn"),
413
AIFunctionFactory
.Create((bool shouldThrow, int callIndex) =>
494
AIFunctionFactory
.Create(() =>
543
AIFunctionFactory
.Create(() => "Result 1", "Func1"),
544
AIFunctionFactory
.Create((int i) => $"Result 2: {i}", "Func2"),
545
AIFunctionFactory
.Create((int i) => { }, "VoidReturn"),
582
AIFunctionFactory
.Create(string () => throw new InvalidOperationException("Oh no!"), "Func1"),
618
Tools = [
AIFunctionFactory
.Create(() => "Result 1", "Func1")]
675
Tools = [
AIFunctionFactory
.Create(() => "Result 1", "Func1")]
740
Tools = [
AIFunctionFactory
.Create((string text) => $"Result for {text}", "Func1")]
798
Tools = [
AIFunctionFactory
.Create(() => "doesn't matter", "Func1")]
837
var function =
AIFunctionFactory
.Create(async (int i) =>
912
var function =
AIFunctionFactory
.Create((string? result = null) =>
967
Tools = [
AIFunctionFactory
.Create(() => "Result 1", "Func1")],
1028
Tools = [
AIFunctionFactory
.Create((IServiceProvider actual) =>
1061
Tools = [
AIFunctionFactory
.Create(async (string arg, CancellationToken cancellationToken) =>
1089
Tools = [
AIFunctionFactory
.Create((int i) => $"Known: {i}", "KnownFunc")]
1141
var declarationOnly =
AIFunctionFactory
.Create(() => "unused", "DefOnly").AsDeclarationOnly();
1166
var known =
AIFunctionFactory
.Create(() => { invoked++; return "OK"; }, "Known");
1167
var defOnly =
AIFunctionFactory
.Create(() => "unused", "DefOnly").AsDeclarationOnly();
1224
Tools = [
AIFunctionFactory
.Create(() => { }, "Func1")],
ChatCompletion\OpenTelemetryChatClientTests.cs (2)
135
AIFunctionFactory
.Create((string personName) => personName, "GetPersonAge", "Gets the age of a person by name."),
140
AIFunctionFactory
.Create((string location) => "", "GetCurrentWeather", "Gets the current weather for a location.").AsDeclarationOnly(),
Functions\AIFunctionFactoryTest.cs (102)
31
Assert.Throws<ArgumentNullException>("method", () =>
AIFunctionFactory
.Create(method: null!));
32
Assert.Throws<ArgumentNullException>("method", () =>
AIFunctionFactory
.Create(method: null!, target: new object()));
33
Assert.Throws<ArgumentNullException>("method", () =>
AIFunctionFactory
.Create(method: null!, target: new object(), name: "myAiFunk"));
34
Assert.Throws<ArgumentNullException>("target", () =>
AIFunctionFactory
.Create(typeof(AIFunctionFactoryTest).GetMethod(nameof(InvalidArguments_Throw))!, (object?)null));
36
AIFunctionFactory
.Create(typeof(AIFunctionFactoryTest).GetMethod(nameof(InvalidArguments_Throw))!, (Func<AIFunctionArguments, object>)null!));
37
Assert.Throws<ArgumentException>("method", () =>
AIFunctionFactory
.Create(typeof(List<>).GetMethod("Add")!, new List<int>()));
45
func =
AIFunctionFactory
.Create((string a) => a + " " + a);
48
func =
AIFunctionFactory
.Create((string a, string b) => b + " " + a);
51
func =
AIFunctionFactory
.Create((int a, long b) => a + b);
58
AIFunction func =
AIFunctionFactory
.Create((string a = "test") => a + " " + a);
67
AIFunction funcNull =
AIFunctionFactory
.Create(([DefaultValue(null)] string? text) => text ?? "was null");
82
AIFunction funcValue =
AIFunctionFactory
.Create(([DefaultValue("default")] string text) => text);
91
AIFunction funcInt =
AIFunctionFactory
.Create(([DefaultValue(42)] int x) => x * 2);
100
AIFunction funcBoth =
AIFunctionFactory
.Create(([DefaultValue(100)] int y = 50) => y);
113
AIFunctionFactory
.Create((string theParam) => theParam + " " + theParam),
114
AIFunctionFactory
.Create((string? theParam) => theParam + " " + theParam),
115
AIFunctionFactory
.Create((int theParam) => theParam * 2),
116
AIFunctionFactory
.Create((int? theParam) => theParam * 2),
129
AIFunction func =
AIFunctionFactory
.Create((int x, int y, int z, int w, int u) => x + y + z + w + u);
158
AIFunction func =
AIFunctionFactory
.Create((JsonElement param) => param, serializerOptions: options);
178
AIFunction func =
AIFunctionFactory
.Create((JsonElement param) => param);
197
AIFunction func =
AIFunctionFactory
.Create((int value1 = 1, string value2 = "2", CancellationToken cancellationToken = default) =>
213
func =
AIFunctionFactory
.Create(Task<string> (string a) => Task.FromResult(a + " " + a));
217
func =
AIFunctionFactory
.Create(ValueTask<string> (string a, string b) => new ValueTask<string>(b + " " + a));
222
func =
AIFunctionFactory
.Create(async Task (int a, long b) => { result = a + b; await Task.Yield(); });
228
func =
AIFunctionFactory
.Create(async ValueTask (int a, long b) => { result = a + b; await Task.Yield(); });
233
func =
AIFunctionFactory
.Create((int count) => SimpleIAsyncEnumerable(count), serializerOptions: JsonContext.Default.Options);
246
func =
AIFunctionFactory
.Create(() => (IAsyncEnumerable<int>)new ThrowingAsyncEnumerable(), serializerOptions: JsonContext.Default.Options);
263
func =
AIFunctionFactory
.Create(dotnetFunc);
269
func =
AIFunctionFactory
.Create(dotnetFunc2);
275
func =
AIFunctionFactory
.Create(dotnetFunc3);
289
AIFunction func =
AIFunctionFactory
.Create(funcWithDisplayName);
295
func =
AIFunctionFactory
.Create(funcWithBoth);
300
func =
AIFunctionFactory
.Create(funcWithDisplayName, name: "explicit_name");
304
func =
AIFunctionFactory
.Create(funcWithDisplayName, new AIFunctionFactoryOptions());
308
func =
AIFunctionFactory
.Create(funcWithDisplayName, new AIFunctionFactoryOptions { Name = "options_name" });
313
func =
AIFunctionFactory
.Create(funcWithoutDisplayName);
338
AIFunction func =
AIFunctionFactory
.Create(dotnetFunc, options);
363
AIFunction func =
AIFunctionFactory
.Create(
387
AIFunction func =
AIFunctionFactory
.Create(
407
AIFunction func =
AIFunctionFactory
.Create((
451
AIFunction func =
AIFunctionFactory
.Create((
483
AIFunction func =
AIFunctionFactory
.Create(
501
AIFunction func =
AIFunctionFactory
.Create(
512
AIFunction func =
AIFunctionFactory
.Create(
523
Assert.Throws<ArgumentException>("method", () =>
AIFunctionFactory
.Create(
531
AIFunction func =
AIFunctionFactory
.Create(
550
AIFunction func =
AIFunctionFactory
.Create(
569
AIFunction func =
AIFunctionFactory
.Create(
596
AIFunction f =
AIFunctionFactory
.Create(([FromKeyedServices("key")] MyService service, int myInteger) => service.Value + myInteger,
619
AIFunction f =
AIFunctionFactory
.Create(([FromKeyedServices(null!)] MyService service, int myInteger) => service.Value + myInteger,
642
AIFunction f =
AIFunctionFactory
.Create(([FromKeyedServices("key")] MyService? service = null, int myInteger = 0) =>
661
AIFunction f =
AIFunctionFactory
.Create(
713
AIFunction f =
AIFunctionFactory
.Create(
730
AIFunction f =
AIFunctionFactory
.Create(
746
AIFunction f =
AIFunctionFactory
.Create(
769
AIFunction f =
AIFunctionFactory
.Create(
792
AIFunction f =
AIFunctionFactory
.Create(
815
AIFunction f =
AIFunctionFactory
.Create(
838
AIFunction f =
AIFunctionFactory
.Create(
861
AIFunction f =
AIFunctionFactory
.Create(
884
AIFunction f =
AIFunctionFactory
.Create(
907
AIFunction f =
AIFunctionFactory
.Create(
931
AIFunctionFactory
.Create(() => (AIContent)new TextContent("text")),
932
AIFunctionFactory
.Create(async () => (AIContent)new TextContent("text")),
933
AIFunctionFactory
.Create(async ValueTask<AIContent> () => (AIContent)new TextContent("text")),
934
AIFunctionFactory
.Create(() => new TextContent("text")),
935
AIFunctionFactory
.Create(async () => new TextContent("text")),
936
AIFunctionFactory
.Create(async ValueTask<AIContent> () => new TextContent("text")),
941
AIFunctionFactory
.Create(() => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")),
942
AIFunctionFactory
.Create(async () => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")),
943
AIFunctionFactory
.Create(async ValueTask<DataContent> () => new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")),
948
AIFunctionFactory
.Create(() => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
949
AIFunctionFactory
.Create(async () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
950
AIFunctionFactory
.Create(async ValueTask<IEnumerable<AIContent>> () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
955
AIFunctionFactory
.Create(() => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
956
AIFunctionFactory
.Create(async () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
957
AIFunctionFactory
.Create(async ValueTask<AIContent[]> () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
962
AIFunctionFactory
.Create(() => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
963
AIFunctionFactory
.Create(async () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
964
AIFunctionFactory
.Create(async ValueTask<List<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
969
AIFunctionFactory
.Create(() => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
970
AIFunctionFactory
.Create(async () => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
971
AIFunctionFactory
.Create(async ValueTask<IList<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
988
AIFunction f =
AIFunctionFactory
.Create((Guid g = default, StructWithDefaultCtor s = default) => g.ToString() + "," + s.Value.ToString(), serializerOptions: JsonContext.Default.Options);
999
AIFunction f =
AIFunctionFactory
.Create(
1032
AIFunction f =
AIFunctionFactory
.Create(
1062
AIFunction f =
AIFunctionFactory
.Create(Add, serializerOptions: JsonContext.Default.Options);
1075
AIFunctionDeclaration f =
AIFunctionFactory
.CreateDeclaration("something", "amazing", schema);
1081
f =
AIFunctionFactory
.CreateDeclaration("other", null, default, schema);
1087
Assert.Throws<ArgumentNullException>("name", () =>
AIFunctionFactory
.CreateDeclaration(null!, "description", default));
1188
var tool =
AIFunctionFactory
.Create(DoSomething);
1207
var tool1 =
AIFunctionFactory
.Create(FirstLocal);
1208
var tool2 =
AIFunctionFactory
.Create(SecondLocal);
1224
var tool =
AIFunctionFactory
.Create(lambda);
1243
var tool1 =
AIFunctionFactory
.Create(lambda1);
1244
var tool2 =
AIFunctionFactory
.Create(lambda2);
1258
var tool =
AIFunctionFactory
.Create(Add);
1274
var tool =
AIFunctionFactory
.Create(FetchDataAsync);
1291
var tool =
AIFunctionFactory
.Create(DoSomething, name: "CustomName");
1300
var tool =
AIFunctionFactory
.Create(Add, serializerOptions: JsonContext.Default.Options);
1312
var tool =
AIFunctionFactory
.Create(TestStaticMethod, null, serializerOptions: JsonContext.Default.Options);