텍스트 요약 및 확장

OpenAI API로 배우는 프롬프트 엔지니어링

Fouad Trad

Machine Learning Engineer

텍스트 요약

  • 텍스트를 더 짧은 형식으로 압축
  • 비즈니스 프로세스 간소화
    • 금융 -> 장문 보고서 요약
    • 마케팅 -> 고객 피드백을 실행 가능한 인사이트로 변환
  • LLM은 효과적인 프롬프트로 텍스트 요약 가능

요약이 많은 책을 요약본 문서로 변환하는 과정을 보여주는 이미지.

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.
OpenAI API로 배우는 프롬프트 엔지니어링

프롬프트 개선

  • 출력 제한
  • 출력 구조
  • 요약 초점

발전을 상징하는 계단을 오르는 사람 이미지.

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.
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.
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))
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.
OpenAI API로 배우는 프롬프트 엔지니어링

텍스트 확장

  • 아이디어나 불릿 포인트에서 텍스트 생성
  • 효율성 및 생산성 향상
  • LLM은 잘 구성된 프롬프트로 텍스트 확장 가능

텍스트 확장이 간단한 아이디어나 요구사항을 기반으로 전체 텍스트를 생성하는 과정을 설명하는 이미지.

OpenAI API로 배우는 프롬프트 엔지니어링

텍스트 확장 프롬프트

  • 구분된 텍스트 확장 요청
  • 집중할 측면 명시
  • 출력 요건 제공 (어조, 길이, 구조, 대상)

노트에 글을 쓰는 연필 아이콘.

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))
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.
OpenAI API로 배우는 프롬프트 엔지니어링

연습해 봅시다!

OpenAI API로 배우는 프롬프트 엔지니어링

Preparing Video For Download...