Skip to main content

LogSpanGuardrailContent

Span content for safety and compliance checks. Use this type when logging guardrail operations — content moderation, PII detection, toxicity scoring, policy enforcement, or any validation that gates whether a response is safe to return.

Import

Type Definition

Properties

  • type - Discriminator field, always 'Guardrail' for this content type
  • input - The content being checked as a JSON string (JSON.stringify() of the input payload)
  • output - The guardrail verdict as a JSON string (JSON.stringify() of the result)
Both input and output must be valid, parseable JSON strings (the result of JSON.stringify()). Passing a plain string that isn’t valid JSON will cause the span to be rejected.

Example


  • LogSpanContent — union type that includes LogSpanGuardrailContent
  • Span — class that accepts LogSpanContent via span.update()