Mikko Eskola aimed to gather information on sustainability projects and I wanted to demonstrate how to do it efficiently with AI and Microsoft tools. The goal was to automate the analysis of project descriptions and assess their alignment with sustainability principles. This solution compares the project description with the JCI Creed, providing a streamlined way to evaluate the responsibility of each project.

This solution is presented on 15.10.2024 at #teamsfi meetup | recordings found in YouTube

Previous blog post shows how does it look like on the front side, now we dig deeper into Power Automate and the actual logic what is happening on the background

The Solution

When a user submits a text, the system processes it and provides feedback via a Teams message. Power Automate takes the Forms response, sends it to AI hub for custom prompt for processing and then posts the reply to Teams message to user and project administrative chat.

1. Create the custom prompt

Go to maker portal and create custom prompt (more detailed instructions creating custom prompt) and publish it

Process the application on the subject: [subject]. Go through the description: "[description]"
Reply with the language user wrote the description. Make sure the description mentions things about the "JCI Creed".  If there is no reference to the "JCI Creed" in the description or topic, please tell us what is missing and give a suggestion on how to complete the description.
The "JCI Creed" reads as follows: "We believe that
- faith in God gives meaning and purpose to human life;
- the brotherhood of man transcends the sovereignty of nations;
- economic justice can best be won by free men through free enterprise;
-  government should be of laws rather than of men;
- earth s great treasure lies in human personality;
- service to humanity is the best work of life."

2. Create forms to collect the user applications

Go to https://forms.microsoft.com/Pages/DesignPageV2.aspx and create form that suits your needs – remember to allow for anonymous, in my case it does not allow anonymous since I want to send them Teams message and don’t ask the email separately.

Form that collects user applications
Form that collects user applications

3. Create the Power Automate flow to do the processing

Create trigger action from Forms. Select the form you created in step 2. Then add action Get response details and select the trigger id there. Finally add action Create text with GPT using a prompt and select the model you published in step 1. Give the application subject and description for the custom prompt action.

Power Automate flow first three actions to capture the form response and send to AI processing
Power Automate flow first three actions to capture the form response and send to AI processing

Then create the Teams actions that send message to user that sent the form and then adaptive card into group chat for admins

Teams actions to send messages to users
Teams actions to send messages to users
{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "Uusi vastuullisuusilmoitus"
        },
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "TextBlock",
                            "weight": "Bolder",
                            "text": "@{outputs('Get_response_details')?['body/r83711039b2eb4c2eaccade275346bae4']}",
                            "wrap": true
                        },
                        {
                            "type": "TextBlock",
                            "spacing": "None",
                            "text": "@{outputs('Get_response_details')?['body/responder']}",
                            "isSubtle": true,
                            "wrap": true
                        }
                    ],
                    "width": "stretch"
                }
            ]
        },
        {
            "type": "TextBlock",
            "text": "@{outputs('Get_response_details')?['body/r6fec1a13a12649458cde33b5d836b63f']}",
            "wrap": true
        },
        {
            "type": "TextBlock",
            "weight": "Bolder",
            "text": "Tekoälyn vastaus",
            "wrap": true
        },
        {
            "type": "TextBlock",
            "text": "@{replace(outputs('Create_text_with_GPT_using_a_prompt')?['body/responsev2/predictionOutput/text'], '"', '''')}",
            "wrap": true
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.4"
}

Now you have your fully functional AI assistant processing applications for you. Please feel free so develop it further. I would save all applications into a list and then create views to go them trough. Maybe then some status column for manual processing which are been handled with admin persons. And then maybe some solution column where admin could write what will be done. I would create another Power Automate to notify users when their application status is ready or solved etc.