60 references to Create
Microsoft.Extensions.AI.Abstractions.Tests (6)
ChatCompletion\ChatOptionsTests.cs (4)
59AIFunctionFactory.Create(() => 42), 60AIFunctionFactory.Create(() => 43), 141AIFunctionFactory.Create(() => 42), 142AIFunctionFactory.Create(() => 43),
Utilities\AIJsonUtilitiesTests.cs (2)
216AIFunction func = AIFunctionFactory.Create((int x, int y) => x + y, serializerOptions: options); 237AIFunction func = AIFunctionFactory.Create((int a, int? b, long c, short d) => { }, serializerOptions: options);
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
AzureAIInferenceChatClientTests.cs (2)
512Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 604Tools = [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)
175Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")] 198Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 214Tools = [AIFunctionFactory.Create((int a, int b) => a * b, "SecretComputation")] 242Tools = [AIFunctionFactory.Create((string personName) => 264var tool = AIFunctionFactory.Create(() => 288var getSecretNumberTool = AIFunctionFactory.Create(() => 123, "GetSecretNumber"); 289var shieldsUpTool = AIFunctionFactory.Create(() => shieldsUp = true, "ShieldsUp");
Microsoft.Extensions.AI.Ollama.Tests (5)
OllamaChatClientIntegrationTests.cs (3)
51Tools = [AIFunctionFactory.Create(() => secretNumber, "GetSecretNumber")], 72var stockPriceTool = AIFunctionFactory.Create([Description("Returns the stock price for a given ticker symbol")] ( 82var irrelevantTool = AIFunctionFactory.Create(() => { didCallIrrelevantTool = true; return 123; }, "GetSecretNumber");
OllamaChatClientTests.cs (2)
367Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 465Tools = [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 (5)
OpenAIChatClientTests.cs (2)
660Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")], 755Tools = [AIFunctionFactory.Create(([Description("The person whose age is being requested")] string personName) => 42, "GetPersonAge", "Gets the age of the specified person.")],
OpenAIRealtimeIntegrationTests.cs (1)
31var roomCapacityTool = AIFunctionFactory.Create(GetRoomCapacity);
OpenAIRealtimeTests.cs (2)
22var input = AIFunctionFactory.Create(() => { }, "MyFunction", "MyDescription"); 32var input = AIFunctionFactory.Create(MyFunction);
Microsoft.Extensions.AI.Tests (35)
ChatCompletion\FunctionInvokingChatClientTests.cs (18)
49AIFunctionFactory.Create(() => "Result 1", "Func1"), 50AIFunctionFactory.Create((int i) => $"Result 2: {i}", "Func2"), 51AIFunctionFactory.Create((int i) => { }, "VoidReturn"), 81AIFunctionFactory.Create((int i) => "Result 1", "Func1"), 82AIFunctionFactory.Create((int i) => $"Result 2: {i}", "Func2"), 130AIFunctionFactory.Create((string arg) => 170AIFunctionFactory.Create(async (string arg) => 211AIFunctionFactory.Create(() => "Result 1", "Func1"), 212AIFunctionFactory.Create((int i) => $"Result 2: {i}", "Func2"), 213AIFunctionFactory.Create((int i) => { }, "VoidReturn"), 263AIFunctionFactory.Create(() => "Result 1", "Func1"), 264AIFunctionFactory.Create((int i) => $"Result 2: {i}", "Func2"), 265AIFunctionFactory.Create((int i) => { }, "VoidReturn"), 331AIFunctionFactory.Create(string () => throw new InvalidOperationException("Oh no!"), "Func1"), 353var func1 = AIFunctionFactory.Create(() => "Some result 1", "Func1"); 354var func2 = AIFunctionFactory.Create(() => "Some result 2", "Func2"); 404Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")] 460Tools = [AIFunctionFactory.Create(() => "Result 1", "Func1")]
Functions\AIFunctionFactoryTest.cs (17)
18Assert.Throws<ArgumentNullException>("method", () => 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(