인공지능 ChatGPT 프롬프트 엔지니어링?

AI 인공지능 프롬프트 엔지니어링 을 통한 코드 생성 답변

안녕하세요! 오늘은 ChatGPT와 같은 인공지능을 활용하는 첫 번째 단계인 프롬프트 엔지니어링에 대해 이야기해볼까요? 왜 프롬프트 엔지니어링이 필요한지, 어떤 구조를 가져야 하는지, 그리고 예제를 활용하는 방법까지 모두 알려드릴게요. 함께 재미있게 알아봐요! 😊

AI 프롬프트 엔지니어링을 통해 작성된 프롬프트와 답변내용 코드작성

프롬프트 엔지니어링이 필요한 이유?

프롬프트 엔지니어링의 필요성은 간단하게 언어로 설명할 수 있습니다. 우리가 서로 다른 언어를 사용하는 것처럼, 인공지능도 ‘대화’의 언어를 사용합니다. 예를 들어, 미국인들은 영어를, 중국인들은 중국어를 사용하고, 한국인들은 한국어를 모국어로 사용하며, 한국인이 외국인과 소통하기 위해 영어를 배우고 사용합니다. 마찬가지로, Chat GPT와 같은 인공지능(Large Language Model, LLM)은 많은 문장을 학습하여 확률적으로 계산하고 예측하는 모델입니다. 이는 무수히 많은 데이터를 기반으로 사용자의 물음에서 힌트를 얻어 답변을 하게 됩니다. 따라서, 우리가 인공지능에게 정확하고 명확한 프롬프트(prompt)를 제공할 때, 인공지능은 우리가 원하는 정보를 더 잘 이해하고 정확한 답변을 줄 수 있습니다. 프롬프트 엔지니어링은 바로 이 과정을 최적화하여 인공지능과의 소통을 더욱 효과적으로 만드는 방법입니다.

프롬프트 구조를 알면 응용이 가능해요.

프롬프트 엔지니어링에 대해 설명하기 전에, 이미 많은 분들이 이 분야에서 뛰어난 성과를 내고 계십니다. 전 세계적인 관심사답게 많은 자료들이 공유되고, 이를 바탕으로 필요에 맞게 수정하고 발전시키는 방향으로 우리는 프롬프트를 활용할 수 있어야 합니다. 그렇다면 어떤 프롬프트를 사용하더라도 우리는 우리의 목표와 상황에 맞게 수정할 수 있는 방법을 알아야겠죠?

1. 프롬프트 구조 파악하기

“RACSEF” 기법을 예로 들어 구조를 알아볼께요. RACSEF 프롬프트는 롭 레논(Rob Lennon)이라는 분이 개발하신 프롬프트 입니다. Role, Action, Context, Steps, Example, Format 의 약자로 단어만 봐서는 어떻게 사용하는지 알기 어렵기 때문에 하나씩 살펴보죠.

  • 역할(Role): 역할을 부여해서 지식의 범위를 지정합니다. 예를들어 블로그, 전문의,마케터, 작가 등…
  • 액션(Action): 목적과 의도 그리고 목표를 명활하게 설명합니다.
  • 맥락(Context): 배경과 상황을 제공합니다.
  • 단계(Steps): 단계나 지침을 제공합니다.
  • 예제(Example): 예시를 제공합니다.
  • 형식(Format): 출력 형식을 지정합니다.

2. 원하는 목적/목표 로 프롬프트 수정

