Build your own prompt in AI prompts and create simple flow

by

In this article, I will create a flow in which AI performs the following tasks: detects the language, translates it to English, summarizes the text in an image, conducts sentiment analysis, and records the results in Excel.

Step-by-Step Guides

Create custom prompt

Go to AI prompts in Power Automate and click ‘Build your own prompt’

Power Automate > AI prompts > Build your own prompt

Click ‘Add’ and select ‘Image or document (preview)’ because I’ll use trigger ‘When a file is created or modified (properties only)’ so the input should be image or document.

Click ‘Add’ and select ‘Image or document (preview)’

Click ‘Ok’

Notification for use GPT-4o

Name the input variable and build the prompt by combining the text and the variable. For example, if your input variable is “image”, then click ‘Add input’ button.

Name the variable

You can create a prompt like:

Extract the relevant data from the upload {image}

If you want to add a variable, type / followed by the variable name and select it.

Add variable in custom prompt

Final prompt will be look like the below image and code block

Custom prompt for detect language, translate, summarize, conduct sentiment analysis
 Identify the predominant language of the given {image} and return only the detected language in the "script" format (e.g., "en-US"). If the language cannot be determined, return "unknown." extract and show original text and translate to English.
Summarize the {image} in a concise and logical manner, ensuring that all key points and details are included while removing redundancy. If the text is too short to condense, return it as is.
Evaluate the sentiment of the "text" and classify it as 'Positive,' 'Negative,' or 'Neutral,' considering emotional tone, language cues, and context. If the sentiment is mixed, identify the most dominant emotion. The response must be one capitalized word with no additional explanation.

Rename custom prompt as needed, change output to ‘JSON’ and press save custom prompt.

Rename, Change output to JSON and save

Create SharePoint Library

Create SharePoint Library in SharePoint site and create Excel file.

Create SharePoint library, Excel file

Prepare Excel Table

Create a table with the following columns: Language, Original Text, Translate Text, Summary, Sentiment

Create Excel table

Create Cloud Flow

Select trigger ‘When a file is created (properties only)’

  • Select ‘Site Address’ (Your SharePointSite)
  • Select ‘Library Name’ (Your SharePoint Library)
Set parameter for trigger ‘When a file is created (properties only)’

Select action ‘Get file content’

  • Select ‘Site Address’ (Your SharePointSite)
  • Insert ‘File Identifier’ (Dynamic content ‘Identifier’ from the previous trigger)
Set parameter for ‘Get file content’

Select action ‘Create text with GPT using a prompt’

  • Select ‘Prompt’ (Your custom prompt)
  • Insert ‘Image’ (Dynamic content ‘File content’ from ‘Get file content’ action)
Set parameter for ‘Create text with GPT using a prompt’

Select action ‘Add a row into a table’

  • Select ‘Location’ where the Excel file exists
  • Select ‘Document Library’ (Folder)
  • Select ‘File’ (Excel File)
  • Select ‘Table’ (Excel table)
  • Insert ‘script’ in ‘Language’ column
  • Insert ‘original_text’ in ‘Original Text’ column
  • Insert ‘translated_text’ in ‘Translate Text’ column
  • Insert ‘summary’ in ‘Summary’ column
  • Insert ‘sentiment’ in ‘Sentiment’ column
Set parameter for ‘Add a row into a table’

Test the flow

Run flow and upload file in SharePoint Library.

SharePoint Library
Flow run successfully

Result in Excel

Credit image from https://wshippers.wordpress.com/2013/12/31/pics-trans-tvxqs-message-in-naver-music/

Did You Enjoy this Article?

Subscription to get new articles sent to your inbox each week for FREE

Question?

If you have any questions or feedback about this article please leave a message in the comments section below.


Comments

Leave a comment

Subscribe to get new articles sent to your inbox each week for FREE