127 references to Throw
Microsoft.Extensions.AI (127)
ChatCompletion\AnonymousDelegatingChatClient.cs (5)
56_ = Throw.IfNull(sharedFunc); 93_ = Throw.IfNull(messages); 110Throw.InvalidOperationException("The wrapper completed successfully without producing a ChatResponse."); 132_ = Throw.IfNull(messages); 206Throw.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); 55Throw.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); 56set => _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)
41set => _function = Throw.IfNull(value); 48set => _arguments = Throw.IfNull(value); 55set => _callContent = Throw.IfNull(value); 62set => _messages = Throw.IfNull(value);
ChatCompletion\FunctionInvokingChatClient.cs (9)
166Throw.ArgumentOutOfRangeException(nameof(value)); 204set => _maximumConsecutiveErrorsPerRequest = Throw.IfLessThan(value, 0); 211_ = Throw.IfNull(messages); 238Throw.InvalidOperationException($"The inner {nameof(IChatClient)} returned a null {nameof(ChatResponse)}."); 306_ = Throw.IfNull(messages); 334Throw.InvalidOperationException($"The inner {nameof(IChatClient)} streamed a null {nameof(ChatResponseUpdate)}."); 659Throw.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); 42set => _jsonSerializerOptions = Throw.IfNull(value);
ChatCompletion\LoggingChatClientBuilderExtensions.cs (1)
29_ = Throw.IfNull(builder);
ChatCompletion\OpenTelemetryChatClient.cs (3)
97set => _jsonSerializerOptions = Throw.IfNull(value); 135_ = Throw.IfNull(messages); 166_ = Throw.IfNull(messages);
ChatCompletion\OpenTelemetryChatClientBuilderExtensions.cs (1)
31Throw.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); 54Throw.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); 60Throw.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); 44set => _jsonSerializerOptions = Throw.IfNull(value);
Embeddings\LoggingEmbeddingGeneratorBuilderExtensions.cs (1)
32_ = Throw.IfNull(builder);
Embeddings\OpenTelemetryEmbeddingGenerator.cs (1)
97_ = Throw.IfNull(values);
Embeddings\OpenTelemetryEmbeddingGeneratorBuilderExtensions.cs (1)
34Throw.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); 523Throw.ArgumentException(nameof(method), "Open generic methods are not supported"); 528Throw.ArgumentNullException(nameof(target), "Target must not be null for an instance method."); 547_ = Throw.IfNull(method); 551Throw.ArgumentException(nameof(method), "Open generic methods are not supported"); 556Throw.ArgumentException(nameof(method), "The method must be an instance method."); 562Throw.ArgumentException(nameof(targetType), "The target type must be assignable to the method's declaring type."); 812Throw.ArgumentException(nameof(parameter), "Parameter is missing a name."); 848Throw.ArgumentException(nameof(arguments), $"An {nameof(IServiceProvider)} was not provided for the {parameter.Name} parameter."); 867Throw.ArgumentException(nameof(arguments), $"No service of type '{parameterType}' with key '{keyedAttr.Key}' was found."); 910Throw.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); 45set => _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);