AgentPrismContentGuardBuilderExtensions
AgentPrism.Core.dllChain extensions that turn on content inspection.
public static class AgentPrismContentGuardBuilderExtensionsInheritance
Section titled “Inheritance”object ← AgentPrismContentGuardBuilderExtensions
Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”This is an extension method, not a member of IAgentPrismBuilder: adding a member to the interface is a breaking change after release; adding an extension method is not.
Methods
Section titled “Methods”AddContentGuard<TGuard>(IAgentPrismBuilder)
Section titled “ AddContentGuard<TGuard>(IAgentPrismBuilder)”Registers your own IContentGuard implementation.
public static IAgentPrismBuilder AddContentGuard<TGuard>(this IAgentPrismBuilder builder) where TGuard : class, IContentGuardParameters
Section titled “Parameters”builder IAgentPrismBuilder
The configuration chain.
Returns
Section titled “Returns”The chain, for further configuration.
Type Parameters
Section titled “Type Parameters”TGuard
The guard type.
Remarks
Section titled “Remarks”Multiple guards can be registered; all of them run in sequence and the strictest decision wins.
builder.AddAgentPrism() .AddPatternContentGuard() .AddContentGuard<CustomerNameGuard>();Exceptions
Section titled “Exceptions”builder is null.
AddPatternContentGuard(IAgentPrismBuilder, Action<PatternContentGuardOptions>?)
Section titled “ AddPatternContentGuard(IAgentPrismBuilder, Action<PatternContentGuardOptions>?)”Registers AgentPrism’s built-in pattern-based content guard.
public static IAgentPrismBuilder AddPatternContentGuard(this IAgentPrismBuilder builder, Action<PatternContentGuardOptions>? configure = null)Parameters
Section titled “Parameters”builder IAgentPrismBuilder
The configuration chain.
configure Action<PatternContentGuardOptions>?
Pattern and denied-term settings.
Returns
Section titled “Returns”The chain, for further configuration.
Remarks
Section titled “Remarks”This call is the no-surprises rule’s gate. AddAgentPrism alone
registers no guard, and the inspection wrapper is never added to
the model pipeline. Without this call no prompt is inspected, no response
is inspected, and no cost is paid.
The built-in guard carries no rules by default: PatternContentGuardOptions.MaskedPii is PiiPatterns.None and PatternContentGuardOptions.DeniedTerms is empty. Which pattern family to turn on is an explicit choice; turning them all on at once compounds the false-positive risk.
The same settings are also read from the AgentPrism:ContentGuard:Pattern
configuration section; if that section is present the guard is already
registered by AddAgentPrism and this call is redundant (the
registration uses TryAddEnumerable, so it is never added twice).
builder.AddAgentPrism() .AddPatternContentGuard(options => { options.MaskedPii = PiiPatterns.CreditCard | PiiPatterns.Email; options.DeniedTerms.Add("secret-project"); });Exceptions
Section titled “Exceptions”builder is null.