66 references to Throw
Microsoft.Extensions.AI.Abstractions (66)
AdditionalPropertiesDictionary{TValue}.cs (1)
243
private readonly AdditionalPropertiesDictionary<TValue> _properties =
Throw
.IfNull(properties);
ChatCompletion\ChatClientExtensions.cs (9)
25
_ =
Throw
.IfNull(client);
42
_ =
Throw
.IfNull(client);
43
_ =
Throw
.IfNull(chatMessage);
60
_ =
Throw
.IfNull(client);
61
_ =
Throw
.IfNull(chatMessage);
78
_ =
Throw
.IfNull(client);
79
_ =
Throw
.IfNull(chatMessage);
96
_ =
Throw
.IfNull(client);
97
_ =
Throw
.IfNull(chatMessage);
ChatCompletion\ChatCompletion.cs (3)
23
_choices =
Throw
.IfNull(choices);
30
_ =
Throw
.IfNull(message);
38
set => _choices =
Throw
.IfNull(value);
ChatCompletion\ChatFinishReason.cs (2)
27
_value =
Throw
.IfNullOrWhitespace(value);
90
Throw
.IfNull(writer).WriteStringValue(value.Value);
ChatCompletion\ChatMessage.cs (1)
39
_contents =
Throw
.IfNull(contents);
ChatCompletion\ChatResponseFormatJson.cs (1)
25
Throw
.ArgumentException(
ChatCompletion\ChatRole.cs (2)
46
Value =
Throw
.IfNullOrWhitespace(value);
98
Throw
.IfNull(writer).WriteStringValue(value.Value);
ChatCompletion\DelegatingChatClient.cs (2)
27
InnerClient =
Throw
.IfNull(innerClient);
55
_ =
Throw
.IfNull(serviceType);
ChatCompletion\RequiredChatToolMode.cs (1)
37
_ =
Throw
.IfNullOrWhitespace(requiredFunctionName);
ChatCompletion\StreamingChatCompletionUpdateExtensions.cs (2)
37
_ =
Throw
.IfNull(updates);
65
_ =
Throw
.IfNull(updates);
Contents\DataContent.cs (3)
50
: this(
Throw
.IfNull(uri).ToString(), mediaType)
62
_uri =
Throw
.IfNullOrWhitespace(uri);
121
Throw
.ArgumentException(nameof(mediaType), "Invalid media type.");
Contents\FunctionCallContent.cs (6)
28
CallId =
Throw
.IfNull(callId);
29
Name =
Throw
.IfNull(name);
74
_ =
Throw
.IfNull(callId);
75
_ =
Throw
.IfNull(name);
76
_ =
Throw
.IfNull(encodedArguments);
77
_ =
Throw
.IfNull(argumentParser);
Contents\FunctionResultContent.cs (1)
30
CallId =
Throw
.IfNull(callId);
Contents\UsageContent.cs (2)
30
_details =
Throw
.IfNull(details);
37
set => _details =
Throw
.IfNull(value);
Embeddings\DelegatingEmbeddingGenerator.cs (2)
30
InnerGenerator =
Throw
.IfNull(innerGenerator);
50
_ =
Throw
.IfNull(serviceType);
Embeddings\EmbeddingGenerationOptions.cs (1)
21
_ =
Throw
.IfLessThan(value.Value, 1, nameof(value));
Embeddings\EmbeddingGeneratorExtensions.cs (5)
32
_ =
Throw
.IfNull(generator);
99
_ =
Throw
.IfNull(generator);
100
_ =
Throw
.IfNull(value);
135
_ =
Throw
.IfNull(generator);
136
_ =
Throw
.IfNull(values);
Embeddings\GeneratedEmbeddings.cs (2)
30
_embeddings = new List<TEmbedding>(
Throw
.IfLessThan(capacity, 0));
39
_embeddings = new List<TEmbedding>(
Throw
.IfNull(embeddings));
Functions\AIFunctionMetadata.cs (6)
45
_name =
Throw
.IfNullOrWhitespace(name);
56
Name =
Throw
.IfNull(metadata).Name;
68
init => _name =
Throw
.IfNullOrWhitespace(value);
84
init => _parameters =
Throw
.IfNull(value);
104
init => _returnParameter =
Throw
.IfNull(value);
148
init => _additionalProperties =
Throw
.IfNull(value);
Functions\AIFunctionParameterMetadata.cs (4)
22
_name =
Throw
.IfNullOrWhitespace(name);
30
_ =
Throw
.IfNull(metadata);
31
_ =
Throw
.IfNullOrWhitespace(metadata.Name);
46
init => _name =
Throw
.IfNullOrWhitespace(value);
Functions\AIFunctionReturnParameterMetadata.cs (1)
29
Description =
Throw
.IfNull(metadata).Description;
UsageDetails.cs (1)
34
_ =
Throw
.IfNull(usage);
Utilities\AIJsonUtilities.cs (7)
27
_ =
Throw
.IfNull(options);
28
_ =
Throw
.IfNull(typeDiscriminatorId);
44
_ =
Throw
.IfNull(options);
45
_ =
Throw
.IfNull(contentType);
46
_ =
Throw
.IfNull(typeDiscriminatorId);
50
Throw
.ArgumentException(nameof(contentType), "The content type must derive from AIContent.");
60
Throw
.ArgumentException(nameof(contentType), "Cannot register built-in AI content types.");
Utilities\AIJsonUtilities.Schema.cs (1)
144
Throw
.ArgumentException(paramName ?? "schema", "The schema document must be an object or a boolean value.");