shreemaan-abhishek commented on PR #13773: URL: https://github.com/apache/apisix/pull/13773#issuecomment-5177424157
@membphis you're right, and thanks for catching it — an unchanged config silently losing assistant-role coverage was not the intent, and the enum made it unrecoverable. Fixed in bf240a32d by putting `assistant` back in scope by default rather than only making it configurable: - `request_check_roles` enum is now `user` / `tool` / `system` / `assistant`, and the default is `["user","tool","system","assistant"]`, so a config that sets nothing moderates the same roles the old `extract_request_content` path did. - The role set is no longer hardcoded to `user`/`tool`: everything except `system` is now routed through `extract_turn_content`, which already keys on `roles[message.role]` in all four protocol adapters, so no change was needed under `ai-protocols/`. Test coverage, in `t/plugin/ai-aws-content-moderation.t`: - TEST 55 is now the regression test you asked for: a request whose only toxic text sits in an `assistant` message is sent to Comprehend (asserted via `grep_error_log` on the moderated text) and denied with 400. - TEST 62 pins the schema: `["assistant"]` accepted, unknown roles rejected. - TEST 65/66 pin one consequence worth knowing: with `request_check_mode: last`, selecting `assistant` widens the moderated block instead of narrowing it, because assistant turns no longer terminate the trailing block. Documented in the attribute table; drop `assistant` from the roles to moderate only the newest turn. One related gap this surfaced, which I've filed rather than folded in here: `extract_system_content` matches `role == "system"` exactly, so OpenAI's newer `developer` role is moderated by neither this plugin nor `ai-aliyun-content-moderation`. It needs a change in the protocol adapters and affects both plugins, so it deserves its own PR. Local run: all 66 tests in `t/plugin/ai-aws-content-moderation.t` pass, `make lint` clean. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
