Skip to content

ContentGuardContext

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The context of an IContentGuard call.

public sealed record ContentGuardContext : IEquatable<ContentGuardContext>

objectContentGuardContext

IEquatable<ContentGuardContext>

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

The context carries a single piece of text, not a message list. If messages were concatenated into one text, a false pattern could match at the boundary between two messages (example: if one message ends with 4539 and the next starts with 5787…, an invalid card number would “be found”).

public ContentGuardContext()

The name of the agent executing the run. null if unknown.

public string? AgentName { get; init; }

string?

The direction of the check.

public required ContentGuardDirection Direction { get; init; }

ContentGuardDirection

The identifier of the model being called. null if unknown.

public string? ModelId { get; init; }

string?

The run identifier. null if called outside a run’s scope.

public Guid? RunId { get; init; }

Guid?

The run’s tenant. null if unknown.

public string? TenantId { get; init; }

string?

The text to check.

public required string Text { get; init; }

string

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(ContentGuardContext? other)

other ContentGuardContext?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(ContentGuardContext?, ContentGuardContext?)

Section titled “ operator ==(ContentGuardContext?, ContentGuardContext?)”
public static bool operator ==(ContentGuardContext? left, ContentGuardContext? right)

left ContentGuardContext?

right ContentGuardContext?

bool

operator !=(ContentGuardContext?, ContentGuardContext?)

Section titled “ operator !=(ContentGuardContext?, ContentGuardContext?)”
public static bool operator !=(ContentGuardContext? left, ContentGuardContext? right)

left ContentGuardContext?

right ContentGuardContext?

bool