So basically, I'm trying to create a chat bot, it takes user question as input and send to open AI (through api) and return the response to virtual agent chat box.
This is my existing flow.
The whole flow looks like this.
But, i want to add something in middle of this flow.
There's something called "OpenAI moderations which will check whether content complies with OpenAI's content policy.
https://platform.openai.com/docs/guides/moderation/overview
This is the api URL https://api.openai.com/v1/moderations
Json Body:
{
"input": "I want to kill them."
}
Json response:
{
"id": "modr-5MWoLO",
"model": "text-moderation-001",
"results": [
{
"categories": {
"hate": false,
"hate/threatening": true,
"self-harm": false,
"sexual": false,
"sexual/minors": false,
"violence": true,
"violence/graphic": false
},
"category_scores": {
"hate": 0.22714105248451233,
"hate/threatening": 0.4132447838783264,
"self-harm": 0.005232391878962517,
"sexual": 0.01407341007143259,
"sexual/minors": 0.0038522258400917053,
"violence": 0.9223177433013916,
"violence/graphic": 0.036865197122097015
},
"flagged": true
}
]
}
as you can see, the above question has some harmful content and the json response shows true.
So, the flow should be like this.
1) the user types the question
2) sends the question to open ai moderations for checking whether there is some harmful content is there or not.
3) if any of the parameters is true, then it should send the response to user, "please double check your question"
4) if any of the parameters is false, then it should send the response to openAI and receive the response back.
So what would be the modified flow of my power automate?