54 references to Create
Microsoft.Extensions.AI.Abstractions.Tests (5)
AIJsonUtilitiesTests.cs (1)
121AIFunction func = AIFunctionFactory.Create((int x, int y) => x + y, serializerOptions: options);
ChatCompletion\ChatOptionsTests.cs (4)
55AIFunctionFactory.Create(() => 42), 56AIFunctionFactory.Create(() => 43), 129AIFunctionFactory.Create(() => 42), 130AIFunctionFactory.Create(() => 43),
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
AzureAIInferenceChatClientTests.cs (2)
413Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 505Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
Microsoft.Extensions.AI.Integration.Tests (7)
ChatClientIntegrationTests.cs (7)
139Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] 155Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 171Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 199Tools = [AIFunctionFactory.Create((string personName) => 221var tool = AIFunctionFactory.Create(() => 245var getSecretNumberTool = AIFunctionFactory.Create(() => 123, "GetSecretNumber"); 246var shieldsUpTool = AIFunctionFactory.Create(() => shieldsUp = true, "ShieldsUp");
Microsoft.Extensions.AI.Ollama.Tests (5)
OllamaChatClientIntegrationTests.cs (3)
48Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")], 68var stockPriceTool = AIFunctionFactory.Create([Description("Returns the stock price for a given ticker symbol")] ( 78var irrelevantTool = AIFunctionFactory.Create(() => { didCallIrrelevantTool = true; return 123; }, "GetSecretNumber");
OllamaChatClientTests.cs (2)
352Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 450Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIChatClientTests.cs (2)
459Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 554Tools = [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 (33)
ChatCompletion\FunctionInvokingChatClientTests.cs (16)
34AIFunctionFactory.Create(() => "Result 1", "Func1"), 35AIFunctionFactory.Create((int i) => $"Result 2: {i}", "Func2"), 36AIFunctionFactory.Create((int i) => { }, "VoidReturn"), 60AIFunctionFactory.Create((int i) => "Result 1", "Func1"), 61AIFunctionFactory.Create((int i) => $"Result 2: {i}", "Func2"), 94AIFunctionFactory.Create((string arg) => 124AIFunctionFactory.Create(async (string arg) => 158AIFunctionFactory.Create(() => "Result 1", "Func1"), 159AIFunctionFactory.Create((int i) => $"Result 2: {i}", "Func2"), 160AIFunctionFactory.Create((int i) => { }, "VoidReturn"), 206AIFunctionFactory.Create(() => "Result 1", "Func1"), 207AIFunctionFactory.Create((int i) => $"Result 2: {i}", "Func2"), 208AIFunctionFactory.Create((int i) => { }, "VoidReturn"), 255AIFunctionFactory.Create(string () => throw new InvalidOperationException("Oh no!"), "Func1"), 270var func1 = AIFunctionFactory.Create(() => "Some result 1", "Func1"); 271var func2 = AIFunctionFactory.Create(() => "Some result 2", "Func2");
Functions\AIFunctionFactoryTest.cs (17)
18Assert.Throws<ArgumentNullException>(() => AIFunctionFactory.Create(method: null!)); 30func = AIFunctionFactory.Create((string a) => a + " " + a); 33func = AIFunctionFactory.Create((string a, string b) => b + " " + a); 36func = AIFunctionFactory.Create((int a, long b) => a + b); 43AIFunction func = AIFunctionFactory.Create((string a = "test") => a + " " + a); 57func = AIFunctionFactory.Create((AIFunctionContext ctx) => 67func = AIFunctionFactory.Create((int somethingFirst, AIFunctionContext ctx) => 77func = AIFunctionFactory.Create((AIFunctionContext ctx, int somethingAfter = 0) => 91func = AIFunctionFactory.Create(Task<string> (string a) => Task.FromResult(a + " " + a)); 94func = AIFunctionFactory.Create(ValueTask<string> (string a, string b) => new ValueTask<string>(b + " " + a)); 98func = AIFunctionFactory.Create(async Task (int a, long b) => { result = a + b; await Task.Yield(); }); 103func = AIFunctionFactory.Create(async ValueTask (int a, long b) => { result = a + b; await Task.Yield(); }); 107func = AIFunctionFactory.Create((int count) => SimpleIAsyncEnumerable(count)); 119func = AIFunctionFactory.Create(() => (IAsyncEnumerable<int>)new ThrowingAsyncEnumerable()); 135func = AIFunctionFactory.Create(() => "test"); 141func = AIFunctionFactory.Create((string a) => a + " " + a); 146func = AIFunctionFactory.Create(