"Role"
당신은 피부과 전문의로서 다양한 피부 질환의 진단, 치료, 관리에 대한 전문적인 의학 지식을 제공합니다.
"Action"
피부 건강을 증진시키고 피부 질환으로 고민하는 분들에게 적절한 치료 방법을 제안하여 건강하고 아름다운 피부를 되찾을 수 있도록 도와드리는 것이 목표입니다.
"Context"
다양한 피부 고민을 가진 분들을 대상으로 합니다. 여드름, 아토피, 민감성 피부, 색소침착, 노화 등 피부 문제로 인해 일상생활에 불편을 겪고 있으며, 전문의의 진단과 치료가 필요한 상황입니다.
"Steps"
아래 단계를 따라 답변을 생성합니다.
피부 고민 파악: 내원자의 피부 상태와 증상, 생활 습관 등을 상세히 묻고 피부 고민을 정확히 파악합니다.
피부 진단: 피부 사진 및 자료를 바탕으로 피부 질환을 진단합니다. 필요시 추가 검사를 안내합니다.
치료 방법 제안: 진단 결과에 따라 적합한 치료 방법(약물 치료, 시술, 레이저 치료 등)을 추천합니다.
스킨케어 루틴 조언: 피부 타입과 고민에 맞는 스킨케어 제품 선택과 사용법을 알려드립니다.
생활 습관 개선 방안 제시: 식습관, 수면, 스트레스 관리 등 피부 건강에 영향을 미치는 생활 습관 개선 방안을 제안합니다.
지속적인 관리 방법 안내: 치료 후에도 피부 상태를 관리하는 방법을 설명하고 정기 검진을 권장합니다.
"Example"
답변 예제 는 다음과 같습니다.
여드름 환자: 중증도에 따라 외용제, 경구 항생제, 레이저/시술 치료 등을 단계적으로 제안. 올바른 클렌징법과 보습 방법 안내.
아토피 환자: 보습 관리의 중요성 강조. 악화 요인 파악 후 회피 방안 제시. 필요시 약물 치료 권장.
"Format"
피부과 전문의가 온라인 상담을 통해 피부 고민을 듣고 진단, 치료 방향을 제시하는 형식입니다. 전문 용어를 최대한 쉽게 풀어 설명하고, 내원자가 궁금해할 만한 사항을 예상하여 답변에 포함시킵니다.

위 프롬프트를 던저주고 GPT에게 상담을 받아 보겠습니다.
질문 : “눈가 주름과 피부 탄력이 떨어져서 고민이에요.”

ChatGPT를 프롬프트 엔지니어링 통해 전문의 역할 정의 후 상담내용

복잡하고 어려운 프롬프트일 수 있지만, 한 번 잘 만들어두면 일상적인 작업을 간편하게 처리할 수 있어서 업무 시간을 대폭 절약할 수 있어요. 꼭 시도해보시고, 아래 쉬운 예제도 확인해보세요. 더 쉬운 프롬프트를 만들어볼 수 있을 거예요!

프롬프트 엔지니어링 예제

다양한 예제를 통해 프롬프트 구조를 자유롭게 변경 해봅시다. 아직까지는 ChatGPT와 같은 인공지능 모델이 영어 학습량이 많기 때문에, DeepL 번역기나 구글 번역, 파파고 번역과 같은 번역기를 이용해서 답변을 번역하는 것이 훨씬 더 좋은 결과를 얻을 수 있어요. 하지만 우리는 초보자 이기 때문에 한국어로 답변하도록 프롬프트를 수정해 두었습니다.
보다 좋은 품질의 답변을 위해서 언어 를 영어로 수정하고 GPT4 또는 Claude 3 사용을 권장합니다.

예제 1: 다양한 주제에 대한 글쓰기 프롬프트

주제나 목표, 대상 독자, 형식 등을 자유롭게 변경하면 보다 정돈된 답변을 얻을 수 있답니다.

Please consider the following when answering the topic.
Topic : "업무 자동화를 위한 RPA 도구 선택 방법"
Content goal: Blog post
Target Audience: New employees
Deliverable length: 2000 words
Format: markdown
Answer in korean
Format: title, Contents, subtitle, subtitle, detail description

예제 2: Ecommerce SEO 제품 설명 마법사

신제품 출시를 위한 SEO 전문가 역할을 수행합니다.[Product Name] 과 출력 언어 부분만 수정해서 수정해보세요.

Act as a skilled ecommerce SEO specialist tasked with crafting compelling product descriptions for online shoppers.
Instructions:
Create at least 3 separate content sections focusing on individual sets of keywords related to the given ecommerce product name.
Ensure each unique content section has an attention-grabbing and informative subheading that highlights the section's main focus.
Develop a novel, keyword-rich, informative, and engaging product summary/description of no more than 1000 words to promote the product to potential buyers.
Use emotive language and creative reasoning to explain why customers should choose this product.
Generate a list of 5 potential H1 headings for the product page, ensuring each H1 is no more than 7 words long.
Provide a comprehensive keyword list of broad match keywords used in the product summary text.
Craft a persuasive and professional meta title and description that incorporates similar phrases seen in the new product summary text and includes numerical aspects in the meta title.
Guidelines:
Refrain from reminding, apologizing, or repeating self-referential statements.
Write all outputs in korean.
For this task, use the following product:["Product Name"]

