Skip to content

Streaming output guardrails: support strict (400) and lenient (topic-change) rejection modes #109

@coderabbitai

Description

@coderabbitai

Summary

Currently, apply_stream_output_guardrails in src/proxy/handlers/format_handler.rs only supports a single hard-rejection path that returns a GatewayError::Validation error. Error handling should be extended to support two configurable modes:

  1. Strict mode – return a 400 Bad Request status code when the guardrail blocks streaming output.
  2. Lenient mode – instead of an error, return a simulated "Let's change the subject" (topic-deflection) response, giving a softer guardrail experience.

Background

Raised during review of PR #108 (comment: #108 (comment)) as a follow-up to the streaming output guardrail implementation.

Requested by

@bzp2010

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions