15 references to GetService
Microsoft.Extensions.AI (4)
ChatCompletion\FunctionInvokingChatClient.cs (3)
528
.Where(t => t.
GetService
<ApprovalRequiredAIFunction>() is not null)
738
anyRequireApproval |= tool.
GetService
<ApprovalRequiredAIFunction>() is not null;
1565
if (t.Value.
GetService
<ApprovalRequiredAIFunction>() is { } araf && araf.Name == functionCall.Name)
ChatCompletion\OpenTelemetryChatClient.cs (1)
458
_ when t.
GetService
<AIFunctionDeclaration>() is { } af => new OtelFunction
Microsoft.Extensions.AI.Abstractions.Tests (8)
Functions\DelegatingAIFunctionTests.cs (1)
35
Assert.Same(expected, actual.
GetService
<ApprovalRequiredAIFunction>());
Tools\AIToolTests.cs (7)
32
Assert.Same(tool, tool.
GetService
<object>());
33
Assert.Same(tool, tool.
GetService
<AITool>());
34
Assert.Same(tool, tool.
GetService
<DerivedAITool>());
37
Assert.Null(tool.
GetService
<string>());
38
Assert.Null(tool.
GetService
<object>("key"));
39
Assert.Null(tool.
GetService
<AITool>("key"));
40
Assert.Null(tool.
GetService
<DerivedAITool>("key"));
Microsoft.Extensions.AI.OpenAI.Tests (3)
OpenAIConversionTests.cs (3)
1521
Assert.Same(rawSearchTool, options.Tools[0].
GetService
<ResponseTool>());
1522
Assert.Same(rawSearchTool, options.Tools[0].
GetService
<WebSearchTool>());
1523
Assert.Null(options.Tools[0].
GetService
<ResponseTool>("key"));