Skip to content

GuardrailSegmentation

How streaming text is cut into units before guardrails see it.

type GuardrailSegmentation = "sentence" | "chunk";

Defined in: src/core/types/guardrails.ts:228

How streaming text is cut into units before guardrails see it.

Remarks

  • 'sentence' — accumulate until a sentence boundary (., !, ?, ;, :, newline followed by whitespace) or GuardrailsConfig.maxSegmentChars. Patterns such as email addresses are not split across calls, so regex-based redaction works reliably.
  • 'chunk' — filter every raw LLM chunk as it arrives. Minimum latency, but a pattern straddling two chunks will be missed.

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency