Skip to content

AgentPrismContentFilteredException

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

Thrown when a model provider cuts the response short with its safety or content filter.

public sealed class AgentPrismContentFilteredException : AgentPrismException, ISerializable

objectExceptionAgentPrismExceptionAgentPrismContentFilteredException

ISerializable

AgentPrismException.ErrorType, Exception.GetBaseException(), Exception.ToString(), Exception.GetType(), Exception.TargetSite, Exception.Message, Exception.Data, Exception.InnerException, Exception.HelpLink, Exception.Source, Exception.HResult, Exception.StackTrace, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

A filtered response usually arrives empty. Treating that as “succeeded but empty” produces the hardest case to debug: the user sees a blank answer and the record holds no trace. AgentPrism records it as an explicit failure instead — RunError.Type becomes content_filtered.

Detection lives in a shared IChatClient decorator inside AgentPrism.Core, not inside the provider packages, so every provider gets the same behaviour.

Creates a new error.

public AgentPrismContentFilteredException()

AgentPrismContentFilteredException(string)

Section titled “ AgentPrismContentFilteredException(string)”

Creates a new error.

public AgentPrismContentFilteredException(string message)

message string

The error message.

AgentPrismContentFilteredException(string, Exception)

Section titled “ AgentPrismContentFilteredException(string, Exception)”

Creates a new error.

public AgentPrismContentFilteredException(string message, Exception innerException)

message string

The error message.

innerException Exception

The underlying error.

The stable value written to AgentPrismException.ErrorType.

public const string ContentFilteredErrorType = "content_filtered"

string

Gets the stable error type name written to the run record.

public override string ErrorType { get; }

string

Defaults to the full name of the exception type, so today’s behaviour does not change. A derived type overrides this member when the record has to be machine readable — for example AgentPrismContentFilteredException writes content_filtered. Reports and alert rules can rely on this stable name instead of an assembly name.

The value is written to RunError.Type and carries no secret.

Gets the finish reason the provider reported. For example Anthropic refusal or Gemini SAFETY. Carries no secret.

public string? FinishReason { get; init; }

string?

Gets the provider that filtered the response, or null when unknown.

public string? ProviderName { get; init; }

string?