สร้าง prompt ของคุณใน AI prompts แล้วสร้าง flow แบบง่ายๆ

by

ในบทความนี้เราจะสร้างโฟลว์ที่ใช้ AI ทำงานต่างๆ ดังต่อไปนี้: ดูว่าเป็นภาษาอะไร, แปลเป็นภาษาอังกฤษ, สรุปข้อความจากรูปที่อัพโหลด, วิเคราะห์อารมณ์ความรู้สึก (sentiment analysis), แล้วบันทึกผลลัพธ์ใน Excel

Step-by-Step Guides

Create custom prompt

ไปที่ AI prompts ใน Power Automate แล้วคลิก ‘Build your own prompt’

Power Automate > AI prompts > Build your own prompt

คลิก ‘Add’ แล้วเลือก ‘Image or document (preview)’ เนื่องจากเราจะใช้ trigger ‘When a file is created or modified (properties only)’ ดังนั้นต้องใช้ input เป็น image หรือ document

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

คลิก ‘Ok’

Notification for use GPT-4o

ตั้งชื่อ input variable เช่น “image” คลิกปุ่ม ‘Add input’ จากนั้นสร้าง prompt โดยใช้ข้อความและตัวแปร

Name the variable

ตัวอย่างการสร้าง prompt โดยใช้ข้อความและตัวแปร:

Extract the relevant data from the upload {image}

ถ้าต้องการเพิ่มตัวแปรให้พิมพ์สัญลักษณ์ / ตามด้วยชื่อของตัวแปร แล้วคลิกเลือกที่ตัวแปรนั้น

Add variable in custom prompt

Prompt ของบทความนี้จะเป็นตามรูปภาพและ 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 ได้ตามต้องการ, เปลี่ยน output เป็น ‘JSON’ แล้วกด save custom prompt

Rename, Change output to JSON and save

Create SharePoint Library

สร้าง SharePoint Library ใน SharePoint site แล้วสร้างไฟล์ Excel

Create SharePoint library, Excel file

Prepare Excel Table

สร้างตารางที่มี column ต่อไปนี้: Language, Original Text, Translate Text, Summary, Sentiment

Create Excel table

Create Cloud Flow

เลือก trigger ‘When a file is created (properties only)’

  • เลือก ‘Site Address’ (Your SharePointSite)
  • เลือก ‘Library Name’ (Your SharePoint Library)
Set parameter for trigger ‘When a file is created (properties only)’

เลือก action ‘Get file content’

  • เลือก ‘Site Address’ (Your SharePointSite)
  • ใส่ ‘File Identifier’ (Dynamic content ‘Identifier’ from the previous trigger)
Set parameter for ‘Get file content’

เลือก action ‘Create text with GPT using a prompt’

  • เลือก ‘Prompt’ (Your custom prompt)
  • ใส่ ‘Image’ (Dynamic content ‘File content’ from ‘Get file content’ action)
Set parameter for ‘Create text with GPT using a prompt’

เลือก action ‘Add a row into a table’

  • เลือก ‘Location’ ที่เก็บไฟล์ Excel
  • เลือก ‘Document Library’ (Folder)
  • เลือก ‘File’ (Excel File)
  • เลือก ‘Table’ (Excel table)
  • ใส่ ‘script’ ใน column ‘Language’
  • ใส่ ‘original_text’ ใน column ‘Original Text’
  • ใส่ ‘translated_text’ ใน column ‘Translate Text’
  • ใส่ ‘summary’ ใน column ‘Summary’
  • ใส่ ‘sentiment’ ใน column ‘Sentiment’
Set parameter for ‘Add a row into a table’

Test the flow

รันโฟลว์แล้ว upload ไฟล์ใน 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