General Discussion [Question] Clarification on the moderation request/response format for API extension #36650
DreamJokerMJ
started this conversation in
General
Replies: 1 comment 1 reply
-
|
@dosu |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
Content
Hi Dify team,
I'm trying to build a custom content moderation service and integrate it via the API Extension feature. I’ve checked the documentation, but I’m still not completely sure about the exact request and response contract for the
moderationpoint.Could you please clarify the following:
Request format
What is the exact JSON structure Dify sends to my external endpoint when it acts as a moderation extension?
I’ve seen field names like
point,params,app_id,content,user, andtypein some examples. Is the schema below correct?{ "point": "moderation", "params": { "app_id": "string", "content": "string", "user": "string (optional)", "type": "input" | "output" } }Response format
What fields should my endpoint return so that Dify correctly interprets the result?
I understand
flagged(boolean) andpreset_response(string) are the core fields. But:actionfield? If yes, is"block"the only supported value?flaggedistruevsfalse? Will the pipeline immediately stop and returnpreset_responseto the user, or can I also choose to “pass with warning”?Error handling
If my moderation service is down or returns a non-200 status, does Dify treat that as
flagged: trueby default?Having the precise specification will help me build a reliable integration. Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions