63 references to GetService
Aspire.Azure.AI.OpenAI.Tests (4)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (4)
40
Assert.Equal("testdeployment1", client.
GetService
<ChatClientMetadata>()?.ModelId);
70
Assert.Equal("testdeployment1", client.
GetService
<ChatClientMetadata>()?.ModelId);
98
Assert.Equal("testdeployment1", client.
GetService
<ChatClientMetadata>()?.ModelId);
190
Assert.Equal(disableOpenTelemetry, client.
GetService
<OpenTelemetryChatClient>() is null);
Aspire.OpenAI.Tests (4)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (4)
43
Assert.Equal("testdeployment1", client.
GetService
<ChatClientMetadata>()?.ModelId);
73
Assert.Equal("testdeployment1", client.
GetService
<ChatClientMetadata>()?.ModelId);
101
Assert.Equal("testdeployment1", client.
GetService
<ChatClientMetadata>()?.ModelId);
193
Assert.Equal(disableOpenTelemetry, client.
GetService
<OpenTelemetryChatClient>() is null);
Microsoft.Extensions.AI (4)
ChatCompletion\FunctionInvokingChatClient.cs (1)
70
_activitySource = innerClient.
GetService
<ActivitySource>();
ChatCompletion\LoggingChatClient.cs (2)
53
LogInvokedSensitive(nameof(GetResponseAsync), AsJson(messages), AsJson(options), AsJson(this.
GetService
<ChatClientMetadata>()));
99
LogInvokedSensitive(nameof(GetStreamingResponseAsync), AsJson(messages), AsJson(options), AsJson(this.
GetService
<ChatClientMetadata>()));
ChatCompletion\OpenTelemetryChatClient.cs (1)
58
if (innerClient!.
GetService
<ChatClientMetadata>() is ChatClientMetadata metadata)
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\ChatClientExtensionsTests.cs (7)
17
Assert.Throws<ArgumentNullException>("client", () => ChatClientExtensions.
GetService
<object>(null!));
51
Assert.Equal("null key", client.
GetService
<string>());
52
Assert.Equal("null key", client.
GetService
<string>(null));
53
Assert.Equal("non-null key", client.
GetService
<string>("key"));
55
Assert.Null(client.
GetService
<object>());
56
Assert.Null(client.
GetService
<object>("key"));
57
Assert.Null(client.
GetService
<IChatClient>());
Microsoft.Extensions.AI.AzureAIInference.Tests (14)
AzureAIInferenceChatClientTests.cs (14)
66
var metadata = chatClient.
GetService
<ChatClientMetadata>();
78
Assert.Same(chatClient, chatClient.
GetService
<IChatClient>());
79
Assert.Same(chatClient, chatClient.
GetService
<AzureAIInferenceChatClient>());
81
Assert.Same(client, chatClient.
GetService
<ChatCompletionsClient>());
90
Assert.NotNull(pipeline.
GetService
<FunctionInvokingChatClient>());
91
Assert.NotNull(pipeline.
GetService
<DistributedCachingChatClient>());
92
Assert.NotNull(pipeline.
GetService
<CachingChatClient>());
93
Assert.NotNull(pipeline.
GetService
<OpenTelemetryChatClient>());
94
Assert.NotNull(pipeline.
GetService
<object>());
96
Assert.Same(client, pipeline.
GetService
<ChatCompletionsClient>());
97
Assert.IsType<FunctionInvokingChatClient>(pipeline.
GetService
<IChatClient>());
99
Assert.Null(pipeline.
GetService
<ChatCompletionsClient>("key"));
100
Assert.Null(pipeline.
GetService
<AzureAIInferenceChatClient>("key"));
101
Assert.Null(pipeline.
GetService
<string>("key"));
Microsoft.Extensions.AI.Evaluation.Reporting (1)
ReportingConfiguration.cs (1)
218
var metadata = chatClient.
GetService
<ChatClientMetadata>();
Microsoft.Extensions.AI.Ollama.Tests (9)
OllamaChatClientTests.cs (9)
48
Assert.Same(client, client.
GetService
<OllamaChatClient>());
49
Assert.Same(client, client.
GetService
<IChatClient>());
58
Assert.NotNull(pipeline.
GetService
<FunctionInvokingChatClient>());
59
Assert.NotNull(pipeline.
GetService
<DistributedCachingChatClient>());
60
Assert.NotNull(pipeline.
GetService
<CachingChatClient>());
61
Assert.NotNull(pipeline.
GetService
<OpenTelemetryChatClient>());
63
Assert.Same(client, pipeline.
GetService
<OllamaChatClient>());
64
Assert.IsType<FunctionInvokingChatClient>(pipeline.
GetService
<IChatClient>());
74
var metadata = chatClient.
GetService
<ChatClientMetadata>();
Microsoft.Extensions.AI.OpenAI.Tests (20)
OpenAIChatClientTests.cs (20)
75
var metadata = chatClient.
GetService
<ChatClientMetadata>();
81
metadata = chatClient.
GetService
<ChatClientMetadata>();
93
Assert.Same(chatClient, chatClient.
GetService
<IChatClient>());
94
Assert.Same(chatClient, chatClient.
GetService
<OpenAIChatClient>());
96
Assert.Same(openAIClient, chatClient.
GetService
<OpenAIClient>());
98
Assert.NotNull(chatClient.
GetService
<ChatClient>());
107
Assert.NotNull(pipeline.
GetService
<FunctionInvokingChatClient>());
108
Assert.NotNull(pipeline.
GetService
<DistributedCachingChatClient>());
109
Assert.NotNull(pipeline.
GetService
<CachingChatClient>());
110
Assert.NotNull(pipeline.
GetService
<OpenTelemetryChatClient>());
112
Assert.Same(openAIClient, pipeline.
GetService
<OpenAIClient>());
113
Assert.IsType<FunctionInvokingChatClient>(pipeline.
GetService
<IChatClient>());
122
Assert.Same(chatClient, chatClient.
GetService
<IChatClient>());
123
Assert.Same(openAIClient, chatClient.
GetService
<ChatClient>());
132
Assert.NotNull(pipeline.
GetService
<FunctionInvokingChatClient>());
133
Assert.NotNull(pipeline.
GetService
<DistributedCachingChatClient>());
134
Assert.NotNull(pipeline.
GetService
<CachingChatClient>());
135
Assert.NotNull(pipeline.
GetService
<OpenTelemetryChatClient>());
137
Assert.Same(openAIClient, pipeline.
GetService
<ChatClient>());
138
Assert.IsType<FunctionInvokingChatClient>(pipeline.
GetService
<IChatClient>());