Skip to content

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

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: api7/aisix#108 (comment)) as a follow-up to the streaming output guardrail implementation.

Requested by

@bzp2010

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions