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