100 references to Throw
Microsoft.Extensions.AI (100)
ChatCompletion\AnonymousDelegatingChatClient.cs (5)
53_ = Throw.IfNull(sharedFunc); 90_ = Throw.IfNull(messages); 107Throw.InvalidOperationException("The wrapper completed successfully without producing a ChatResponse."); 129_ = Throw.IfNull(messages); 189Throw.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)
23_ = 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)
158_ = Throw.IfNull(chatClient); 159_ = Throw.IfNull(messages); 160_ = Throw.IfNull(serializerOptions);
ChatCompletion\ChatResponse{T}.cs (2)
33: base(Throw.IfNull(response).Messages) 35_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)
39_storage = Throw.IfNull(storage); 46set => _jsonSerializerOptions = Throw.IfNull(value); 52_ = Throw.IfNull(key); 66_ = Throw.IfNull(key); 80_ = Throw.IfNull(key); 81_ = Throw.IfNull(value); 91_ = Throw.IfNull(key); 92_ = Throw.IfNull(value);
ChatCompletion\DistributedCachingChatClientBuilderExtensions.cs (1)
28_ = Throw.IfNull(builder);
ChatCompletion\FunctionInvocationContext.cs (3)
38set => _callContent = Throw.IfNull(value); 45set => _messages = Throw.IfNull(value); 55set => _function = Throw.IfNull(value);
ChatCompletion\FunctionInvokingChatClient.cs (8)
175Throw.ArgumentOutOfRangeException(nameof(value)); 186_ = Throw.IfNull(messages); 208Throw.InvalidOperationException($"The inner {nameof(IChatClient)} returned a null {nameof(ChatResponse)}."); 272_ = Throw.IfNull(messages); 294Throw.InvalidOperationException($"The inner {nameof(IChatClient)} streamed a null {nameof(ChatResponseUpdate)}."); 569Throw.InvalidOperationException($"{GetType().Name}.{nameof(CreateResponseMessages)} returned null or an empty collection of messages."); 658_ = Throw.IfNull(result); 695_ = 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)
89set => _jsonSerializerOptions = Throw.IfNull(value); 127_ = Throw.IfNull(messages); 158_ = 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)
31_ = 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)
37_logger = Throw.IfNull(logger); 45set => _jsonSerializerOptions = Throw.IfNull(value);
Embeddings\LoggingEmbeddingGeneratorBuilderExtensions.cs (1)
32_ = Throw.IfNull(builder);
Embeddings\OpenTelemetryEmbeddingGenerator.cs (1)
88_ = Throw.IfNull(values);
Embeddings\OpenTelemetryEmbeddingGeneratorBuilderExtensions.cs (1)
34Throw.IfNull(builder).Use((innerGenerator, services) =>
Functions\AIFunctionFactory.cs (8)
45_ = Throw.IfNull(method); 68_ = Throw.IfNull(method); 106_ = Throw.IfNull(method); 135_ = Throw.IfNull(method); 153_ = Throw.IfNull(method); 157Throw.ArgumentException(nameof(method), "Open generic methods are not supported"); 162Throw.ArgumentNullException(nameof(target), "Target must not be null for an instance method."); 329Throw.ArgumentException(nameof(parameter), "Parameter is missing a name.");
Functions\AIFunctionFactory.Utilities.cs (1)
25_ = Throw.IfNull(memberName);