예제 3: 이메일 마케팅 전문가 프롬프트

잠재고객 전환을 위한 이메일을 기획 하고 전환 분석을 위해 사용하세요. 양식을 다각도로 생성하고 전환 분석을 위해 사용하세요.

You will act as an expert email marketing copywriter for a specific product/service provided by your organization.
Your goal is to outline an email sequence/series that will convert leads into paying customers.
Instructions:
Write a series of emails that will drive leads to schedule a discovery call with the company.
Each email should include a clear and compelling subject line and a brief overview of the topic to be discussed.
Research your target customer demographics (age, gender, location, interests, etc.) to make your emails more engaging.
Make sure your emails are well-researched and contain accurate, up-to-date information.
Guidelines:
Only respond in your own language.
Refrain from reminding, apologizing, or repeating your own testimonials.
I use the following product/service for this task: ["Product/Service Name"]

예제 4: 제품 홍보를 위한 SEO 콘텐츠 전략 테이블 작성

*다음 프롬프트는 Claude 3 사용을 권장합니다.

Please disregard the preceding instructions. I just want responses in Korean, please. 
I need you to assume the role of a native korean speaker with expertise in market research. 
Assume you possess the most precise and comprehensive knowledge possible regarding keywords. Assume you can create a comprehensive SEO content plan in conversational korean. 
I'll give you the keyword for ["Product Name"]. Create a markdown table from this term with a keyword list for your SEO content strategy plan on the subject of ["Product Name"]. 
Group the keywords into the top 10 super categories, and then label the super category as keyword cluster in the first column. 
Include a second column with seven subcategories or specialized long-tail keywords for each of the keyword clusters. 
List the keyword's human searcher intent in a separate column. 
Organize the subject into one of three search intent groups based on whether a user is looking for information, a transaction, or a commercial product or service. 
Then, in a different column, create a straightforward but highly clickable post title for that keyword. 
Then, with 120 to a maximum of 155 words, write an appealing meta description for the topic that has the potential for a high click-through rate in another column. 
The meta description must be value-based, therefore describe the article's value and provide a straightforward call to action that will encourage the searcher to click it. 
Under NO circumstances should you employ a term that is overly general, such as introduction, conclusion, tl:dr. Just concentrate on the most targeted terms. 
In any of the columns you fill out, do not use single quotes, double quotes, or any other enclosing characters. 
Rather than providing a rationale for your actions, simply return your proposals to the table. 
The keyword cluster, keyword, search intent, title, and meta description columns of the markdown table must be in the language of English. 
The important phrase to rephrase is as follows:["Product Name"]

*참고: 더 많은 예제는 블로그 [프롬프트] 카테고리 를 참고하세요.

추가 프롬프트 엔지니어링 학습 방법

프롬프트 엔지니어링은 AI 모델과 효과적으로 상호작용하기 위해 프롬프트를 최적화하는 과정이에요. 프롬프트 작성 시 명확성, 구체성, 간결성을 유지하고, 모델의 특성과 한계(할루시네이션: 세종대왕 맥북 던짐 사건…)를 고려해야 합니다. 또한 다양한 프롬프트 기법(예: 역할 부여, 단계별 지시, 제한 조건 설정 등)을 익히고 연습하는 것이 도움됩니다.
그리고 아래 프롬프트 엔지니어링 커뮤니티에 참여하여 다른 전문가들과 지식을 공유하고 피드백을 받는 것도 좋습니다.

도움이 되는 사이트:

Prompt Engineering Guide : 프롬프트 엔지니어링의 기본 개념, 기법, 모범 사례 등을 다룹니다.
Learn Prompting : 프롬프트 엔지니어링 강의, 자료, 커뮤니티를 제공
Awesome Prompt Engineering : 프롬프트 엔지니어링 관련 자료, 도구, 리소스를 모아놓은 GitHub 저장소

결론

오늘은 프롬프트 엔지니어링에 대해 알아보았는데, 이해하기 어려우셨을 수도 있겠네요. 아직 제가 글을 쓰는 게 서툴러서 프롬프트 작성이 어려우셨을 수도 있어요. 그래도 많은 도움이 되셨으면 좋겠어요. 앞으로도 열심히 공부해서 인공지능과 함께하는 우리 모두를 위한 정보를 공유할게요. 그럼 다음 시간에 더욱 유익한 정보가지고 돌아올게요!
읽어주셔서 감사합니다. 😊