Text summarization और expansion

OpenAI API के साथ Prompt Engineering

Fouad Trad

Machine Learning Engineer

Text summarization

  • टेक्स्ट को छोटे रूप में संक्षेप करता है
  • बिज़नेस प्रक्रियाएँ सरल बनाता है
    • Finance -> लंबे रिपोर्ट्स का सार बनाता है
    • Marketing -> कस्टमर फीडबैक को actionable insights में बदलता है
  • LLMs प्रभावी prompts से टेक्स्ट summarize कर सकते हैं

चित्र दिखा रहा है कि summarization कैसे किताबों के ढेर को एक summary वाले दस्तावेज़ में बदल देता है.

OpenAI API के साथ Prompt Engineering

Ineffective prompt

  • सिर्फ वह टेक्स्ट बताता है जिसे summarize करना है
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.
OpenAI API के साथ Prompt Engineering

Prompt improvement

  • Output limits
  • Output structure
  • Summarization focus

चित्र जिसमें एक व्यक्ति सुधार के संकेत के रूप में एक स्टेप से ऊँचे स्टेप पर जा रहा है.

OpenAI API के साथ Prompt Engineering

Effective prompt: output limits

  • वाक्य, शब्द, अक्षरों की संख्या बताइए
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.
OpenAI API के साथ Prompt Engineering

Effective prompt: output structure

  • Output structure स्पष्ट करें
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.
OpenAI API के साथ Prompt Engineering

Effective prompt: summarization focus

  • मॉडल से टेक्स्ट के खास हिस्सों पर फोकस कराने को कहें
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))
OpenAI API के साथ Prompt Engineering

Effective prompt: summarization focus

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.
OpenAI API के साथ Prompt Engineering

Text expansion

  • आइडियाज़ या बुलेट पॉइंट्स से टेक्स्ट जनरेट करता है
  • दक्षता और उत्पादकता बढ़ाता है
  • LLMs अच्छे prompts से टेक्स्ट expand कर सकते हैं

चित्र समझाता है कि text expansion छोटे आइडियाज़/रिक्वायरमेंट्स से पूरा टेक्स्ट जनरेट करना है.

OpenAI API के साथ Prompt Engineering

Text expansion prompts

  • मॉडल से delimited टेक्स्ट expand करने को कहें
  • किन पहलुओं पर फोकस करना है, बताइए
  • आउटपुट आवश्यकताएँ दें (tone, length, structure, audience)

आइकन जिसमें पेंसिल नोटबुक पर लिख रही है.

OpenAI API के साथ Prompt Engineering

Expanding service description

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))
OpenAI API के साथ Prompt Engineering

Expanding service description

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.
OpenAI API के साथ Prompt Engineering

अभ्यास करते हैं!

OpenAI API के साथ Prompt Engineering

Preparing Video For Download...