72 references to GetService
Aspire.Azure.AI.OpenAI.Tests (4)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (4)
40Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.DefaultModelId); 70Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.DefaultModelId); 98Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.DefaultModelId); 190Assert.Equal(disableOpenTelemetry, client.GetService<OpenTelemetryChatClient>() is null);
Aspire.OpenAI.Tests (4)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (4)
43Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.DefaultModelId); 73Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.DefaultModelId); 101Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.DefaultModelId); 193Assert.Equal(disableOpenTelemetry, client.GetService<OpenTelemetryChatClient>() is null);
Microsoft.Extensions.AI (4)
ChatCompletion\FunctionInvokingChatClient.cs (1)
78_activitySource = innerClient.GetService<ActivitySource>();
ChatCompletion\LoggingChatClient.cs (2)
53LogInvokedSensitive(nameof(GetResponseAsync), AsJson(messages), AsJson(options), AsJson(this.GetService<ChatClientMetadata>())); 99LogInvokedSensitive(nameof(GetStreamingResponseAsync), AsJson(messages), AsJson(options), AsJson(this.GetService<ChatClientMetadata>()));
ChatCompletion\OpenTelemetryChatClient.cs (1)
60if (innerClient!.GetService<ChatClientMetadata>() is ChatClientMetadata metadata)
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\ChatClientExtensionsTests.cs (7)
17Assert.Throws<ArgumentNullException>("client", () => ChatClientExtensions.GetService<object>(null!)); 51Assert.Equal("null key", client.GetService<string>()); 52Assert.Equal("null key", client.GetService<string>(null)); 53Assert.Equal("non-null key", client.GetService<string>("key")); 55Assert.Null(client.GetService<object>()); 56Assert.Null(client.GetService<object>("key")); 57Assert.Null(client.GetService<IChatClient>());
Microsoft.Extensions.AI.AzureAIInference.Tests (12)
AzureAIInferenceChatClientTests.cs (12)
44var metadata = chatClient.GetService<ChatClientMetadata>(); 56Assert.Same(chatClient, chatClient.GetService<IChatClient>()); 57Assert.Same(client, chatClient.GetService<ChatCompletionsClient>()); 66Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 67Assert.NotNull(pipeline.GetService<DistributedCachingChatClient>()); 68Assert.NotNull(pipeline.GetService<CachingChatClient>()); 69Assert.NotNull(pipeline.GetService<OpenTelemetryChatClient>()); 70Assert.NotNull(pipeline.GetService<object>()); 72Assert.Same(client, pipeline.GetService<ChatCompletionsClient>()); 73Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>()); 75Assert.Null(pipeline.GetService<ChatCompletionsClient>("key")); 76Assert.Null(pipeline.GetService<string>("key"));
Microsoft.Extensions.AI.Evaluation.Integration.Tests (2)
QualityEvaluatorTests.cs (1)
38ChatClientMetadata? clientMetadata = chatConfiguration.ChatClient.GetService<ChatClientMetadata>();
SafetyEvaluatorTests.cs (1)
37ChatClientMetadata? clientMetadata = llmChatConfiguration.ChatClient.GetService<ChatClientMetadata>();
Microsoft.Extensions.AI.Evaluation.Reporting (1)
ReportingConfiguration.cs (1)
266ChatClientMetadata? metadata = chatClient.GetService<ChatClientMetadata>();
Microsoft.Extensions.AI.Evaluation.Safety (1)
ContentSafetyChatClient.cs (1)
34ChatClientMetadata? originalMetadata = _originalChatClient?.GetService<ChatClientMetadata>();
Microsoft.Extensions.AI.Ollama.Tests (9)
OllamaChatClientTests.cs (9)
48Assert.Same(client, client.GetService<OllamaChatClient>()); 49Assert.Same(client, client.GetService<IChatClient>()); 58Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 59Assert.NotNull(pipeline.GetService<DistributedCachingChatClient>()); 60Assert.NotNull(pipeline.GetService<CachingChatClient>()); 61Assert.NotNull(pipeline.GetService<OpenTelemetryChatClient>()); 63Assert.Same(client, pipeline.GetService<OllamaChatClient>()); 64Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>()); 74var metadata = chatClient.GetService<ChatClientMetadata>();
Microsoft.Extensions.AI.OpenAI.Tests (28)
OpenAIChatClientTests.cs (19)
44var metadata = chatClient.GetService<ChatClientMetadata>(); 50metadata = chatClient.GetService<ChatClientMetadata>(); 62Assert.Same(chatClient, chatClient.GetService<IChatClient>()); 64Assert.Same(openAIClient, chatClient.GetService<ChatClient>()); 66Assert.NotNull(chatClient.GetService<ChatClient>()); 75Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 76Assert.NotNull(pipeline.GetService<DistributedCachingChatClient>()); 77Assert.NotNull(pipeline.GetService<CachingChatClient>()); 78Assert.NotNull(pipeline.GetService<OpenTelemetryChatClient>()); 80Assert.Same(openAIClient, pipeline.GetService<ChatClient>()); 81Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>()); 90Assert.Same(chatClient, chatClient.GetService<IChatClient>()); 91Assert.Same(openAIClient, chatClient.GetService<ChatClient>()); 100Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 101Assert.NotNull(pipeline.GetService<DistributedCachingChatClient>()); 102Assert.NotNull(pipeline.GetService<CachingChatClient>()); 103Assert.NotNull(pipeline.GetService<OpenTelemetryChatClient>()); 105Assert.Same(openAIClient, pipeline.GetService<ChatClient>()); 106Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());
OpenAIResponseClientTests.cs (9)
43var metadata = chatClient.GetService<ChatClientMetadata>(); 55Assert.Same(chatClient, chatClient.GetService<IChatClient>()); 56Assert.Same(openAIClient, chatClient.GetService<OpenAIResponseClient>()); 65Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 66Assert.NotNull(pipeline.GetService<DistributedCachingChatClient>()); 67Assert.NotNull(pipeline.GetService<CachingChatClient>()); 68Assert.NotNull(pipeline.GetService<OpenTelemetryChatClient>()); 70Assert.Same(openAIClient, pipeline.GetService<OpenAIResponseClient>()); 71Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());