Skip to content

feat(guardrail): support streaming output rewrite #110

@coderabbitai

Description

@coderabbitai

Summary

When a guardrail returns a Rewrite outcome for a streaming response, the proxy currently rejects the request with an error:

guardrail {name} requested streaming output rewrite, which is not supported yet

This is a placeholder until whole-response streaming rewrite is implemented.

Context

  • Introduced in PR feat(guardrail): add whole replay for streaming chat #108 (feat(guardrail): add whole replay for stream request), specifically in apply_stream_output_guardrails in src/proxy/handlers/format_handler.rs.
  • The non-streaming (complete-response) path already supports rewrite via apply_output_guardrail_rewrite.

Goal

Implement support for GuardrailOutcome::Rewrite in the streaming output guardrail path, so that guardrail-driven rewrites can be applied to buffered/replayed stream content.

References

/cc @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