การสรุปและการขยายข้อความ

Prompt Engineering กับ OpenAI API

Fouad Trad

Machine Learning Engineer

การสรุปข้อความ

  • ย่อข้อความให้สั้นลง
  • ช่วยเพิ่มประสิทธิภาพกระบวนการทางธุรกิจ
    • การเงิน -> สรุปรายงานที่มีความยาว
    • การตลาด -> แปลงความคิดเห็นของลูกค้าให้เป็นข้อมูลเชิงปฏิบัติ
  • LLM สามารถสรุปข้อความได้ด้วยพรอมต์ที่มีประสิทธิภาพ

ภาพแสดงการสรุปที่เปลี่ยนกองหนังสือให้กลายเป็นเอกสารสรุป

Prompt Engineering กับ OpenAI API

พรอมต์ที่ไม่มีประสิทธิภาพ

  • ระบุเพียงข้อความที่ต้องการสรุป
text = "I recently purchased your XYZ Smart Watch and wanted to provide some feedback
based on my experience with the product. I must say that I'm impressed with the sleek design 
and build quality of the watch. It feels comfortable on the wrist and looks great with any 
outfit. The touchscreen is responsive and easy to navigate through the various features."

prompt = f"""Summarize the text delimited by triple backticks: ```{text}```""" print(get_response(prompt))
The author purchased the XYZ Smart Watch and is impressed with its sleek design, build 
quality, and comfortable fit on the wrist. They find the touchscreen responsive and 
user-friendly for navigating the watch's features.
Prompt Engineering กับ OpenAI API

การปรับปรุงพรอมต์

  • การกำหนดขีดจำกัดของผลลัพธ์
  • โครงสร้างของผลลัพธ์
  • จุดเน้นของการสรุป

ภาพแสดงบุคคลกำลังก้าวขึ้นสู่ขั้นที่สูงขึ้นเพื่อแสดงถึงการพัฒนา

Prompt Engineering กับ OpenAI API

พรอมต์ที่มีประสิทธิภาพ: การกำหนดขีดจำกัดของผลลัพธ์

  • ระบุจำนวนประโยค คำ หรืออักขระ
text = "I recently purchased your XYZ Smart Watch and wanted to provide some feedback
based on my experience with the product. I must say that I'm impressed with the sleek design 
and build quality of the watch. It feels comfortable on the wrist and looks great with any 
outfit. The touchscreen is responsive and easy to navigate through the various features."

prompt = f"""Summarize the text delimited by triple backticks in one sentence: ```{text}```""" print(get_response(prompt))
The customer is impressed with the sleek design, build quality, comfort, and responsiveness 
of the XYZ Smart Watch's touch screen.
Prompt Engineering กับ OpenAI API

พรอมต์ที่มีประสิทธิภาพ: โครงสร้างของผลลัพธ์

  • ระบุโครงสร้างของผลลัพธ์
text = "I recently purchased your XYZ Smart Watch and wanted to provide some feedback
based on my experience with the product. I must say that I'm impressed with the sleek design 
and build quality of the watch. It feels comfortable on the wrist and looks great with any 
outfit. The touchscreen is responsive and easy to navigate through the various features."

prompt = f"""Summarize the text delimited by triple backticks, in at most three bullet points. ```{text}```""" print(get_response(prompt))
- The XYZ Smart Watch has a sleek and impressive design with  excellent build quality.
- It feels comfortable on the wrist and complements any outfit.
- The touch screen is responsive and user-friendly for easy navigation through the features.
Prompt Engineering กับ OpenAI API

พรอมต์ที่มีประสิทธิภาพ: จุดเน้นของการสรุป

  • ให้โมเดลเน้นส่วนที่ต้องการของข้อความ
text = "I recently purchased your XYZ Smart Watch and wanted to provide some feedback
based on my experience with the product. I must say that I'm impressed with the sleek design 
and build quality of the watch. It feels comfortable on the wrist and looks great with any 
outfit. The touchscreen is responsive and easy to navigate through the various features."

prompt = f"""Summarize the review delimited by triple backticks, in three sentences, focusing on the key features and user experience: ```{text}```""" print(get_response(prompt))
Prompt Engineering กับ OpenAI API

พรอมต์ที่มีประสิทธิภาพ: จุดเน้นของการสรุป

The customer purchased the XYZ Smart Watch and was impressed with its sleek design 
and build quality. 
They found it comfortable to wear and versatile enough to match any outfit. 
The touch screen was responsive and user-friendly, making it easy to navigate 
through the watch's features.
Prompt Engineering กับ OpenAI API

การขยายข้อความ

  • สร้างข้อความจากแนวคิดหรือหัวข้อย่อย
  • ช่วยเพิ่มประสิทธิภาพและผลิตภาพ
  • LLM สามารถขยายข้อความได้ด้วยพรอมต์ที่ออกแบบมาอย่างดี

ภาพอธิบายว่าการขยายข้อความคือการสร้างข้อความฉบับเต็มจากแนวคิดหรือข้อกำหนดเบื้องต้น

Prompt Engineering กับ OpenAI API

พรอมต์สำหรับการขยายข้อความ

  • ให้โมเดลขยายข้อความที่กำหนด
  • ระบุประเด็นที่ต้องการเน้น
  • กำหนดข้อกำหนดของผลลัพธ์ (น้ำเสียง ความยาว โครงสร้าง กลุ่มเป้าหมาย)

ไอคอนแสดงดินสอกำลังเขียนบนสมุดบันทึก

Prompt Engineering กับ OpenAI API

การขยายคำอธิบายบริการ

service_description = """Service: Social XYZ
- Social Media Strategy Development
- Content Creation and Posting 
- Audience Engagement and Community Building
- Increased Brand Visibility
- Enhanced Customer Engagement
- Data-Driven Marketing Decisions"""
prompt = f"""Expand the description for the Social XYZ service delimited by triple 
backticks to provide an overview of its features and benefits, without bypassing 
the limit of two sentences. Use a professional tone.
```{service_description}```"""
print(get_response(prompt))
Prompt Engineering กับ OpenAI API

การขยายคำอธิบายบริการ

Social XYZ is a comprehensive social media service that offers strategic 
development, content creation, and posting to help businesses effectively engage 
with their target audience and build a strong online community. 

With a focus on increasing brand visibility and enhancing customer engagement, 
Social XYZ enables businesses to make data-driven marketing decisions for optimal 
results.
Prompt Engineering กับ OpenAI API

มาฝึกกันเถอะ!

Prompt Engineering กับ OpenAI API

Preparing Video For Download...