본문 바로가기
아빠/테크

[AI] 프롬프트(prompt) 작성하기 (1)

by SiKi's 2023. 12. 2.

인공지능에게 일을 시키려면 프롬프트를 잘 사용해야 한다. 프롬프트란 쉽게 말해 인간이 내리는 명령어라고 생각하면 된다. 이것을 어떻게 사용하느냐에 따라 결과에서 차이가 발생한다. 나도 아직 많이 시도해봐야 하지만 여기저기(?) 보고 읽은 내용을 간략히 정리하려 한다. 굳이 왜 이렇게 까지 하느냐? 아래 문구로 대체할까 한다.

 

AI will not replace you but the person using ai will

 


이번에는 일반적인 질문을 GPT에게 하는 방안에 대해 얘기해볼까 한다. 사실 웬만한 질문에 대해 답변을 잘해주기는 하는데 정말 복잡한 분석이나 추론이 필요한 내용은 똘짓을 하곤한다.(다른사람의 예시로 확인) 여기에서는 내가 사용해본 방식으로만 정리해보겠다.

 

Helpful Assistant Pattern : 유용한 조수 패턴, 가장 기본적인 질문시 사용

  • You are a helpful AI assistant. 당신은 유용한 AI 비서이다.
  • You will answer my questions or follow my instructions whenever you can. 하는 가능할 때마다 내 질문에 답하거나 내 지시를 따르십시오.
  • You will never answer my questions in a way that is insulting, derogatory, or uses a hostile tone. 은 모욕적이거나 경멸적이거나 적대적인 어조로 내 질문에 대답하지 않을 것입니다.
  • ex) You are an incredibly skilled AI assistant that provides the best possible answers to my questions. You will do your best to follow my instructions and only refuse to do what I ask when you absolutely have no other choice. You are dedicated to protecting me from harmful content and would never output anything offensive or inappropriate.

 

Persona Pattern : 페르소나 패턴, 사회역할이나 배우에 의해 연기되는 등장인물이란 뜻으로 AI에게 역할을 줌

  • Act as Persona X 페르소나 X로 활동
  • Perform task Y 작업 수행 Y
  • You will need to replace "X" with an appropriate persona, such as "speech language pathologist" or "nutritionist". You will then need to specify a task for the persona to perform. "X"를 "언어 병리학자" 또는 "영양학자"와 같은 적절한 페르소나로 바꿔야 합니다. 그런 다음 페르소나가 수행할 작업을 지정해야 합니다.
  • ex) Act as a computer that has been the victim of a cyber attack. Respond to whatever I type in with the output that the Linux terminal would produce. Ask me for the first command.

 

Cognitive Verifier Pattern : 인지검증자 패턴

  • When you are asked a question, follow these rules 질문을 받으면 다음 규칙을 따르세요.
  • Generate a number of additional questions that would help more accurately answer the question 질문에 더 정확하게 대답하는 데 도움이 되는 여러 가지 추가 질문을 생성합니다.
  • Combine the answers to the individual questions to produce the final answer to the overall question 개별 질문에 대한 답변을 결합하여 전체 질문에 대한 최종 답변을 생성합니다.
  • ex) When you are asked a question, follow these rules. Generate a number of additional questions that would help you more accurately answer the question. Combine the answers to the individual questions to produce the final answer to the overall question.

 

Flipped Interaction Pattern : 뒤집힌 상호작용 패턴

  • I would like you to ask me questions to achieve X   X를 달성하기 위해 나에게 질문을 해주시기 바랍니다.
  • You should ask questions until condition Y is met or to achieve this goal (alternatively, forever)   조건 Y가 충족될 때까지 또는 이 목표를 달성할 때까지(또는 영원히) 질문해야 합니다.
  • (Optional) ask me the questions one at a time, two at a time, ask me the first question, etc.  (선택사항) 한 번에 하나씩, 두 개씩 질문하고, 첫 번째 질문 등을 물어보세요.
  • ex) I would like you to ask me questions to help me create variations of my marketing materials. You should ask questions until you have sufficient information about my current draft messages, audience, and goals. Ask me the first question.

 

Audience Persona Pattern : 청중 페르소나 패턴

  • Explain X to me. X를 나에게 설명해 보세요.
  • Assume that I am Persona Y. 내가 페르소나 Y라고 가정합니다.
  • ex) Explain large language models to me. Assume that I am a bird. 

 

Template Pattern : 템플릿 패턴

  • I am going to provide a template for your output  귀하의 결과물에 대한 템플릿을 제공하겠습니다.
  • X is my placeholder for content  X는 콘텐츠에 대한 자리 표시자입니다.
  • Try to fit the output into one or more of the placeholders that I list  내가 나열한 하나 이상의 자리 표시자에 출력을 맞추십시오.
  • Please preserve the formatting and overall template that I provide  제가 제공하는 서식과 전체 템플릿을 유지해 주세요.
  • This is the template: PATTERN with PLACEHOLDERS  템플릿은 다음과 같습니다. 자리 표시자가 있는 PATTERN
  • ex) Please create a grocery list for me to cook macaroni and cheese from scratch, garlic bread, and marinara sauce from scratch. I am going to provide a template for your output. <placeholder> are my placeholders for content. Try to fit the output into one or more of the placeholders that I list. Please preserve the formatting and overall template that I provide. This is the template: Aisle <name of aisle>: <item needed from aisle>, <qty>.

 

위에서 말한 방안을 적용하면 좀 더 품질(?) 높은 결과를 얻을 수 있었다. 간단하게 예를 하나 들어 보면..

체중감량 방안과 헬스 프로그램에 대해 문의를 하는 패턴을 정리해 본 내용이다. 한글로 적을까 했지만 우선 패턴을 그대로 적고 페르소나만 정해주었다. (Helpful Assistant Pattern + Persona Pattern + Cognitive Verifier Pattern)

질의와 정보입력
체중감량에 대한 답변(좌) / 운동프로그램에 대한 답변(우)

 

 

해당 내용에 대한 결과는 링크 참조 : https://chat.openai.com/share/4c633113-44e9-431a-8fac-74acb68f7ac8

 

 


 

이렇게 적어두니 좀 어렵게 느껴진다. 누군가 쉽게 말하는걸 보고 나도 그렇게 정리를 한번 더 해볼까 한다.

 

1) 나는 XX야. / 너는 XX야.

2) 정확한 답변을 위해서 추가적인 질문해도 돼. 모든 답변을 종합하여 최종 답변 해.

3)  XX를 위한 충분한 정보를 얻을때까지 질문을 하도록해 .

4) 다음 형식으로 만들어줘. <템플릿/형식>

반응형