73 instantiations of AIFunctionArguments
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (1)
1181Arguments = new(callContent.Arguments) { Services = FunctionInvocationServices },
Realtime\FunctionInvokingRealtimeClientSession.cs (1)
334Arguments = new(callContent.Arguments) { Services = FunctionInvocationServices },
Microsoft.Extensions.AI.Abstractions (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.AIFunctionArguments.g.cs (1)
33ObjectCreator = () => new global::Microsoft.Extensions.AI.AIFunctionArguments(),
Microsoft.Extensions.AI.Abstractions.Tests (20)
Contents\FunctionCallContentTests.cs (6)
182AIFunctionArguments arguments = new() 250var result = await function.InvokeAsync(new(arguments)); 271var result = await function.InvokeAsync(new(arguments)); 278AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, JsonDocument>>(""" 296AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, object?>>(""" 314AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, JsonNode>>("""
Functions\AIFunctionArgumentsTests.cs (13)
17var args = new AIFunctionArguments(); 28var args = new AIFunctionArguments(new Dictionary<string, object?>()); 39var args = new AIFunctionArguments(new Dictionary<string, object?> 53var args = new AIFunctionArguments 71IReadOnlyDictionary<string, object?> args = new AIFunctionArguments(new Dictionary<string, object?> 109IDictionary<string, object?> args = new AIFunctionArguments(new Dictionary<string, object?> 176var args = new AIFunctionArguments(comparer); 192var args = new AIFunctionArguments(null, comparer); 214var args = new AIFunctionArguments(originalArgs, comparer); 247var args = new AIFunctionArguments(originalDict, comparer); 271var args = new AIFunctionArguments(originalDict); 272var args2 = new AIFunctionArguments(originalDict, null); 298var args = new AIFunctionArguments(originalDict, StringComparer.OrdinalIgnoreCase);
Generated\361d1da7f942c932\TestJsonSerializerContext.AIFunctionArguments.g.cs (1)
31ObjectCreator = () => new global::Microsoft.Extensions.AI.AIFunctionArguments(),
Microsoft.Extensions.AI.Tests (50)
Functions\AIFunctionFactoryTest.cs (50)
49AssertExtensions.EqualFunctionCallResults("test test", await func.InvokeAsync(new() { ["a"] = "test" })); 52AssertExtensions.EqualFunctionCallResults("hello world", await func.InvokeAsync(new() { ["b"] = "hello", ["a"] = "world" })); 55AssertExtensions.EqualFunctionCallResults(3L, await func.InvokeAsync(new() { ["a"] = 1, ["b"] = 2L })); 63AssertExtensions.EqualFunctionCallResults("hello hello", await func.InvokeAsync(new() { ["a"] = "hello" })); 82AssertExtensions.EqualFunctionCallResults("hello", await funcNull.InvokeAsync(new() { ["text"] = "hello" })); 91AssertExtensions.EqualFunctionCallResults("custom", await funcValue.InvokeAsync(new() { ["text"] = "custom" })); 100AssertExtensions.EqualFunctionCallResults(10, await funcInt.InvokeAsync(new() { ["x"] = 5 })); 135var result = await func.InvokeAsync(new() 165var result = await func.InvokeAsync(new() 185var result = await func.InvokeAsync(new() 219AssertExtensions.EqualFunctionCallResults("test test", await func.InvokeAsync(new() { ["a"] = "test" })); 223AssertExtensions.EqualFunctionCallResults("hello world", await func.InvokeAsync(new() { ["b"] = "hello", ["a"] = "world" })); 228AssertExtensions.EqualFunctionCallResults(null, await func.InvokeAsync(new() { ["a"] = 1, ["b"] = 2L })); 234AssertExtensions.EqualFunctionCallResults(null, await func.InvokeAsync(new() { ["a"] = 1, ["b"] = 2L })); 239AssertExtensions.EqualFunctionCallResults(new int[] { 0, 1, 2, 3, 4 }, await func.InvokeAsync(new() { ["count"] = 5 }), JsonContext.Default.Options); 357AssertExtensions.EqualFunctionCallResults("Name2", await func.InvokeAsync(new() { ["$select"] = "Name", ["top"] = 2 })); 393AssertExtensions.EqualFunctionCallResults("Name", await func.InvokeAsync(new() { ["my_param"] = "Name" })); 397await func.InvokeAsync(new() { ["myParam"] = "Name" })); 410AssertExtensions.EqualFunctionCallResults("param='Name'", await func.InvokeAsync(new() { ["my_param"] = "Name" })); 545var result = (JsonElement?)await func.InvokeAsync(new() 636AIFunctionArguments arguments = new() { ["myInteger"] = 42 }; 696var result = await func.InvokeAsync(new() { ["myInteger"] = 42 }); 724var result = (Tuple<MyFunctionTypeWithOneArg, MyArgumentType>?)await func.InvokeAsync(new() { Services = sp }); 835Exception e = await Assert.ThrowsAsync<ArgumentException>("arguments.Services", () => f.InvokeAsync(new() { ["myInteger"] = 1 }).AsTask()); 837var result = await f.InvokeAsync(new() { ["myInteger"] = 1, Services = sp }); 858Exception e = await Assert.ThrowsAsync<ArgumentException>("arguments.Services", () => f.InvokeAsync(new() { ["myInteger"] = 1 }).AsTask()); 860var result = await f.InvokeAsync(new() { ["myInteger"] = 1, Services = sp }); 880var result = await f.InvokeAsync(new() { ["myInteger"] = 1 }); 883result = await f.InvokeAsync(new() { ["myInteger"] = 1, Services = sp }); 917Exception e = await Assert.ThrowsAsync<ArgumentException>(() => f.InvokeAsync(new() { ["myInteger"] = 1 }).AsTask()); 920e = await Assert.ThrowsAsync<ArgumentException>(() => f.InvokeAsync(new() 927var result = await f.InvokeAsync(new() 951var result = await f.InvokeAsync(new() { Services = sp1 }); 958AIFunctionArguments args1 = new() { ["a"] = 42 }; 959AIFunctionArguments args2 = new() { ["a"] = 43 }; 991object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 1014object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 1037object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 1060object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 1083object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 1106object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 1129object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 1153object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 1702await func.InvokeAsync(new() 1711object? result = await func.InvokeAsync(new() 1726object? result = await func.InvokeAsync(new() 1748AIFunctionArguments caseInsensitive = new(StringComparer.OrdinalIgnoreCase) 1756AIFunctionArguments withExtra = new(StringComparer.OrdinalIgnoreCase) 1783await func.InvokeAsync(new() { ["phase"] = "completed" })); 1808object? result = await func.InvokeAsync(new()
146 references to AIFunctionArguments
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvocationContext.cs (1)
33public AIFunctionArguments Arguments
Microsoft.Extensions.AI.Abstractions (100)
Functions\AIFunction.cs (2)
35AIFunctionArguments? arguments = null, 44AIFunctionArguments arguments,
Functions\AIFunctionArguments.cs (5)
20/// <see cref="AIFunctionArguments"/> is a dictionary of name/value pairs that are used 32/// <summary>Initializes a new instance of the <see cref="AIFunctionArguments"/> class, and uses the default comparer for key comparisons.</summary> 40/// Initializes a new instance of the <see cref="AIFunctionArguments"/> class containing 58/// <summary>Initializes a new instance of the <see cref="AIFunctionArguments"/> class.</summary> 66/// Initializes a new instance of the <see cref="AIFunctionArguments"/> class containing
Functions\AIFunctionFactory.cs (79)
60/// By default, any parameters to <paramref name="method"/> are sourced from the <see cref="AIFunctionArguments"/>'s dictionary 70/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.Services"/> property 72/// <see cref="AIFunctionArguments.Services"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.Services"/> 77/// By default, <see cref="AIFunctionArguments"/> parameters are bound directly to <see cref="AIFunctionArguments"/> instance 78/// passed into <see cref="AIFunction.InvokeAsync"/> and are not included in the JSON schema. If the <see cref="AIFunctionArguments"/> 80/// manufactures an empty instance, such that parameters of type <see cref="AIFunctionArguments"/> can always be satisfied, whether 81/// optional or not. The handling of <see cref="AIFunctionArguments"/> parameters can be overridden via 85/// All other parameter types are, by default, bound from the <see cref="AIFunctionArguments"/> dictionary passed into <see cref="AIFunction.InvokeAsync"/> 89/// <see cref="AIFunctionArguments"/> dictionary will result in an exception being thrown). Loosely-typed additional context information can be passed 90/// into <see cref="AIFunction.InvokeAsync"/> via the <see cref="AIFunctionArguments"/>'s <see cref="AIFunctionArguments.Context"/> dictionary; the default 95/// The default marshaling of parameters from the <see cref="AIFunctionArguments"/> dictionary permits values to be passed into the <paramref name="method"/>'s 102/// In general, the data supplied via an <see cref="AIFunctionArguments"/>'s dictionary is supplied from an AI service and should be considered 149/// Any parameters to <paramref name="method"/> are sourced from the <see cref="AIFunctionArguments"/>'s dictionary 159/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.Services"/> property 161/// <see cref="AIFunctionArguments.Services"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.Services"/> 165/// By default, <see cref="AIFunctionArguments"/> parameters are bound directly to <see cref="AIFunctionArguments"/> instance 166/// passed into <see cref="AIFunction.InvokeAsync"/> and are not included in the JSON schema. If the <see cref="AIFunctionArguments"/> 168/// manufactures an empty instance, such that parameters of type <see cref="AIFunctionArguments"/> can always be satisfied, whether 172/// All other parameter types are bound from the <see cref="AIFunctionArguments"/> dictionary passed into <see cref="AIFunction.InvokeAsync"/> 176/// The marshaling of parameters from the <see cref="AIFunctionArguments"/> dictionary permits values to be passed into the <paramref name="method"/>'s 183/// In general, the data supplied via an <see cref="AIFunctionArguments"/>'s dictionary is supplied from an AI service and should be considered 231/// By default, any parameters to <paramref name="method"/> are sourced from the <see cref="AIFunctionArguments"/>'s dictionary 241/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.Services"/> property 243/// <see cref="AIFunctionArguments.Services"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.Services"/> 248/// By default, <see cref="AIFunctionArguments"/> parameters are bound directly to <see cref="AIFunctionArguments"/> instance 249/// passed into <see cref="AIFunction.InvokeAsync"/> and are not included in the JSON schema. If the <see cref="AIFunctionArguments"/> 251/// manufactures an empty instance, such that parameters of type <see cref="AIFunctionArguments"/> can always be satisfied, whether 252/// optional or not. The handling of <see cref="AIFunctionArguments"/> parameters can be overridden via 256/// All other parameter types are, by default, bound from the <see cref="AIFunctionArguments"/> dictionary passed into <see cref="AIFunction.InvokeAsync"/> 260/// <see cref="AIFunctionArguments"/> dictionary will result in an exception being thrown). Loosely typed additional context information can be passed 261/// into <see cref="AIFunction.InvokeAsync"/> via the <see cref="AIFunctionArguments"/>'s <see cref="AIFunctionArguments.Context"/> dictionary; the default 266/// The default marshaling of parameters from the <see cref="AIFunctionArguments"/> dictionary permits values to be passed into the <paramref name="method"/>'s 273/// In general, the data supplied via an <see cref="AIFunctionArguments"/>'s dictionary is supplied from an AI service and should be considered 328/// Any parameters to <paramref name="method"/> are sourced from the <see cref="AIFunctionArguments"/>'s dictionary 338/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.Services"/> property 340/// <see cref="AIFunctionArguments.Services"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.Services"/> 344/// By default, <see cref="AIFunctionArguments"/> parameters are bound directly to <see cref="AIFunctionArguments"/> instance 345/// passed into <see cref="AIFunction.InvokeAsync"/> and are not included in the JSON schema. If the <see cref="AIFunctionArguments"/> 347/// manufactures an empty instance, such that parameters of type <see cref="AIFunctionArguments"/> can always be satisfied, whether 351/// All other parameter types are bound from the <see cref="AIFunctionArguments"/> dictionary passed into <see cref="AIFunction.InvokeAsync"/> 355/// The marshaling of parameters from the <see cref="AIFunctionArguments"/> dictionary permits values to be passed into the <paramref name="method"/>'s 362/// In general, the data supplied via an <see cref="AIFunctionArguments"/>'s dictionary is supplied from an AI service and should be considered 423/// By default, any parameters to <paramref name="method"/> are sourced from the <see cref="AIFunctionArguments"/>'s dictionary 433/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.Services"/> property 435/// <see cref="AIFunctionArguments.Services"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.Services"/> 440/// By default, <see cref="AIFunctionArguments"/> parameters are bound directly to <see cref="AIFunctionArguments"/> instance 441/// passed into <see cref="AIFunction.InvokeAsync"/> and are not included in the JSON schema. If the <see cref="AIFunctionArguments"/> 443/// manufactures an empty instance, such that parameters of type <see cref="AIFunctionArguments"/> can always be satisfied, whether 444/// optional or not. The handling of <see cref="AIFunctionArguments"/> parameters can be overridden via 448/// All other parameter types are, by default, bound from the <see cref="AIFunctionArguments"/> dictionary passed into <see cref="AIFunction.InvokeAsync"/> 452/// <see cref="AIFunctionArguments"/> dictionary will result in an exception being thrown). Loosely-typed additional context information can be passed 453/// into <see cref="AIFunction.InvokeAsync"/> via the <see cref="AIFunctionArguments"/>'s <see cref="AIFunctionArguments.Context"/> dictionary; the default 458/// The default marshaling of parameters from the <see cref="AIFunctionArguments"/> dictionary permits values to be passed into the <paramref name="method"/>'s 465/// In general, the data supplied via an <see cref="AIFunctionArguments"/>'s dictionary is supplied from an AI service and should be considered 494Func<AIFunctionArguments, object> createInstanceFunc, 560Func<AIFunctionArguments, object> createInstanceFunc, 588Func<AIFunctionArguments, object> createInstanceFunc, 598public Func<AIFunctionArguments, object>? CreateInstanceFunc { get; } 609AIFunctionArguments arguments, 759if (parameterInfo.ParameterType == typeof(AIFunctionArguments) || 788ParameterMarshallers = parameters.Length > 0 ? new Func<AIFunctionArguments, CancellationToken, object?>[parameters.Length] : []; 812pType != typeof(AIFunctionArguments) && 852public Func<AIFunctionArguments, CancellationToken, object?>[] ParameterMarshallers { get; } 908private static Func<AIFunctionArguments, CancellationToken, object?> GetParameterMarshaller( 938if (parameterType == typeof(AIFunctionArguments)) 1023Throw.ArgumentNullException($"arguments.{nameof(AIFunctionArguments.Services)}", $"Services are required for parameter '{parameterName}'.");
Functions\AIFunctionFactoryOptions.cs (2)
34/// the produced <see cref="AIFunction"/> throws if the supplied <see cref="AIFunctionArguments"/> contains keys 150public Func<ParameterInfo, AIFunctionArguments, object?>? BindParameter { get; init; }
Functions\DelegatingAIFunction.cs (1)
57protected override ValueTask<object?> InvokeCoreAsync(AIFunctionArguments arguments, CancellationToken cancellationToken) =>
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.AIFunctionArguments.g.cs (9)
15private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments>? _AIFunctionArguments; 21public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments> AIFunctionArguments 24get => _AIFunctionArguments ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.AIFunctionArguments)); 27private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments> Create_AIFunctionArguments(global::System.Text.Json.JsonSerializerOptions options) 29if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.AIFunctionArguments>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments> jsonTypeInfo)) 31var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<global::Microsoft.Extensions.AI.AIFunctionArguments> 37jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateIDictionaryInfo<global::Microsoft.Extensions.AI.AIFunctionArguments, string, object>(options, info);
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
68if (type == typeof(global::Microsoft.Extensions.AI.AIFunctionArguments))
Utilities\AIJsonUtilities.Defaults.cs (1)
95[JsonSerializable(typeof(AIFunctionArguments))]
Microsoft.Extensions.AI.Abstractions.Tests (32)
Contents\FunctionCallContentTests.cs (7)
182AIFunctionArguments arguments = new() 202AIFunctionArguments arguments = JsonSerializer.Deserialize<AIFunctionArguments>(""" 278AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, JsonDocument>>(""" 296AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, object?>>(""" 314AIFunctionArguments arguments = new(JsonSerializer.Deserialize<Dictionary<string, JsonNode>>(""" 337protected override ValueTask<object?> InvokeCoreAsync(AIFunctionArguments arguments, CancellationToken cancellationToken) =>
Functions\AIFunctionArgumentsTests.cs (11)
17var args = new AIFunctionArguments(); 28var args = new AIFunctionArguments(new Dictionary<string, object?>()); 39var args = new AIFunctionArguments(new Dictionary<string, object?> 53var args = new AIFunctionArguments 176var args = new AIFunctionArguments(comparer); 192var args = new AIFunctionArguments(null, comparer); 214var args = new AIFunctionArguments(originalArgs, comparer); 247var args = new AIFunctionArguments(originalDict, comparer); 271var args = new AIFunctionArguments(originalDict); 272var args2 = new AIFunctionArguments(originalDict, null); 298var args = new AIFunctionArguments(originalDict, StringComparer.OrdinalIgnoreCase);
Functions\AIFunctionTests.cs (1)
24protected override ValueTask<object?> InvokeCoreAsync(AIFunctionArguments arguments, CancellationToken cancellationToken)
Functions\DelegatingAIFunctionTests.cs (2)
88private sealed class OverridesInvocation(AIFunction innerFunction, Func<AIFunctionArguments, CancellationToken, ValueTask<object?>> invokeAsync) : DelegatingAIFunction(innerFunction) 90protected override ValueTask<object?> InvokeCoreAsync(AIFunctionArguments arguments, CancellationToken cancellationToken) =>
Generated\361d1da7f942c932\TestJsonSerializerContext.AIFunctionArguments.g.cs (9)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments>? _AIFunctionArguments; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments> AIFunctionArguments 22get => _AIFunctionArguments ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.AIFunctionArguments)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments> Create_AIFunctionArguments(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.AIFunctionArguments>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIFunctionArguments> jsonTypeInfo)) 29var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<global::Microsoft.Extensions.AI.AIFunctionArguments> 35jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateIDictionaryInfo<global::Microsoft.Extensions.AI.AIFunctionArguments, string, object>(options, info);
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
62if (type == typeof(global::Microsoft.Extensions.AI.AIFunctionArguments))
TestJsonSerializerContext.cs (1)
32[JsonSerializable(typeof(AIFunctionArguments))]
Microsoft.Extensions.AI.Integration.Tests (1)
ChatClientIntegrationTests.cs (1)
516protected override ValueTask<object?> InvokeCoreAsync(AIFunctionArguments arguments, CancellationToken cancellationToken) => throw new NotSupportedException();
Microsoft.Extensions.AI.Tests (12)
Functions\AIFunctionFactoryTest.cs (12)
39AIFunctionFactory.Create(typeof(AIFunctionFactoryTest).GetMethod(nameof(InvalidArguments_Throw))!, (Func<AIFunctionArguments, object>)null!)); 636AIFunctionArguments arguments = new() { ["myInteger"] = 42 }; 642AIFunctionArguments arguments1, 643AIFunctionArguments arguments2, 645AIFunctionArguments? arguments3, 647AIFunctionArguments? arguments4 = null) => 684AIFunctionArguments? arguments = null, 958AIFunctionArguments args1 = new() { ["a"] = 42 }; 959AIFunctionArguments args2 = new() { ["a"] = 43 }; 962(AIFunctionArguments args) => (int)args["a"]!, 1748AIFunctionArguments caseInsensitive = new(StringComparer.OrdinalIgnoreCase) 1756AIFunctionArguments withExtra = new(StringComparer.OrdinalIgnoreCase)