feat(ai-lakera-guard): scan LLM responses (direction output/both, non-streaming + streaming)#13606
Open
janiussyafiq wants to merge 8 commits into
Open
feat(ai-lakera-guard): scan LLM responses (direction output/both, non-streaming + streaming)#13606janiussyafiq wants to merge 8 commits into
janiussyafiq wants to merge 8 commits into
Conversation
…t and both directions; update documentation and tests
…ce test coverage for output direction
nic-6443
reviewed
Jun 25, 2026
nic-6443
reviewed
Jun 25, 2026
nic-6443
reviewed
Jun 25, 2026
nic-6443
reviewed
Jun 25, 2026
nic-6443
reviewed
Jun 25, 2026
… mode and fail-open support; update documentation and tests
…sts for fail-open behavior; update documentation
…d readability and maintainability
nic-6443
previously approved these changes
Jun 26, 2026
AlinsRan
previously approved these changes
Jun 26, 2026
membphis
previously approved these changes
Jun 26, 2026
AlinsRan
reviewed
Jun 26, 2026
…for blocking and clean responses; add tests for output direction
…prove fail-closed behavior; add tests for streaming scenarios
ab6cc45
AlinsRan
approved these changes
Jun 26, 2026
nic-6443
approved these changes
Jun 26, 2026
shreemaan-abhishek
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PR-2 of
ai-lakera-guard, following the input-scanning MVP (#13570). Adds response (output) scanning for non-streaming and streaming (SSE) traffic. Back-compatible:directionstill defaults toinput.directionextended toinput/output/both; addsresponse_failure_message.lua_body_filter, the same dispatchai-aliyun-content-moderationuses):ctx.var.llm_response_text; a flagged response is replaced with a provider-compatible deny.[DONE](flagged). Because the stream's200/text/event-streamheaders are already committed when buffering begins, a streamed block is delivered as the deny body —deny_codedoes not apply to streams.Which issue(s) this PR fixes:
Part of #13291.
Checklist