diff --git a/src/ChatGptNet/Models/ChatGptChoice.cs b/src/ChatGptNet/Models/ChatGptChoice.cs index 39e509d..c8e8076 100644 --- a/src/ChatGptNet/Models/ChatGptChoice.cs +++ b/src/ChatGptNet/Models/ChatGptChoice.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; namespace ChatGptNet.Models; @@ -29,6 +30,7 @@ public class ChatGptChoice /// Gets or sets a value indicating whether the this has been filtered by content filtering system. /// /// + [MemberNotNullWhen(true, nameof(ContentFilterResults))] public bool IsChoiceFiltered => ContentFilterResults is not null && (ContentFilterResults.Hate.Filtered || ContentFilterResults.SelfHarm.Filtered || ContentFilterResults.Violence.Filtered || ContentFilterResults.Sexual.Filtered); diff --git a/src/ChatGptNet/Models/ChatGptResponse.cs b/src/ChatGptNet/Models/ChatGptResponse.cs index 09e285d..fa639e7 100644 --- a/src/ChatGptNet/Models/ChatGptResponse.cs +++ b/src/ChatGptNet/Models/ChatGptResponse.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; using ChatGptNet.Models.Converters; namespace ChatGptNet.Models; @@ -59,6 +60,7 @@ public class ChatGptResponse /// /// Gets or sets a value indicating whether any prompt has been filtered by content filtering system. /// + [MemberNotNullWhen(true, nameof(PromptAnnotations))] public bool IsPromptFiltered => PromptAnnotations?.Any( p => p.ContentFilterResults.Hate.Filtered || p.ContentFilterResults.SelfHarm.Filtered || p.ContentFilterResults.Violence.Filtered || p.ContentFilterResults.Sexual.Filtered) ?? false; @@ -66,6 +68,7 @@ public class ChatGptResponse /// /// Gets a value that determines if the response was successful. /// + [MemberNotNullWhen(false, nameof(Error))] public bool IsSuccessful => Error is null; ///