web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / how to modify the powe...
Power Automate
Unanswered

how to modify the power automate flow for the below scenario?

(0) ShareShare
ReportReport
Posted on by 403

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.

Jupyter123_3-1675184511111.pngJupyter123_4-1675184528641.pngJupyter123_5-1675184552314.pngJupyter123_6-1675184574008.pngJupyter123_7-1675184609961.pngJupyter123_8-1675184625753.pngJupyter123_9-1675184642877.png

The whole flow looks like this.

Jupyter123_10-1675184679356.png


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?

 

Categories:
I have the same question (0)
  • AlexMCC Profile Picture
    293 on at

    Add your API check wherever you want it in the flow.

     

    Use a Condition control to check if the JSON response is true.

     

    In the "false" branch add another Return Values followed by a Terminate control to stop the flow.

     

    Just leave the "true" branch blank.

     

    Your flow should look like this:

    Screenshot 2023-02-02 at 07.06.51.png

  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Jupyter123 

     

    Thanks for the call. This is what we discussed.

     

    Collect the response and add a parse json step to check flagged is true or false? Based on that decision you can terminate the flow with a response. If all good build rest of the business logic and return the results back to the user. If you want to show the user the 'rules are broken' then use a variable to dynamically store flagged text which is 'Sorry you have broken the rules' or use the same variable to return the ChatGPT results back to user.

     

    Thanks

     

    Thanks

  • Jupyter123 Profile Picture
    403 on at

    thank you very much @abm .
    i've contacted @abm and he helped me out and clearly explained the steps what to be done.
    cheers. and also thanks to @AlexMCC for your response. your answer was almost close to the expected one.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard