63 references to GetService
Aspire.Azure.AI.OpenAI.Tests (4)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (4)
40Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.ModelId); 70Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.ModelId); 98Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.ModelId); 190Assert.Equal(disableOpenTelemetry, client.GetService<OpenTelemetryChatClient>() is null);
Aspire.OpenAI.Tests (4)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (4)
43Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.ModelId); 73Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.ModelId); 101Assert.Equal("testdeployment1", client.GetService<ChatClientMetadata>()?.ModelId); 193Assert.Equal(disableOpenTelemetry, client.GetService<OpenTelemetryChatClient>() is null);
Microsoft.Extensions.AI (4)
ChatCompletion\FunctionInvokingChatClient.cs (1)
70_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)
58if (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 (14)
AzureAIInferenceChatClientTests.cs (14)
66var metadata = chatClient.GetService<ChatClientMetadata>(); 78Assert.Same(chatClient, chatClient.GetService<IChatClient>()); 79Assert.Same(chatClient, chatClient.GetService<AzureAIInferenceChatClient>()); 81Assert.Same(client, chatClient.GetService<ChatCompletionsClient>()); 90Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 91Assert.NotNull(pipeline.GetService<DistributedCachingChatClient>()); 92Assert.NotNull(pipeline.GetService<CachingChatClient>()); 93Assert.NotNull(pipeline.GetService<OpenTelemetryChatClient>()); 94Assert.NotNull(pipeline.GetService<object>()); 96Assert.Same(client, pipeline.GetService<ChatCompletionsClient>()); 97Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>()); 99Assert.Null(pipeline.GetService<ChatCompletionsClient>("key")); 100Assert.Null(pipeline.GetService<AzureAIInferenceChatClient>("key")); 101Assert.Null(pipeline.GetService<string>("key"));
Microsoft.Extensions.AI.Evaluation.Reporting (1)
ReportingConfiguration.cs (1)
218var metadata = chatClient.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 (20)
OpenAIChatClientTests.cs (20)
75var metadata = chatClient.GetService<ChatClientMetadata>(); 81metadata = chatClient.GetService<ChatClientMetadata>(); 93Assert.Same(chatClient, chatClient.GetService<IChatClient>()); 94Assert.Same(chatClient, chatClient.GetService<OpenAIChatClient>()); 96Assert.Same(openAIClient, chatClient.GetService<OpenAIClient>()); 98Assert.NotNull(chatClient.GetService<ChatClient>()); 107Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 108Assert.NotNull(pipeline.GetService<DistributedCachingChatClient>()); 109Assert.NotNull(pipeline.GetService<CachingChatClient>()); 110Assert.NotNull(pipeline.GetService<OpenTelemetryChatClient>()); 112Assert.Same(openAIClient, pipeline.GetService<OpenAIClient>()); 113Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>()); 122Assert.Same(chatClient, chatClient.GetService<IChatClient>()); 123Assert.Same(openAIClient, chatClient.GetService<ChatClient>()); 132Assert.NotNull(pipeline.GetService<FunctionInvokingChatClient>()); 133Assert.NotNull(pipeline.GetService<DistributedCachingChatClient>()); 134Assert.NotNull(pipeline.GetService<CachingChatClient>()); 135Assert.NotNull(pipeline.GetService<OpenTelemetryChatClient>()); 137Assert.Same(openAIClient, pipeline.GetService<ChatClient>()); 138Assert.IsType<FunctionInvokingChatClient>(pipeline.GetService<IChatClient>());