138 references to Throw
Microsoft.Extensions.AI (138)
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)
38
: base(
Throw
.IfNull(response).Messages)
40
_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)
56
_storage =
Throw
.IfNull(storage);
63
set => _jsonSerializerOptions =
Throw
.IfNull(value);
77
_ =
Throw
.IfNull(key);
91
_ =
Throw
.IfNull(key);
105
_ =
Throw
.IfNull(key);
106
_ =
Throw
.IfNull(value);
116
_ =
Throw
.IfNull(key);
117
_ =
Throw
.IfNull(value);
ChatCompletion\DistributedCachingChatClientBuilderExtensions.cs (1)
37
_ =
Throw
.IfNull(builder);
ChatCompletion\FunctionInvocationContext.cs (4)
41
set => _function =
Throw
.IfNull(value);
48
set => _arguments =
Throw
.IfNull(value);
55
set => _callContent =
Throw
.IfNull(value);
62
set => _messages =
Throw
.IfNull(value);
ChatCompletion\FunctionInvokingChatClient.cs (11)
186
Throw
.ArgumentOutOfRangeException(nameof(value));
224
set => _maximumConsecutiveErrorsPerRequest =
Throw
.IfLessThan(value, 0);
276
_ =
Throw
.IfNull(messages);
332
Throw
.InvalidOperationException($"The inner {nameof(IChatClient)} returned a null {nameof(ChatResponse)}.");
415
_ =
Throw
.IfNull(messages);
502
Throw
.InvalidOperationException($"The inner {nameof(IChatClient)} streamed a null {nameof(ChatResponseUpdate)}.");
983
Throw
.InvalidOperationException($"{GetType().Name}.{nameof(CreateResponseMessages)} returned null or an empty collection of messages.");
1070
_ =
Throw
.IfNull(result);
1107
_ =
Throw
.IfNull(context);
1206
_ =
Throw
.IfNull(context);
1350
Throw
.InvalidOperationException(
ChatCompletion\FunctionInvokingChatClientBuilderExtensions.cs (1)
30
_ =
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)
91
set => _jsonSerializerOptions =
Throw
.IfNull(value);
132
_ =
Throw
.IfNull(messages);
163
_ =
Throw
.IfNull(messages);
ChatCompletion\OpenTelemetryChatClientBuilderExtensions.cs (1)
31
Throw
.IfNull(builder).Use((innerClient, services) =>
ChatCompletion\OpenTelemetryImageGenerator.cs (1)
119
_ =
Throw
.IfNull(request);
ChatCompletion\OpenTelemetryImageGeneratorBuilderExtensions.cs (1)
33
Throw
.IfNull(builder).Use((innerGenerator, services) =>
ChatCompletion\ReducingChatClient.cs (1)
27
_reducer =
Throw
.IfNull(reducer);
ChatCompletion\ReducingChatClientBuilderExtensions.cs (1)
29
_ =
Throw
.IfNull(builder);
ChatReduction\MessageCountingChatReducer.cs (2)
35
_targetCount =
Throw
.IfLessThanOrEqual(targetCount, min: 0);
41
_ =
Throw
.IfNull(messages);
ChatReduction\SummarizingChatReducer.cs (5)
56
set => _summarizationPrompt =
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);
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)
111
_ =
Throw
.IfNull(values);
Embeddings\OpenTelemetryEmbeddingGeneratorBuilderExtensions.cs (1)
34
Throw
.IfNull(builder).Use((innerGenerator, services) =>
Image\ConfigureOptionsImageGenerator.cs (1)
34
_configureOptions =
Throw
.IfNull(configure);
Image\ConfigureOptionsImageGeneratorBuilderExtensions.cs (2)
32
_ =
Throw
.IfNull(builder);
33
_ =
Throw
.IfNull(configure);
Image\ImageGeneratorBuilder.cs (4)
25
_ =
Throw
.IfNull(innerGenerator);
34
_innerGeneratorFactory =
Throw
.IfNull(innerGeneratorFactory);
69
_ =
Throw
.IfNull(generatorFactory);
80
_ =
Throw
.IfNull(generatorFactory);
Image\ImageGeneratorBuilderImageGeneratorExtensions.cs (1)
24
_ =
Throw
.IfNull(innerGenerator);
Image\ImageGeneratorBuilderServiceCollectionExtensions.cs (4)
40
_ =
Throw
.IfNull(serviceCollection);
41
_ =
Throw
.IfNull(innerGeneratorFactory);
77
_ =
Throw
.IfNull(serviceCollection);
78
_ =
Throw
.IfNull(innerGeneratorFactory);
Image\LoggingImageGenerator.cs (3)
44
_logger =
Throw
.IfNull(logger);
53
set => _jsonSerializerOptions =
Throw
.IfNull(value);
60
_ =
Throw
.IfNull(request);
Image\LoggingImageGeneratorBuilderExtensions.cs (1)
39
_ =
Throw
.IfNull(builder);
SpeechToText\ConfigureOptionsSpeechToTextClient.cs (1)
36
_configureOptions =
Throw
.IfNull(configure);
SpeechToText\ConfigureOptionsSpeechToTextClientBuilderExtensions.cs (2)
31
_ =
Throw
.IfNull(builder);
32
_ =
Throw
.IfNull(configure);
SpeechToText\LoggingSpeechToTextClient.cs (2)
45
_logger =
Throw
.IfNull(logger);
53
set => _jsonSerializerOptions =
Throw
.IfNull(value);
SpeechToText\LoggingSpeechToTextClientBuilderExtensions.cs (1)
38
_ =
Throw
.IfNull(builder);
SpeechToText\SpeechToTextClientBuilder.cs (4)
24
_ =
Throw
.IfNull(innerClient);
32
_innerClientFactory =
Throw
.IfNull(innerClientFactory);
66
_ =
Throw
.IfNull(clientFactory);
76
_ =
Throw
.IfNull(clientFactory);
SpeechToText\SpeechToTextClientBuilderServiceCollectionExtensions.cs (4)
38
_ =
Throw
.IfNull(serviceCollection);
39
_ =
Throw
.IfNull(innerClientFactory);
73
_ =
Throw
.IfNull(serviceCollection);
74
_ =
Throw
.IfNull(innerClientFactory);
SpeechToText\SpeechToTextClientBuilderSpeechToTextClientExtensions.cs (1)
22
_ =
Throw
.IfNull(innerClient);