ContentGuardResult
AgentPrism.Abstractions.dllThe result of an IContentGuard check.
public sealed record ContentGuardResult : IEquatable<ContentGuardResult>Inheritance
Section titled “Inheritance”Implements
Section titled “Implements”IEquatable<ContentGuardResult>
Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”The result does not carry the blocked content. It only carries the matched rule’s name and the block reason; both are written to the audit trail and the run event. Blocked content is sensitive by definition, and writing it into an audit trail makes the problem permanent.
Constructors
Section titled “Constructors”ContentGuardResult()
Section titled “ ContentGuardResult()”public ContentGuardResult()Properties
Section titled “Properties”Action
Section titled “ Action”The decision made.
public required ContentGuardAction Action { get; init; }Property Value
Section titled “Property Value”The content passes unchanged.
public static ContentGuardResult Allow { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”A single instance is shared: this is the value guards return most often, and it must not allocate on the hot path.
MaskedText
Section titled “ MaskedText”The new text to send to the model (or return to the client). Populated only for ContentGuardAction.Mask.
public string? MaskedText { get; init; }Property Value
Section titled “Property Value”Reason
Section titled “ Reason”The block reason. Does not carry the blocked TEXT.
public string? Reason { get; init; }Property Value
Section titled “Property Value”RuleName
Section titled “ RuleName”The matched rule’s name. Does not carry the matched CONTENT.
public string? RuleName { get; init; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Block(string, string)
Section titled “ Block(string, string)”The content is blocked; the run becomes Failed.
public static ContentGuardResult Block(string ruleName, string reason)Parameters
Section titled “Parameters”ruleName string
The matched rule’s name.
reason string
The block reason. MUST not carry the blocked text.
Returns
Section titled “Returns”A block decision.
Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(ContentGuardResult?)
Section titled “ Equals(ContentGuardResult?)”public bool Equals(ContentGuardResult? other)Parameters
Section titled “Parameters”other ContentGuardResult?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”Mask(string, string)
Section titled “ Mask(string, string)”The content passes after being modified.
public static ContentGuardResult Mask(string maskedText, string ruleName)Parameters
Section titled “Parameters”maskedText string
The new form of the content.
ruleName string
The matched rule’s name.
Returns
Section titled “Returns”A mask decision.
ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(ContentGuardResult?, ContentGuardResult?)
Section titled “ operator ==(ContentGuardResult?, ContentGuardResult?)”public static bool operator ==(ContentGuardResult? left, ContentGuardResult? right)Parameters
Section titled “Parameters”left ContentGuardResult?
right ContentGuardResult?
Returns
Section titled “Returns”operator !=(ContentGuardResult?, ContentGuardResult?)
Section titled “ operator !=(ContentGuardResult?, ContentGuardResult?)”public static bool operator !=(ContentGuardResult? left, ContentGuardResult? right)Parameters
Section titled “Parameters”left ContentGuardResult?
right ContentGuardResult?