127 references to Throw
Microsoft.Extensions.AI (127)
ChatCompletion\AnonymousDelegatingChatClient.cs (5)
56
_ =
Throw
.IfNull(sharedFunc);
93
_ =
Throw
.IfNull(messages);
110
Throw
.InvalidOperationException("The wrapper completed successfully without producing a ChatResponse.");
132
_ =
Throw
.IfNull(messages);
206
Throw
.ArgumentNullException(nameof(getResponseFunc), $"At least one of the {nameof(getResponseFunc)} or {nameof(getStreamingResponseFunc)} delegates must be non-null.");
ChatCompletion\CachingChatClient.cs (2)
51
_ =
Throw
.IfNull(messages);
71
_ =
Throw
.IfNull(messages);
ChatCompletion\ChatClientBuilder.cs (6)
25
_ =
Throw
.IfNull(innerClient);
33
_innerClientFactory =
Throw
.IfNull(innerClientFactory);
55
Throw
.InvalidOperationException(
71
_ =
Throw
.IfNull(clientFactory);
82
_ =
Throw
.IfNull(clientFactory);
107
_ =
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)
159
_ =
Throw
.IfNull(chatClient);
160
_ =
Throw
.IfNull(messages);
161
_ =
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)
33
_ =
Throw
.IfNull(builder);
34
_ =
Throw
.IfNull(configure);
ChatCompletion\DistributedCachingChatClient.cs (8)
49
_storage =
Throw
.IfNull(storage);
56
set => _jsonSerializerOptions =
Throw
.IfNull(value);
62
_ =
Throw
.IfNull(key);
76
_ =
Throw
.IfNull(key);
90
_ =
Throw
.IfNull(key);
91
_ =
Throw
.IfNull(value);
101
_ =
Throw
.IfNull(key);
102
_ =
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 (9)
166
Throw
.ArgumentOutOfRangeException(nameof(value));
204
set => _maximumConsecutiveErrorsPerRequest =
Throw
.IfLessThan(value, 0);
211
_ =
Throw
.IfNull(messages);
238
Throw
.InvalidOperationException($"The inner {nameof(IChatClient)} returned a null {nameof(ChatResponse)}.");
306
_ =
Throw
.IfNull(messages);
334
Throw
.InvalidOperationException($"The inner {nameof(IChatClient)} streamed a null {nameof(ChatResponseUpdate)}.");
659
Throw
.InvalidOperationException($"{GetType().Name}.{nameof(CreateResponseMessages)} returned null or an empty collection of messages.");
743
_ =
Throw
.IfNull(result);
780
_ =
Throw
.IfNull(context);
ChatCompletion\FunctionInvokingChatClientBuilderExtensions.cs (1)
30
_ =
Throw
.IfNull(builder);
ChatCompletion\LoggingChatClient.cs (2)
34
_logger =
Throw
.IfNull(logger);
42
set => _jsonSerializerOptions =
Throw
.IfNull(value);
ChatCompletion\LoggingChatClientBuilderExtensions.cs (1)
29
_ =
Throw
.IfNull(builder);
ChatCompletion\OpenTelemetryChatClient.cs (3)
97
set => _jsonSerializerOptions =
Throw
.IfNull(value);
135
_ =
Throw
.IfNull(messages);
166
_ =
Throw
.IfNull(messages);
ChatCompletion\OpenTelemetryChatClientBuilderExtensions.cs (1)
31
Throw
.IfNull(builder).Use((innerClient, services) =>
Embeddings\AnonymousDelegatingEmbeddingGenerator.cs (2)
31
_ =
Throw
.IfNull(generateFunc);
40
_ =
Throw
.IfNull(values);
Embeddings\CachingEmbeddingGenerator.cs (2)
31
_ =
Throw
.IfNull(values);
54
Throw
.InvalidOperationException($"Expected exactly one embedding to be generated, but received {generated.Count}.");
Embeddings\ConfigureOptionsEmbeddingGenerator.cs (1)
40
_configureOptions =
Throw
.IfNull(configure);
Embeddings\ConfigureOptionsEmbeddingGeneratorBuilderExtensions.cs (2)
38
_ =
Throw
.IfNull(builder);
39
_ =
Throw
.IfNull(configure);
Embeddings\DistributedCachingEmbeddingGenerator.cs (5)
37
_ =
Throw
.IfNull(storage);
49
_ =
Throw
.IfNull(value);
57
_ =
Throw
.IfNull(key);
71
_ =
Throw
.IfNull(key);
72
_ =
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)
36
_logger =
Throw
.IfNull(logger);
44
set => _jsonSerializerOptions =
Throw
.IfNull(value);
Embeddings\LoggingEmbeddingGeneratorBuilderExtensions.cs (1)
32
_ =
Throw
.IfNull(builder);
Embeddings\OpenTelemetryEmbeddingGenerator.cs (1)
97
_ =
Throw
.IfNull(values);
Embeddings\OpenTelemetryEmbeddingGeneratorBuilderExtensions.cs (1)
34
Throw
.IfNull(builder).Use((innerGenerator, services) =>
Functions\AIFunctionFactory.cs (17)
116
_ =
Throw
.IfNull(method);
197
_ =
Throw
.IfNull(method);
299
_ =
Throw
.IfNull(method);
390
_ =
Throw
.IfNull(method);
509
_ =
Throw
.IfNull(method);
510
_ =
Throw
.IfNull(targetType);
519
_ =
Throw
.IfNull(method);
523
Throw
.ArgumentException(nameof(method), "Open generic methods are not supported");
528
Throw
.ArgumentNullException(nameof(target), "Target must not be null for an instance method.");
547
_ =
Throw
.IfNull(method);
551
Throw
.ArgumentException(nameof(method), "Open generic methods are not supported");
556
Throw
.ArgumentException(nameof(method), "The method must be an instance method.");
562
Throw
.ArgumentException(nameof(targetType), "The target type must be assignable to the method's declaring type.");
812
Throw
.ArgumentException(nameof(parameter), "Parameter is missing a name.");
848
Throw
.ArgumentException(nameof(arguments), $"An {nameof(IServiceProvider)} was not provided for the {parameter.Name} parameter.");
867
Throw
.ArgumentException(nameof(arguments), $"No service of type '{parameterType}' with key '{keyedAttr.Key}' was found.");
910
Throw
.ArgumentException(nameof(arguments), $"Missing required parameter '{parameter.Name}' for method '{parameter.Member.Name}'.");
Functions\AIFunctionFactory.Utilities.cs (1)
25
_ =
Throw
.IfNull(memberName);
SpeechToText\ConfigureOptionsSpeechToTextClient.cs (1)
36
_configureOptions =
Throw
.IfNull(configure);
SpeechToText\ConfigureOptionsSpeechToTextClientBuilderExtensions.cs (2)
33
_ =
Throw
.IfNull(builder);
34
_ =
Throw
.IfNull(configure);
SpeechToText\LoggingSpeechToTextClient.cs (2)
37
_logger =
Throw
.IfNull(logger);
45
set => _jsonSerializerOptions =
Throw
.IfNull(value);
SpeechToText\SpeechToTextClientBuilder.cs (4)
24
_ =
Throw
.IfNull(innerClient);
32
_innerClientFactory =
Throw
.IfNull(innerClientFactory);
66
_ =
Throw
.IfNull(clientFactory);
76
_ =
Throw
.IfNull(clientFactory);
SpeechToText\SpeechToTextClientBuilderExtensions.cs (1)
30
_ =
Throw
.IfNull(builder);
SpeechToText\SpeechToTextClientBuilderServiceCollectionExtensions.cs (5)
38
_ =
Throw
.IfNull(serviceCollection);
39
_ =
Throw
.IfNull(innerClientFactory);
73
_ =
Throw
.IfNull(serviceCollection);
74
_ =
Throw
.IfNull(serviceKey);
75
_ =
Throw
.IfNull(innerClientFactory);
SpeechToText\SpeechToTextClientBuilderSpeechToTextClientExtensions.cs (1)
22
_ =
Throw
.IfNull(innerClient);