이 페이지에서는 프롬프트 설계를 시작하기 위한 몇 가지 기본 개념을 소개합니다. 프롬프트는 응답을 받기 위해 언어 모델에 제출되는 자연어 요청입니다. 프롬프트에는 완료하거나 계속할 모델에 대한 질문, 안내, 문맥 정보, 퓨샷 예시, 부분 입력이 포함될 수 있습니다. 사용되는 모델 유형에 따라 모델에서 프롬프트를 수신한 후 텍스트, 임베딩, 코드, 이미지, 동영상, 음악 등을 생성할 수 있습니다.
프롬프트 설계 및 프롬프트 엔지니어링이란?
프롬프트 설계는 언어 모델에서 원하는 응답을 유도하는 프롬프트를 만드는 프로세스입니다. 언어 모델에서 정확한 고품질의 응답을 보장하려면 잘 구조화된 프롬프트를 작성하는 것이 필수적일 수 있습니다. 프롬프트를 반복적으로 업데이트하고 모델 응답을 평가하는 반복 프로세스를 프롬프트 엔지니어링이라고도 합니다.
Gemini 모델은 특히 간단한 태스크에서 프롬프트 엔지니어링 없이도 잘 작동합니다. 그러나 복잡한 태스크에서는 효과적인 프롬프트 엔지니어링이 여전히 중요한 역할을 수행합니다.
프롬프트 구성요소
현재 태스크에 중요하다고 생각되는 모든 정보를 프롬프트에 포함할 수 있습니다. 일반적으로 프롬프트 콘텐츠는 다음 구성요소 중 하나에 속합니다.
태스크는 모델에서 응답을 제공하려는 프롬프트의 텍스트입니다. 태스크는 일반적으로 사용자가 제공하며 수행해야 할 작업에 대한 질문 또는 일부 지침이 될 수 있습니다.
질문 태스크 예시:
What are the colors in the rainbow?
A rainbow has seven colors: red, orange, yellow, green, blue, indigo, and violet. These colors
are always in the same order, which is determined by the way light is refracted and dispersed
by water droplets in the air. This order is sometimes remembered by the acronym ROYGBIV. The
wavelengths of the colors in a rainbow range from the longest (red) to the shortest (violet).
안내 작업 예시:
Write a one-stanza poem about Captain Barktholomew, the most feared pirate dog of the seven seas.
Captain Barktholomew, with patch and with peg,
The terror of parrots, the bane of each keg.
His bark is a cutlass, his bite is a storm,
He'll plunder your biscuits and leave you forlorn.
시스템 안내
시스템 안내는 프롬프트에서 사용자 입력 전에 모델에 전달되는 안내입니다. 전용 systemInstruction 매개변수에 시스템 안내를 추가할 수 있습니다.
다음 예시에서 시스템 안내는 모델의 스타일과 어조를 지시하는 동시에 모델이 설명할 수 있는 항목과 할 수 없는 항목에 제약 조건을 추가하는 데 사용됩니다.
You are Captain Barktholomew, the most feared pirate dog of the seven seas. You are from the
1700s and have no knowledge of anything after that time. You only talk about topics related to
being a pirate. End every message with "woof!"
Hello! Who might you be?
Avast there! You can call me Captain Barktholomew, the scourge of the seven seas!
I'm a terror to landlubbers, a plunderer of the highest order, and a fearsome pirate of the
deepest blue! I sail the seas in search of treasure and adventure, leaving a trail of
laughter and dog biscuits in my wake! Don't let my fuzzy exterior fool you - I'm a cunning
captain with a nose for treasure and a heart for adventure!
Now, if you'll excuse me, I must away! There's a ship on the horizon, and it looks like they're
carrying a chest full of dubloons! Yo ho ho, and a bottle of rum! Woof!
퓨샷 예시는 모델이 올바르게 설정된 모습을 보여주기 위한 프롬프트에 포함된 예시입니다. 퓨샷 예시는 응답의 스타일과 어조를 지시하고 모델의 동작을 맞춤설정하는 데 특히 효과적입니다.
Classify the following as red wine or white wine:
<examples>
Name: Chardonnay
Type: White wine
Name: Cabernet
Type: Red wine
Name: Moscato
Type: White wine
</examples>
Name: Riesling
Type:
White wine
컨텍스트 정보
컨텍스트 정보 또는 컨텍스트는 모델이 응답을 생성할 때 사용하거나 참조하는 프롬프트에 포함시키는 정보입니다. 테이블 또는 텍스트와 같은 다양한 형식의 컨텍스트 정보를 포함할 수 있습니다.
| Marble color | Number of marbles |
| ------------ | ----------------- |
| Red          | 12                |
| Blue         | 28                |
| Yellow       | 15                |
| Green        | 17                |
How many green marbles are there?
There are 17 green marbles.
안전 및 대체 응답
모델이 사용자의 요청을 처리하지 못할 것으로 예상되는 몇 가지 사용 사례가 있습니다.
특히 프롬프트가 Google의 가치나 정책에 부합하지 않는 응답을 유도하는 경우 모델은 응답을 거부하고 대체 응답을 제공할 수 있습니다.
모델이 응답을 거부할 가능성이 높은 몇 가지 경우는 다음과 같습니다.
증오심 표현: ID 또는 보호 속성을 타겟팅하는 부정적이거나 유해한 콘텐츠가 포함된 프롬프트입니다.
괴롭힘: 다른 사람을 대상으로 하는 악의적, 협박, 괴롭힘 또는 학대성 메시지가 포함된 프롬프트입니다.
음란물: 성행위 또는 기타 외설적인 콘텐츠에 대한 참조가 포함된 프롬프트입니다.
위험한 콘텐츠: 유해한 상품, 서비스 및 활동에 대한 액세스를 조장하거나 지원하는 프롬프트입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Introduction to prompting\n\n| To see an example of prompt design,\n| run the \"Intro to prompt design\" notebook in one of the following\n| environments:\n|\n| [Open in Colab](https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/gemini/prompts/intro_prompt_design.ipynb)\n|\n|\n| \\|\n|\n| [Open in Colab Enterprise](https://console.cloud.google.com/vertex-ai/colab/import/https%3A%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fgenerative-ai%2Fmain%2Fgemini%2Fprompts%2Fintro_prompt_design.ipynb)\n|\n|\n| \\|\n|\n| [Open\n| in Vertex AI Workbench](https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https%3A%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fgenerative-ai%2Fmain%2Fgemini%2Fprompts%2Fintro_prompt_design.ipynb)\n|\n|\n| \\|\n|\n| [View on GitHub](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/prompts/intro_prompt_design.ipynb)\n\nThis page introduces some basic concepts to get you started in designing prompts. A prompt is a\nnatural language request submitted to a language model to receive a response back. Prompts can\ncontain questions, instructions, contextual information, few-shot examples, and partial input for\nthe model to complete or continue. After the model receives a prompt, depending on the type of model\nbeing used, it can generate text, embeddings, code, images, videos, music, and more.\n\nWhat is prompt design and prompt engineering\n--------------------------------------------\n\n*Prompt design* is the process of creating prompts that elicit the desired response from\nlanguage models. Writing well structured prompts can be an essential part of ensuring accurate, high\nquality responses from a language model. The iterative process of repeatedly updating prompts and\nassessing the model's responses is sometimes called *prompt engineering*.\n\nGemini models often perform well without the need for prompt engineering, especially for\nstraightforward tasks. However, for complex tasks, effective prompt engineering still plays an\nimportant role.\n\nComponents of a prompt\n----------------------\n\nYou can include whatever information you want in a prompt that you think is important for the\ntask at hand. Generally, prompt content fall within one of the following components:\n\n- [Task (required)](#input)\n- [System instructions (optional)](#system_instructions)\n- [Few-shot examples (optional)](#few_shot_examples)\n- [Contextual information (optional)](#contextual_information)\n\n### Task\n\nA task is the text in the prompt that you want the model to provide a response for. Tasks are\ngenerally provided by a user and can be a question or some instructions on what to do.\n\n**Example question task:**\n\n**Example instruction task:**\n\n### System instructions\n\nSystem instructions are instructions that get passed to the model before any user input in the\nprompt. You can add system instructions in the dedicated\n[`systemInstruction`](/vertex-ai/generative-ai/docs/model-reference/inference#parameter-list)\nparameter.\n\nIn the following example, system instructions are used to dictate the style and tone of the\nmodel, while adding constraints to what it can and can't talk about:\n\nTo learn more about configuring system instructions, see [Use system instructions](/vertex-ai/generative-ai/docs/learn/prompts/system-instructions).\n\n### Few-shot examples\n\nFew-shot examples are examples that you include in a prompt to show the model what getting it\nright looks like. Few-shot examples are especially effective at dictating the style and tone of the\nresponse and for customizing the model's behavior.\n\n### Contextual information\n\nContextual information, or context, is information that you include in the prompt that the model\nuses or references when generating a response. You can include contextual information in different\nformats, like tables or text.\n\nSafety and fallback responses\n-----------------------------\n\nThere are a few use cases where the model is not expected to fulfill the user's requests.\nParticularly, when the prompt is encouraging a response that is not aligned with Google's values or\npolicies, the model might refuse to respond and provide a fallback response.\n\nHere are a few cases where the model is likely to refuse to respond:\n\n- **Hate Speech:** Prompts with negative or harmful content targeting identity and/or protected attributes.\n- **Harassment:** Malicious, intimidating, bullying, or abusive prompts targeting another individual.\n- **Sexually Explicit:** Prompts that contains references to sexual acts or other lewd content.\n- **Dangerous Content:** Prompts that promote or enable access to harmful goods, services, and activities.\n\nTask-specific guidance\n----------------------\n\nTo learn about task-specific guidance for common use cases check out the\nfollowing pages:\n\n- [Multimodal prompts](/vertex-ai/generative-ai/docs/multimodal/design-multimodal-prompts)\n- [Overview of prompting strategies](/vertex-ai/generative-ai/docs/learn/prompts/prompt-design-strategies)\n- [Chat prompts](/vertex-ai/generative-ai/docs/chat/chat-prompts)\n- [Image generation and editing prompts](/vertex-ai/generative-ai/docs/image/img-gen-prompt-guide)\n\nWhat's next\n-----------\n\n- Learn about [prompting strategies](/vertex-ai/generative-ai/docs/learn/prompts/prompt-design-strategies).\n- Explore more examples of prompts in the [Prompt gallery](/vertex-ai/generative-ai/docs/prompt-gallery).\n- Learn how to optimize prompts for use with [Google models](/vertex-ai/generative-ai/docs/learn/models) by using the [Vertex AI prompt optimizer (Preview)](/vertex-ai/generative-ai/docs/learn/prompts/prompt-optimizer)."]]