14 writes to Services
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
688
Arguments = new(callContent.Arguments) {
Services
= _functionInvocationServices },
Microsoft.Extensions.AI.Abstractions.Tests (1)
Functions\AIFunctionArgumentsTests.cs (1)
55
Services
= sp
Microsoft.Extensions.AI.Tests (12)
Functions\AIFunctionFactoryTest.cs (12)
269
arguments.
Services
= sp;
317
await Assert.ThrowsAsync<ArgumentException>("arguments", () => func.InvokeAsync(new() {
Services
= sp }).AsTask());
330
Assert.Contains("456", (await func.InvokeAsync(new() {
Services
= sp }))?.ToString());
341
await Assert.ThrowsAsync<ArgumentException>("arguments", () => func.InvokeAsync(new() {
Services
= new ServiceCollection().BuildServiceProvider() }).AsTask());
342
Assert.Contains("123", (await func.InvokeAsync(new() {
Services
= sp }))?.ToString());
348
Assert.Contains("123", (await func.InvokeAsync(new() {
Services
= sp }))?.ToString());
371
var result = (Tuple<MyFunctionTypeWithOneArg, MyArgumentType>?)await func.InvokeAsync(new() {
Services
= sp });
401
await Assert.ThrowsAsync<InvalidOperationException>(async () => await func.InvokeAsync(new() {
Services
= sp }));
496
var result = await f.InvokeAsync(new() { ["myInteger"] = 1,
Services
= sp });
517
var result = await f.InvokeAsync(new() { ["myInteger"] = 1,
Services
= sp });
539
result = await f.InvokeAsync(new() { ["myInteger"] = 1,
Services
= sp });
607
var result = await f.InvokeAsync(new() {
Services
= sp1 });
48 references to Services
Microsoft.Extensions.AI (44)
Functions\AIFunctionFactory.cs (43)
57
/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.
Services
"/> property
59
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
76
/// By default, parameters attributed with <see cref="FromKeyedServicesAttribute"/> are resolved from the <see cref="AIFunctionArguments.
Services
"/>
78
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
88
/// from the <see cref="IServiceProvider"/> provided to <see cref="AIFunction.InvokeAsync"/> via <see cref="AIFunctionArguments.
Services
"/>,
158
/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.
Services
"/> property
160
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
175
/// By default, parameters attributed with <see cref="FromKeyedServicesAttribute"/> are resolved from the <see cref="AIFunctionArguments.
Services
"/>
177
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
186
/// from the <see cref="IServiceProvider"/> provided to <see cref="AIFunction.InvokeAsync"/> via <see cref="AIFunctionArguments.
Services
"/>,
256
/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.
Services
"/> property
258
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
275
/// By default, parameters attributed with <see cref="FromKeyedServicesAttribute"/> are resolved from the <see cref="AIFunctionArguments.
Services
"/>
277
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
287
/// from the <see cref="IServiceProvider"/> provided to <see cref="AIFunction.InvokeAsync"/> via <see cref="AIFunctionArguments.
Services
"/>,
367
/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.
Services
"/> property
369
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
384
/// By default, parameters attributed with <see cref="FromKeyedServicesAttribute"/> are resolved from the <see cref="AIFunctionArguments.
Services
"/>
386
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
394
/// from the <see cref="IServiceProvider"/> provided to <see cref="AIFunction.InvokeAsync"/> via <see cref="AIFunctionArguments.
Services
"/>,
450
/// the resulting <see cref="AIFunction"/> is invoked. If <see cref="AIFunctionArguments.
Services
"/> is provided,
480
/// By default, <see cref="IServiceProvider"/> parameters are bound from the <see cref="AIFunctionArguments.
Services
"/> property
482
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
499
/// By default, parameters attributed with <see cref="FromKeyedServicesAttribute"/> are resolved from the <see cref="AIFunctionArguments.
Services
"/>
501
/// <see cref="AIFunctionArguments.
Services
"/> is allowed to be <see langword="null"/>; otherwise, <see cref="AIFunctionArguments.
Services
"/>
511
/// from the <see cref="IServiceProvider"/> provided to <see cref="AIFunction.InvokeAsync"/> via <see cref="AIFunctionArguments.
Services
"/>,
657
target = arguments.
Services
is { } services ?
904
IServiceProvider? services = arguments.
Services
;
919
if ((arguments.
Services
as IKeyedServiceProvider)?.GetKeyedService(parameterType, keyedAttr.Key) is { } service)
926
if (arguments.
Services
is null)
945
if (arguments.
Services
?.GetService(parameterType) is { } service)
952
if (arguments.
Services
is null)
1009
Throw.ArgumentNullException($"arguments.{nameof(AIFunctionArguments.
Services
)}", $"Services are required for parameter '{parameterName}'.");
Functions\AIFunctionFactoryOptions.cs (1)
115
/// <see cref="AIFunction.InvokeAsync"/> via <see cref="AIFunctionArguments.
Services
"/>.
Microsoft.Extensions.AI.Abstractions.Tests (4)
Functions\AIFunctionArgumentsTests.cs (4)
18
Assert.Null(args.
Services
);
29
Assert.Null(args.
Services
);
43
Assert.Null(args.
Services
);
58
Assert.Same(sp, args.
Services
);