233 references to Throw
Microsoft.Extensions.AI (233)
ChatCompletion\AnonymousDelegatingChatClient.cs (5)
54
_ =
Throw
.IfNull(sharedFunc);
91
_ =
Throw
.IfNull(messages);
108
Throw
.InvalidOperationException("The wrapper completed successfully without producing a ChatResponse.");
130
_ =
Throw
.IfNull(messages);
204
Throw
.ArgumentNullException(nameof(getResponseFunc), $"At least one of the {nameof(getResponseFunc)} or {nameof(getStreamingResponseFunc)} delegates must be non-null.");
ChatCompletion\CachingChatClient.cs (2)
49
_ =
Throw
.IfNull(messages);
77
_ =
Throw
.IfNull(messages);
ChatCompletion\ChatClientBuilder.cs (6)
25
_ =
Throw
.IfNull(innerClient);
33
_innerClientFactory =
Throw
.IfNull(innerClientFactory);
55
Throw
.InvalidOperationException(
72
_ =
Throw
.IfNull(clientFactory);
84
_ =
Throw
.IfNull(clientFactory);
110
_ =
Throw
.IfNull(sharedFunc);
ChatCompletion\ChatClientBuilderChatClientExtensions.cs (1)
22
_ =
Throw
.IfNull(innerClient);
ChatCompletion\ChatClientBuilderServiceCollectionExtensions.cs (8)
26
_ =
Throw
.IfNull(serviceCollection);
27
_ =
Throw
.IfNull(innerClient);
45
_ =
Throw
.IfNull(serviceCollection);
46
_ =
Throw
.IfNull(innerClientFactory);
68
_ =
Throw
.IfNull(serviceCollection);
69
_ =
Throw
.IfNull(innerClient);
89
_ =
Throw
.IfNull(serviceCollection);
90
_ =
Throw
.IfNull(innerClientFactory);
ChatCompletion\ChatClientStructuredOutputExtensions.cs (3)
145
_ =
Throw
.IfNull(chatClient);
146
_ =
Throw
.IfNull(messages);
147
_ =
Throw
.IfNull(serializerOptions);
ChatCompletion\ChatResponse{T}.cs (2)
36
: base(
Throw
.IfNull(response).Messages)
38
_serializerOptions =
Throw
.IfNull(serializerOptions);
ChatCompletion\ConfigureOptionsChatClient.cs (1)
33
_configureOptions =
Throw
.IfNull(configure);
ChatCompletion\ConfigureOptionsChatClientBuilderExtensions.cs (2)
34
_ =
Throw
.IfNull(builder);
35
_ =
Throw
.IfNull(configure);
ChatCompletion\DistributedCachingChatClient.cs (8)
53
_storage =
Throw
.IfNull(storage);
60
set => field =
Throw
.IfNull(value);
74
_ =
Throw
.IfNull(key);
88
_ =
Throw
.IfNull(key);
102
_ =
Throw
.IfNull(key);
103
_ =
Throw
.IfNull(value);
113
_ =
Throw
.IfNull(key);
114
_ =
Throw
.IfNull(value);
ChatCompletion\DistributedCachingChatClientBuilderExtensions.cs (1)
37
_ =
Throw
.IfNull(builder);
ChatCompletion\FunctionInvocationContext.cs (4)
29
set => field =
Throw
.IfNull(value);
36
set => field =
Throw
.IfNull(value);
43
set => field =
Throw
.IfNull(value);
50
set => field =
Throw
.IfNull(value);
ChatCompletion\FunctionInvokingChatClient.cs (10)
190
Throw
.ArgumentOutOfRangeException(nameof(value));
228
set => field =
Throw
.IfLessThan(value, 0);
280
_ =
Throw
.IfNull(messages);
346
Throw
.InvalidOperationException($"The inner {nameof(IChatClient)} returned a null {nameof(ChatResponse)}.");
440
_ =
Throw
.IfNull(messages);
546
Throw
.InvalidOperationException($"The inner {nameof(IChatClient)} streamed a null {nameof(ChatResponseUpdate)}.");
1260
Throw
.InvalidOperationException($"{GetType().Name}.{nameof(CreateResponseMessages)} returned null or an empty collection of messages.");
1280
_ =
Throw
.IfNull(result);
1321
_ =
Throw
.IfNull(context);
1505
Throw
.InvalidOperationException(
ChatCompletion\FunctionInvokingChatClientBuilderExtensions.cs (1)
30
_ =
Throw
.IfNull(builder);
ChatCompletion\ImageGeneratingChatClient.cs (3)
66
_imageGenerator =
Throw
.IfNull(imageGenerator);
74
_ =
Throw
.IfNull(messages);
98
_ =
Throw
.IfNull(messages);
ChatCompletion\ImageGeneratingChatClientBuilderExtensions.cs (1)
36
_ =
Throw
.IfNull(builder);
ChatCompletion\LoggingChatClient.cs (2)
42
_logger =
Throw
.IfNull(logger);
50
set => _jsonSerializerOptions =
Throw
.IfNull(value);
ChatCompletion\LoggingChatClientBuilderExtensions.cs (1)
37
_ =
Throw
.IfNull(builder);
ChatCompletion\OpenTelemetryChatClient.cs (3)
97
set => _jsonSerializerOptions =
Throw
.IfNull(value);
138
_ =
Throw
.IfNull(messages);
169
_ =
Throw
.IfNull(messages);
ChatCompletion\OpenTelemetryChatClientBuilderExtensions.cs (1)
31
Throw
.IfNull(builder).Use((innerClient, services) =>
ChatCompletion\OpenTelemetryImageGenerator.cs (1)
107
_ =
Throw
.IfNull(request);
ChatCompletion\OpenTelemetryImageGeneratorBuilderExtensions.cs (1)
34
Throw
.IfNull(builder).Use((innerGenerator, services) =>
ChatCompletion\ReducingChatClient.cs (1)
28
_reducer =
Throw
.IfNull(reducer);
ChatCompletion\ReducingChatClientBuilderExtensions.cs (1)
30
_ =
Throw
.IfNull(builder);
ChatReduction\MessageCountingChatReducer.cs (2)
36
_targetCount =
Throw
.IfLessThanOrEqual(targetCount, min: 0);
42
_ =
Throw
.IfNull(messages);
ChatReduction\SummarizingChatReducer.cs (5)
56
set => field =
Throw
.IfNull(value);
68
_chatClient =
Throw
.IfNull(chatClient);
69
_targetCount =
Throw
.IfLessThanOrEqual(targetCount, min: 0);
70
_thresholdCount =
Throw
.IfLessThan(threshold ?? 0, min: 0, nameof(threshold));
76
_ =
Throw
.IfNull(messages);
ChatRouting\FailoverChatClient.cs (3)
56
Throw
.ArgumentOutOfRangeException(nameof(value));
100
_ =
Throw
.IfNull(messages);
169
_ =
Throw
.IfNull(messages);
ChatRouting\FailoverChatClientAttempt.cs (1)
51
Client =
Throw
.IfNull(client);
ChatRouting\OrderedFailoverChatClient.cs (4)
49
_ =
Throw
.IfNull(clients);
54
Throw
.ArgumentException(nameof(clients), "At least one client must be provided.");
61
Throw
.ArgumentException(nameof(clients), "Clients must not contain null.");
74
_ =
Throw
.IfNull(context);
ChatRouting\SemanticRoutingChatClient.cs (11)
96
_ =
Throw
.IfNull(embeddingGenerator);
97
_ =
Throw
.IfNull(clientProfiles);
98
_ =
Throw
.IfNull(defaultClient);
102
Throw
.ArgumentException(nameof(clientProfiles), "At least one client profile must be provided.");
107
Throw
.ArgumentOutOfRangeException(nameof(topK));
112
Throw
.ArgumentOutOfRangeException(nameof(scoreAggregation));
121
Throw
.ArgumentOutOfRangeException(nameof(scoreThreshold));
138
Throw
.ArgumentException(nameof(clientProfiles), "Profile clients must not be null.");
143
Throw
.ArgumentException(
159
Throw
.ArgumentException(nameof(clientProfiles), "Profile utterances must not be blank.");
175
_ =
Throw
.IfNull(context);
Embeddings\AnonymousDelegatingEmbeddingGenerator.cs (2)
31
_ =
Throw
.IfNull(generateFunc);
40
_ =
Throw
.IfNull(values);
Embeddings\CachingEmbeddingGenerator.cs (3)
31
_ =
Throw
.IfNull(values);
54
Throw
.InvalidOperationException($"Expected exactly one embedding to be generated, but received {generated.Count}.");
59
Throw
.InvalidOperationException("Generator produced null embedding.");
Embeddings\ConfigureOptionsEmbeddingGenerator.cs (1)
40
_configureOptions =
Throw
.IfNull(configure);
Embeddings\ConfigureOptionsEmbeddingGeneratorBuilderExtensions.cs (2)
36
_ =
Throw
.IfNull(builder);
37
_ =
Throw
.IfNull(configure);
Embeddings\DistributedCachingEmbeddingGenerator.cs (5)
50
_ =
Throw
.IfNull(storage);
62
_ =
Throw
.IfNull(value);
78
_ =
Throw
.IfNull(key);
92
_ =
Throw
.IfNull(key);
93
_ =
Throw
.IfNull(value);
Embeddings\DistributedCachingEmbeddingGeneratorBuilderExtensions.cs (1)
35
_ =
Throw
.IfNull(builder);
Embeddings\EmbeddingGeneratorBuilder.cs (6)
28
_ =
Throw
.IfNull(innerGenerator);
36
_innerGeneratorFactory =
Throw
.IfNull(innerGeneratorFactory);
60
Throw
.InvalidOperationException(
76
_ =
Throw
.IfNull(generatorFactory);
88
_ =
Throw
.IfNull(generatorFactory);
107
_ =
Throw
.IfNull(generateFunc);
Embeddings\EmbeddingGeneratorBuilderEmbeddingGeneratorExtensions.cs (1)
30
_ =
Throw
.IfNull(innerGenerator);
Embeddings\EmbeddingGeneratorBuilderServiceCollectionExtensions.cs (8)
29
_ =
Throw
.IfNull(serviceCollection);
30
_ =
Throw
.IfNull(innerGenerator);
51
_ =
Throw
.IfNull(serviceCollection);
52
_ =
Throw
.IfNull(innerGeneratorFactory);
79
_ =
Throw
.IfNull(serviceCollection);
80
_ =
Throw
.IfNull(innerGenerator);
103
_ =
Throw
.IfNull(serviceCollection);
104
_ =
Throw
.IfNull(innerGeneratorFactory);
Embeddings\LoggingEmbeddingGenerator.cs (2)
44
_logger =
Throw
.IfNull(logger);
52
set => _jsonSerializerOptions =
Throw
.IfNull(value);
Embeddings\LoggingEmbeddingGeneratorBuilderExtensions.cs (1)
40
_ =
Throw
.IfNull(builder);
Embeddings\OpenTelemetryEmbeddingGenerator.cs (1)
98
_ =
Throw
.IfNull(values);
Embeddings\OpenTelemetryEmbeddingGeneratorBuilderExtensions.cs (1)
34
Throw
.IfNull(builder).Use((innerGenerator, services) =>
Files\HostedFileClientBuilder.cs (5)
26
_ =
Throw
.IfNull(innerClient);
35
_innerClientFactory =
Throw
.IfNull(innerClientFactory);
58
Throw
.InvalidOperationException(
74
_ =
Throw
.IfNull(clientFactory);
85
_ =
Throw
.IfNull(clientFactory);
Files\HostedFileClientBuilderHostedFileClientExtensions.cs (1)
23
_ =
Throw
.IfNull(innerClient);
Files\LoggingHostedFileClient.cs (2)
47
_logger =
Throw
.IfNull(logger);
55
set => _jsonSerializerOptions =
Throw
.IfNull(value);
Files\LoggingHostedFileClientBuilderExtensions.cs (1)
39
_ =
Throw
.IfNull(builder);
Files\OpenTelemetryHostedFileClientBuilderExtensions.cs (1)
35
Throw
.IfNull(builder).Use((innerClient, services) =>
Image\ConfigureOptionsImageGenerator.cs (1)
35
_configureOptions =
Throw
.IfNull(configure);
Image\ConfigureOptionsImageGeneratorBuilderExtensions.cs (2)
33
_ =
Throw
.IfNull(builder);
34
_ =
Throw
.IfNull(configure);
Image\ImageGeneratorBuilder.cs (4)
26
_ =
Throw
.IfNull(innerGenerator);
35
_innerGeneratorFactory =
Throw
.IfNull(innerGeneratorFactory);
70
_ =
Throw
.IfNull(generatorFactory);
81
_ =
Throw
.IfNull(generatorFactory);
Image\ImageGeneratorBuilderImageGeneratorExtensions.cs (1)
25
_ =
Throw
.IfNull(innerGenerator);
Image\ImageGeneratorBuilderServiceCollectionExtensions.cs (4)
41
_ =
Throw
.IfNull(serviceCollection);
42
_ =
Throw
.IfNull(innerGeneratorFactory);
78
_ =
Throw
.IfNull(serviceCollection);
79
_ =
Throw
.IfNull(innerGeneratorFactory);
Image\LoggingImageGenerator.cs (3)
45
_logger =
Throw
.IfNull(logger);
54
set => _jsonSerializerOptions =
Throw
.IfNull(value);
61
_ =
Throw
.IfNull(request);
Image\LoggingImageGeneratorBuilderExtensions.cs (1)
40
_ =
Throw
.IfNull(builder);
Realtime\FunctionInvokingRealtimeClient.cs (2)
90
Throw
.ArgumentOutOfRangeException(nameof(value));
107
set => field =
Throw
.IfLessThan(value, 0);
Realtime\FunctionInvokingRealtimeClientBuilderExtensions.cs (1)
32
_ =
Throw
.IfNull(builder);
Realtime\FunctionInvokingRealtimeClientSession.cs (4)
85
_innerSession =
Throw
.IfNull(innerSession);
86
_client =
Throw
.IfNull(client);
134
_ =
Throw
.IfNull(serviceType);
409
_ =
Throw
.IfNull(context);
Realtime\LoggingRealtimeClient.cs (2)
35
_logger =
Throw
.IfNull(logger);
43
set => _jsonSerializerOptions =
Throw
.IfNull(value);
Realtime\LoggingRealtimeClientBuilderExtensions.cs (1)
40
_ =
Throw
.IfNull(builder);
Realtime\LoggingRealtimeClientSession.cs (5)
45
_innerSession =
Throw
.IfNull(innerSession);
46
_logger =
Throw
.IfNull(logger);
57
set => _jsonSerializerOptions =
Throw
.IfNull(value);
69
_ =
Throw
.IfNull(serviceType);
79
_ =
Throw
.IfNull(message);
Realtime\OpenTelemetryRealtimeClient.cs (1)
57
set => _jsonSerializerOptions =
Throw
.IfNull(value);
Realtime\OpenTelemetryRealtimeClientBuilderExtensions.cs (1)
70
Throw
.IfNull(builder).Use((innerClient, services) =>
Realtime\OpenTelemetryRealtimeClientSession.cs (3)
107
_innerSession =
Throw
.IfNull(innerSession);
133
set => _jsonSerializerOptions =
Throw
.IfNull(value);
167
_ =
Throw
.IfNull(serviceType);
Realtime\RealtimeClientBuilder.cs (5)
26
_ =
Throw
.IfNull(innerClient);
34
_innerClientFactory =
Throw
.IfNull(innerClientFactory);
56
Throw
.InvalidOperationException(
72
_ =
Throw
.IfNull(clientFactory);
83
_ =
Throw
.IfNull(clientFactory);
Realtime\RealtimeClientBuilderRealtimeClientExtensions.cs (1)
25
_ =
Throw
.IfNull(innerClient);
Realtime\RealtimeClientExtensions.cs (6)
27
_ =
Throw
.IfNull(client);
49
_ =
Throw
.IfNull(client);
50
_ =
Throw
.IfNull(serviceType);
54
throw
Throw
.CreateMissingServiceException(serviceType, serviceKey);
73
_ =
Throw
.IfNull(client);
77
throw
Throw
.CreateMissingServiceException(typeof(TService), serviceKey);
Realtime\RealtimeClientSessionExtensions.cs (6)
27
_ =
Throw
.IfNull(session);
49
_ =
Throw
.IfNull(session);
50
_ =
Throw
.IfNull(serviceType);
54
throw
Throw
.CreateMissingServiceException(serviceType, serviceKey);
73
_ =
Throw
.IfNull(session);
77
throw
Throw
.CreateMissingServiceException(typeof(TService), serviceKey);
SpeechToText\ConfigureOptionsSpeechToTextClient.cs (1)
37
_configureOptions =
Throw
.IfNull(configure);
SpeechToText\ConfigureOptionsSpeechToTextClientBuilderExtensions.cs (2)
32
_ =
Throw
.IfNull(builder);
33
_ =
Throw
.IfNull(configure);
SpeechToText\LoggingSpeechToTextClient.cs (2)
46
_logger =
Throw
.IfNull(logger);
54
set => _jsonSerializerOptions =
Throw
.IfNull(value);
SpeechToText\LoggingSpeechToTextClientBuilderExtensions.cs (1)
39
_ =
Throw
.IfNull(builder);
SpeechToText\OpenTelemetrySpeechToTextClient.cs (2)
108
_ =
Throw
.IfNull(audioSpeechStream);
136
_ =
Throw
.IfNull(audioSpeechStream);
SpeechToText\OpenTelemetrySpeechToTextClientBuilderExtensions.cs (1)
34
Throw
.IfNull(builder).Use((innerClient, services) =>
SpeechToText\SpeechToTextClientBuilder.cs (4)
25
_ =
Throw
.IfNull(innerClient);
33
_innerClientFactory =
Throw
.IfNull(innerClientFactory);
67
_ =
Throw
.IfNull(clientFactory);
77
_ =
Throw
.IfNull(clientFactory);
SpeechToText\SpeechToTextClientBuilderServiceCollectionExtensions.cs (4)
39
_ =
Throw
.IfNull(serviceCollection);
40
_ =
Throw
.IfNull(innerClientFactory);
74
_ =
Throw
.IfNull(serviceCollection);
75
_ =
Throw
.IfNull(innerClientFactory);
SpeechToText\SpeechToTextClientBuilderSpeechToTextClientExtensions.cs (1)
23
_ =
Throw
.IfNull(innerClient);
TextToSpeech\ConfigureOptionsTextToSpeechClient.cs (1)
36
_configureOptions =
Throw
.IfNull(configure);
TextToSpeech\ConfigureOptionsTextToSpeechClientBuilderExtensions.cs (2)
32
_ =
Throw
.IfNull(builder);
33
_ =
Throw
.IfNull(configure);
TextToSpeech\LoggingTextToSpeechClient.cs (2)
45
_logger =
Throw
.IfNull(logger);
53
set => _jsonSerializerOptions =
Throw
.IfNull(value);
TextToSpeech\LoggingTextToSpeechClientBuilderExtensions.cs (1)
39
_ =
Throw
.IfNull(builder);
TextToSpeech\OpenTelemetryTextToSpeechClient.cs (2)
107
_ =
Throw
.IfNull(text);
135
_ =
Throw
.IfNull(text);
TextToSpeech\OpenTelemetryTextToSpeechClientBuilderExtensions.cs (1)
34
Throw
.IfNull(builder).Use((innerClient, services) =>
TextToSpeech\TextToSpeechClientBuilder.cs (4)
25
_ =
Throw
.IfNull(innerClient);
33
_innerClientFactory =
Throw
.IfNull(innerClientFactory);
67
_ =
Throw
.IfNull(clientFactory);
77
_ =
Throw
.IfNull(clientFactory);
TextToSpeech\TextToSpeechClientBuilderServiceCollectionExtensions.cs (8)
27
_ =
Throw
.IfNull(serviceCollection);
28
_ =
Throw
.IfNull(innerClient);
43
_ =
Throw
.IfNull(serviceCollection);
44
_ =
Throw
.IfNull(innerClientFactory);
64
_ =
Throw
.IfNull(serviceCollection);
65
_ =
Throw
.IfNull(innerClient);
82
_ =
Throw
.IfNull(serviceCollection);
83
_ =
Throw
.IfNull(innerClientFactory);
TextToSpeech\TextToSpeechClientBuilderTextToSpeechClientExtensions.cs (1)
23
_ =
Throw
.IfNull(innerClient);