89 references to Throw
Microsoft.Extensions.AI.Abstractions (89)
AdditionalPropertiesDictionary{TValue}.cs (2)
208_ = Throw.IfNull(items); 255private readonly AdditionalPropertiesDictionary<TValue> _properties = Throw.IfNull(properties);
ChatCompletion\ChatClientExtensions.cs (14)
27_ = Throw.IfNull(client); 49_ = Throw.IfNull(client); 50_ = Throw.IfNull(serviceType); 54throw Throw.CreateMissingServiceException(serviceType, serviceKey); 73_ = Throw.IfNull(client); 77throw Throw.CreateMissingServiceException(typeof(TService), serviceKey); 97_ = Throw.IfNull(client); 98_ = Throw.IfNull(chatMessage); 117_ = Throw.IfNull(client); 118_ = Throw.IfNull(chatMessage); 137_ = Throw.IfNull(client); 138_ = Throw.IfNull(chatMessage); 157_ = Throw.IfNull(client); 158_ = Throw.IfNull(chatMessage);
ChatCompletion\ChatFinishReason.cs (2)
27_value = Throw.IfNullOrWhitespace(value); 90Throw.IfNull(writer).WriteStringValue(value.Value);
ChatCompletion\ChatResponse.cs (1)
35_ = Throw.IfNull(message);
ChatCompletion\ChatResponseExtensions.cs (8)
28_ = Throw.IfNull(list); 29_ = Throw.IfNull(response); 57_ = Throw.IfNull(list); 58_ = Throw.IfNull(updates); 84_ = Throw.IfNull(list); 85_ = Throw.IfNull(updates); 107_ = Throw.IfNull(updates); 135_ = Throw.IfNull(updates);
ChatCompletion\ChatResponseFormatJson.cs (1)
25Throw.ArgumentException(
ChatCompletion\ChatRole.cs (2)
48Value = Throw.IfNullOrWhitespace(value); 100Throw.IfNull(writer).WriteStringValue(value.Value);
ChatCompletion\DelegatingChatClient.cs (2)
27InnerClient = Throw.IfNull(innerClient); 53_ = Throw.IfNull(serviceType);
ChatCompletion\RequiredChatToolMode.cs (1)
38_ = Throw.IfNullOrWhitespace(requiredFunctionName);
Contents\DataContent.cs (4)
57: this(Throw.IfNull(uri).ToString(), mediaType) 73_uri = Throw.IfNullOrWhitespace(uri); 77Throw.ArgumentException(nameof(uri), "The provided URI is not a data URI."); 87Throw.ArgumentNullException(nameof(mediaType), $"{nameof(uri)} did not contain a media type, and {nameof(mediaType)} was not provided.");
Contents\DataUriParser.cs (2)
75_ = Throw.IfNullOrWhitespace(mediaType, parameterName); 79Throw.ArgumentException(parameterName, $"An invalid media type was specified: '{mediaType}'");
Contents\FunctionCallContent.cs (6)
28CallId = Throw.IfNull(callId); 29Name = Throw.IfNull(name); 78_ = Throw.IfNull(encodedArguments); 79_ = Throw.IfNull(callId); 80_ = Throw.IfNull(name); 81_ = Throw.IfNull(argumentParser);
Contents\FunctionResultContent.cs (1)
30CallId = Throw.IfNull(callId);
Contents\UriContent.cs (3)
40: this(new Uri(Throw.IfNull(uri)), mediaType) 58_uri = Throw.IfNull(uri); 66set => _uri = Throw.IfNull(value);
Contents\UsageContent.cs (2)
30_details = Throw.IfNull(details); 37set => _details = Throw.IfNull(value);
Embeddings\DelegatingEmbeddingGenerator.cs (2)
30InnerGenerator = Throw.IfNull(innerGenerator); 50_ = Throw.IfNull(serviceType);
Embeddings\EmbeddingGenerationOptions.cs (1)
21_ = Throw.IfLessThan(value.Value, 1, nameof(value));
Embeddings\EmbeddingGeneratorExtensions.cs (14)
32_ = Throw.IfNull(generator); 55_ = Throw.IfNull(generator); 56_ = Throw.IfNull(serviceType); 60throw Throw.CreateMissingServiceException(serviceType, serviceKey); 80_ = Throw.IfNull(generator); 84throw Throw.CreateMissingServiceException(typeof(TService), serviceKey); 140_ = Throw.IfNull(generator); 141_ = Throw.IfNull(value); 147Throw.InvalidOperationException("Embedding generator returned a null collection of embeddings."); 152Throw.InvalidOperationException($"Expected the number of embeddings ({embeddings.Count}) to match the number of inputs (1)."); 158Throw.InvalidOperationException("Embedding generator generated a null embedding."); 185_ = Throw.IfNull(generator); 186_ = Throw.IfNull(values); 199Throw.InvalidOperationException($"Expected the number of embeddings ({embeddings.Count}) to match the number of inputs ({inputsCount}).");
Embeddings\GeneratedEmbeddings.cs (2)
30_embeddings = new List<TEmbedding>(Throw.IfLessThan(capacity, 0)); 39_embeddings = new List<TEmbedding>(Throw.IfNull(embeddings));
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (3)
52_ = Throw.IfNull(options); 53_ = Throw.IfNull(type); 72_ = Throw.IfNull(typeInfo);
src\Shared\JsonSchemaExporter\JsonSchemaExporter.ReflectionHelpers.cs (5)
44_jsonTypeInfo_ElementType = Throw.IfNull(elementTypeProperty); 56_jsonPropertyInfo_MemberName = Throw.IfNull(memberName); 71_nullableConverter_ElementConverter_Generic = Throw.IfNull(genericFieldInfo); 88_enumConverter_Options_Generic = Throw.IfNull(genericFieldInfo); 97_enumConverter_NamingPolicy_Generic = Throw.IfNull(genericFieldInfo);
UsageDetails.cs (1)
36_ = Throw.IfNull(usage);
Utilities\AIJsonUtilities.cs (7)
37_ = Throw.IfNull(options); 38_ = Throw.IfNull(typeDiscriminatorId); 54_ = Throw.IfNull(options); 55_ = Throw.IfNull(contentType); 56_ = Throw.IfNull(typeDiscriminatorId); 60Throw.ArgumentException(nameof(contentType), "The content type must derive from AIContent."); 165Throw.ArgumentException(nameof(contentType), "Cannot register built-in AI content types.");
Utilities\AIJsonUtilities.Schema.cs (3)
66_ = Throw.IfNull(method); 79Throw.ArgumentException(nameof(parameter), "Parameter is missing a name."); 163Throw.ArgumentException(paramName ?? "schema", "The schema document must be an object or a boolean value.");