

# 일반 모범 사례
<a name="prompting-best-practices"></a>

다음 모범 사례는 주로 Amazon Nova 텍스트 모델에 적용되지만, 양식별 모범 사례 외에도 다른 모델에 적용할 수 있습니다.

멀티모달 입력에서 프롬프트를 작성하는 방법에 대한 자세한 내용은 [멀티모달 입력 프롬프트](prompting-multimodal.md) 섹션을 참조하세요. 음성 입력에서 프롬프트를 작성하는 방법에 대한 자세한 내용은 [음성 대화 프롬프트](sonic-system-prompts.md) 섹션을 참조하세요.

## 역할 이해
<a name="understanding-roles"></a>

Amazon Nova 모델을 사용하면 시스템, 사용자, 어시스턴트의 세 가지 역할을 통해 프롬프트를 구성할 수 있습니다.
+ **시스템(선택 사항)** - 필수는 아니지만 어시스턴트의 전반적인 동작 파라미터를 설정합니다. 사용자가 대화 전반에 걸쳐 모델이 준수해야 할 추가 지침과 가이드라인을 제공하는 데 활용할 수도 있습니다.
+ **사용자** - 사용자 쿼리와 함께 컨텍스트, 태스크, 지침 및 원하는 결과를 선택적으로 전달할 수 있습니다.
+ **어시스턴트** - 모델을 의도한 응답으로 안내하는 데 도움이 됩니다.

**Topics**
+ [역할 이해](#understanding-roles)
+ [정확한 프롬프트 생성](create-precise-prompts.md)
+ [프롬프트의 섹션에 초점 맞추기](prompting-bring-focus.md)
+ [시스템 역할 사용](prompting-system-role.md)
+ [예제 제공(퓨샷 프롬프팅)](prompting-provide-examples.md)
+ [도구 직접 호출 시스템](prompting-tools-function.md)
+ [고급 프롬프트 기법](advanced-prompting-techniques.md)

# 정확한 프롬프트 생성
<a name="create-precise-prompts"></a>

프롬프트 엔지니어링에서는 구체적인 사용자 쿼리를 작성하는 것이 매우 중요합니다. 잘 작성된 쿼리는 Amazon Nova 텍스트 이해 모델이 정확하고 적절한 응답을 생성하도록 지시합니다. 이러한 쿼리를 작성하려면 먼저 쿼리에 맥락에 맞는 정보를 제공해야 합니다. 제공된 컨텍스트는 명확한 대상 사용자 시나리오에 맞춰 모델을 더 잘 배치하여 결과의 관련성과 일관성을 향상시키는 데 도움이 됩니다.

## 맥락에 맞는 구체적인 정보 제공
<a name="prompting-specific-info"></a>

모델은 지침이 명확하고 체계적이며 짧고 구체적일 때 가장 효과적입니다. 이 프롬프트 템플릿 지침은 사용자 프롬프트와 시스템 프롬프트 모두에 적용됩니다.

**프롬프트 템플릿**

```
# Use this to clearly define the task and job needed by the model
task_summary = f"""
## Task Summary:
{{Task summary}}
"""

# Use this to provide contextual information related to the task
context_information = f"""
## Context Information:
- {{Context and content information 1}}
- {{Context and content information 2}}
...
"""

# Use this to provide any model instructions that you want model to adhere to
model_instructions = f"""
## Model Instructions:
- {{ Other Model Instructions }}
...
"""

# Use this to provide response style and formatting guidance
response_style = f"""
## Response style and format requirements:
- {{Style and format requirement 1}}
- {{Style and format requirement 2}}
...
"""

# Concatenate to final prompt
final_prompt = f"""{task_summary}
{context_information}
{model_instructions}
{response_style}"""
```

### 예: 구체적이고 맥락에 맞는 정보
<a name="specific-collapsible"></a>

다음은 구체적이고 맥락에 맞는 정보로 다시 작성된 프롬프트의 예제입니다. 맥락에 맞는 정보를 더 추가하면 모델이 원하는 행동에 대한 근거를 마련하는 데 도움이 됩니다.

------
#### [ Unclear prompt ]

`User:`

```
Write me a meeting invite to the project team
```

`Assistant:`

```
Certainly! Here's a sample meeting invite for your project team:

 ---

 **Subject:** Project Team Meeting - [Project Name]

 **Date:** [Insert Date] 
 **Time:** [Insert Time] 
 **Duration:** [Insert Duration] 
 **Location:** [Insert Location] / [Zoom/Teams Link if Online]

 **Agenda:**

 1. **Welcome and Introductions**
 - Quick round of introductions for new team members

 2. **Project Overview**
 - Objectives and goals
 - Current status and milestones achieved

 3. **Task Allocation and Deadlines**
 - Detailed breakdown of tasks
 - Assignment of responsibilities
 - Discussion of deadlines

 4. **Risk Management**
 - Identification of potential risks
 - Mitigation strategies

 5. **Resource Allocation**
 - Required tools and materials
 - Budget review

 6. **Q&amp;A Session**
 - Open floor for questions and clarifications

 7. **Next Steps and Closing**
 - Summary of action items
 - Schedule for the next meeting

 **Additional Notes:**

 - Please come prepared with any relevant documents or updates regarding your assigned tasks.
 - If you anticipate any issues or require additional support, please let us know in advance so we can address them during the meeting.

 **Contact Information:**

 For any questions or concerns before the meeting, please feel free to reach out to [Your Name] at [Your Email] or [Your Phone Number].

 We look forward to a productive discussion and to kicking off our project with enthusiasm!

 Best regards,

 [Your Full Name] 
 [Your Position] 
 [Your Contact Information]

 ---

 Feel free to customize this template to better fit your specific project and team needs!
```

------
#### [ Clear prompt ]

`User:`

```
Write me a meeting invite to the project team. The meeting is about project planning, and should be held on October 16th, from 10 AM to 11 AM in Conference Room B. Please include an agenda that covers our progress on the project thus far, as well as any upcoming milestones and deadlines.
```

`Assistant:`

```
**Meeting Invitation: Project Planning Session**

 **Date:** October 16th 
 **Time:** 10:00 AM - 11:00 AM 
 **Location:** Conference Room B

 **Agenda:**

 1. **Welcome and Introduction (10:00 AM - 10:05 AM)** 
 - Brief overview by the meeting facilitator.

 2. **Project Progress Update (10:05 AM - 10:30 AM)** 
 - Review of completed tasks and achievements to date. 
 - Detailed discussion on current project status and any challenges encountered.

 3. **Upcoming Milestones and Deadlines (10:30 AM - 10:50 AM)** 
 - Overview of the next phase of the project. 
 - Identification of key milestones and deadlines.

 4. **Action Items and Responsibilities (10:50 AM - 11:00 AM)** 
 - Assignment of tasks for the upcoming period. 
 - Confirmation of individual responsibilities and follow-up items.

 5. **Q&A Session (11:00 AM)** 
 - Open floor for any questions or concerns from team members.

 Please ensure your attendance to discuss and finalize our project planning for the next phase. Your insights and contributions are highly valued.

 Best regards,

 [Your Name] 
 [Your Position] 
 [Your Contact Information]
```

------
+ 명확성: 모델에 프롬프팅할 때는 기계가 아닌 사람이 이해할 수 있는 방식(예: JSON 스타일 목록)으로 가능한 한 명확하게 설명합니다.
+ 구체성: 모델에 태스크의 내용, 예상 결과물 및 모델이 원하는 방식으로 응답하는 데 도움이 되는 추가 컨텍스트에 대한 구체적인 지침을 제공합니다.

## 출력 형식 및 스타일 지정
<a name="prompting-style"></a>

Amazon Nova 2가 특정 요구 사항에 맞는 응답을 생성하도록 하려면 출력의 형식과 스타일을 지정할 수 있습니다. JSON으로만 응답을 생성하거나 응답 길이를 최대 단어 수, 요점 또는 단락으로 제한하려는 경우를 예로 들 수 있습니다. 이를 통해 Amazon Nova 2는 요구 사항을 더 잘 이해하고 더 관련성이 높고 구문 분석하기 쉬운 출력을 생성할 수 있습니다.

모델이 엄격하게 준수하도록 하려는 규칙을 강조하려면 ‘반드시 합니다’, ‘해서는 안 됩니다’와 같은 강력한 어구를 사용합니다. 예를 들어, 응답에 JSON 객체를 하나만 원하는 경우 ‘반드시 JSON 형식으로만 답합니다. 질문에 답변할 때 다른 형식을 사용해서는 안 됩니다.‘라고 모델에 지시할 수 있습니다.

다음은 구체적이고 맥락에 맞는 정보로 다시 작성된 프롬프트의 몇 가지 예제입니다. 맥락에 맞는 정보를 더 추가하면 모델이 원하는 행동에 대한 근거를 마련하는 데 도움이 됩니다.

### 예제 1: 추가 세부 정보 제공
<a name="style-collapsible1"></a>

응답 형식에 대한 추가 세부 정보를 추가하면 모델이 원하는 결과를 달성하는 데 도움이 될 수 있습니다. 일반적으로 사용되는 다른 응답 형식에는 CSV, 마크다운, YAML 및 XML이 포함됩니다.

------
#### [ Prompt without style constraints ]

`User:`

```
Outline the different types of rooms available in a typical 4-star hotel, including their features.
```

`Assistant:`

```
In a typical 4-star hotel, you'll find a range of room types, each designed to cater to different guest needs and preferences. Here's an outline of the different types of rooms available along with their features:

 ### 1. **Standard Room**
 - **Size:** Usually around 250-350 square feet.
 - **Features:**
 - Queen or double bed.
 - Complimentary Wi-Fi.
 - Flat-screen TV with cable or satellite channels.
 - Mini-fridge.
 - Coffee maker with complimentary coffee and tea.
 - Desk and chair.
 - En-suite bathroom with shower, toilet, and toiletries.
 - Air conditioning/heating.

 ### 2. **Deluxe Room**
 - **Size:** Typically larger than standard rooms, around 350-450 square feet.
 - **Features:**
 - King bed or two queen beds.
 - Larger bathroom with a bathtub.
 - Additional seating area.
 - Enhanced amenities like bathrobes and slippers.
 - Upgraded toiletries and sometimes a welcome gift.
 - Access to a lounge or executive floor perks.

 ### 3. **Suite**
 - **Size:** Varies significantly, often between 500-1,200 square feet.
 - **Features:**
 - Separate living area with a sofa bed or additional seating.
 - Kitchenette or full kitchen in some cases.
 - Larger, more luxurious bathroom with a bathtub and separate shower.
 - Multiple TVs.
 - Access to executive lounge.
 - High-end toiletries and often complimentary breakfast.
 - Often includes concierge services and in-room dining options.

 ### 4. **Family Room**
 - **Size:** Larger, usually around 400-500 square feet.
 - **Features:**
 - One king bed and one sofa bed or two queen beds.
 - Designed for families with children.
 - Extra space for luggage.
 - Child-friendly amenities like a small kitchenette or high chair.
 - Family bathroom with amenities suitable for kids.

 ### 5. **Executive Room**
 - **Size:** Typically around 350-450 square feet.
 - **Features:**
 - Business-oriented with a larger workspace.
 - Executive desk and chair.
 - Access to executive lounge with complimentary snacks and refreshments.
 - King bed or two queen beds.
 - Enhanced amenities like high-speed internet and sometimes a Nespresso machine.

 ### 6. **Junior Suite**
 - **Size:** Usually around 450-600 square feet.
 - **Features:**
 - Separate bedroom and living area.
 - King bed or two queen beds.
 - Kitchenette or mini-fridge.
 - Luxurious bathroom with a bathtub.
 - Lounge access.
 - High-end toiletries.

 ### 7. **Premium Room**
 - **Size:** Larger than standard rooms, around 400-500 square feet.
 - **Features:**
 - King bed or two queen beds.
 - Larger bathroom with a bathtub.
 - Enhanced amenities like a welcome drink and premium toiletries.
 - Access to premium services and sometimes a lounge.

 ### 8. **Connecting Rooms**
 - **Size:** Two rooms that connect via an internal door.
 - **Features:**
 - Suitable for families or groups.
 - Often includes one standard room and one suite.
 - Shared bathroom or en-suite bathrooms in each room.
 - Extra space for luggage and guests.

 ### 9. **Accessible Rooms**
 - **Size:** Varies, typically similar to standard rooms.
 - **Features:**
 - Designed for guests with disabilities.
 - Wider doorways and bathroom space.
 - Adapted fixtures and fittings.
 - Additional support services.

 ### 10. **Business Room**
 - **Size:** Usually around 300-350 square feet.
 - **Features:**
 - Focused on business travelers.
 - High-speed internet and large workspace.
 - Compact yet fully equipped with essentials.
 - Often includes a king bed.

 Each room type in a 4-star hotel is designed to provide comfort, convenience, and luxury tailored to different guest needs, ensuring a pleasant stay for all types of travelers.
```

------
#### [ Prompt with style contraints ]

`User:`

```
Outline the different types of rooms available in a typical 4-star hotel, including their features. All responses MUST be in YAML format.
```

`Assistant:`

```
```yaml
 hotel_rooms:
 - room_type: Standard Room
 features:
 - description: A comfortable room with essential amenities.
 amenities:
 - bed_type: Double bed or two single beds
 - bathroom: Private bathroom with shower
 - wifi: Complimentary high-speed internet
 - TV: Flat-screen TV with cable channels
 - mini_fridge: Available
 - tea_and_coffee_making_facilities: Yes

 - room_type: Deluxe Room
 features:
 - description: An upgraded room with more space and enhanced amenities.
 amenities:
 - bed_type: King-size bed or two single beds
 - bathroom: Private bathroom with both shower and bathtub
 - wifi: Complimentary high-speed internet
 - TV: Larger flat-screen TV with cable channels
 - mini_fridge: Available
 - tea_and_coffee_making_facilities: Yes
 - free_breakfast: Included

 - room_type: Suite
 features:
 - description: A luxurious room with separate living area and premium amenities.
 amenities:
 - bed_type: King-size bed or two single beds
 - bathroom: Private bathroom with both shower and bathtub
 - separate_living_area: Yes
 - wifi: Complimentary high-speed internet
 - TV: Large flat-screen TV with cable channels
 - mini_fridge: Available
 - tea_and_coffee_making_facilities: Yes
 - free_breakfast: Included
 - concierge_service: Available

 - room_type: Family Room
 features:
 - description: A spacious room designed for families with additional bedding options.
 amenities:
 - bed_type: Queen bed and rollaway bed or two single beds and rollaway bed
 - bathroom: Private bathroom with shower
 - wifi: Complimentary high-speed internet
 - TV: Flat-screen TV with cable channels
 - mini_fridge: Available
 - tea_and_coffee_making_facilities: Yes

 - room_type: Business Room
 features:
 - description: A room tailored for business travelers with enhanced workspace.
 amenities:
 - bed_type: Double bed or two single beds
 - bathroom: Private bathroom with shower
 - wifi: Complimentary high-speed internet
 - TV: Flat-screen TV with cable channels
 - workspace: Desk and chair
 - mini_fridge: Available
 - tea_and_coffee_making_facilities: Yes
 - business_center_access: Available
 ```
```

------

### 예제 2: 스타일 제약 조건 제공
<a name="style-collapsible2"></a>

이 경우 스타일 제약 조건이 있는 프롬프트는 따라야 할 제약 조건과 원하는 응답 형식에 대한 포괄적인 정보를 제공합니다. 응답에서 볼 수 있듯이 최적화된 프롬프트는 요청된 간결성과 글머리표 목록 구조에 더욱 잘 부합합니다.

------
#### [ Prompt without style constraints ]

`User:`

```
Explain the process of checking in a guest at a luxury resort.
```

`Assistant:`

```
Checking in a guest at a luxury resort involves a meticulous and personalized process designed to ensure a seamless and memorable start to their stay. Here’s a detailed overview of the steps involved:

 ### Pre-Arrival Preparation

 1. **Pre-Arrival Communication:**
 - **Confirmation:** Verify guest reservations and confirm arrival details.
 - **Special Requests:** Collect any special requests (dietary restrictions, room preferences, etc.) and ensure they are noted in the guest profile.
 - **Documentation:** Ensure all necessary documentation is ready, such as welcome letters, room keys, and any special amenities.

 2. **Room Preparation:**
 - **Cleaning:** Conduct a thorough cleaning and preparation of the guest room.
 - **Amenities:** Stock the room with high-end toiletries, fresh linens, and any requested amenities.
 - **Personal Touches:** Add personalized touches such as a welcome note, fresh flowers, or locally sourced treats.

 ### Arrival and Initial Interaction

 3. **Guest Arrival:**
 - **Greeting:** Have staff ready to greet guests as they arrive. This may include a warm welcome at the entrance or a meet-and-greet in the lobby.
 - **Transport:** Provide luxury transport options like a chauffeured car service to escort guests to the check-in desk.

 4. **Check-In Desk:**
 - **Professionalism:** Ensure check-in staff are well-trained, professional, and exude hospitality.
 - **Technology:** Utilize sophisticated check-in technology (like tablet kiosks) to streamline the process.
 - **Personalized Welcome:** Greet guests with a warm welcome, acknowledge their special requests, and present them with a personalized welcome kit.

 ### Documentation and Formalities

 5. **Document Verification:**
 - **Identification:** Verify identification and payment methods.
 - **Membership Cards:** If applicable, verify any loyalty or membership cards for additional benefits.

 6. **Registration:**
 - **Form Filling:** Assist guests with any required paperwork.
 - **Special Benefits:** Clearly explain any special resort benefits, upgrades, or exclusive access to amenities that the guest is entitled to.

 ### Room Assignment

 7. **Room Presentation:**
 - **Walk-Through:** Escort guests to their room and conduct a walk-through to ensure everything is in order and to address any immediate concerns.
 - **Upgrades:** Present any room upgrades and explain the features and services available in the upgraded room.

 8. **Key Delivery:**
 - **Room Key:** Provide the room key, often a high-end key card or a luxury key fob.
 - **Access Information:** Explain how to use the key card, including access to other amenities like the spa, pool, and gym.

 ### Additional Services

 9. **Welcome Amenities:**
 - **Amenity Kits:** Deliver welcome amenity kits (like a bottle of champagne, local delicacies, etc.).
 - **Itinerary:** Provide a detailed resort map and itinerary, highlighting all available services and activities.

 10. **Personal Concierge:**
 - **Concierge Services:** Introduce the guest to the concierge service and explain how to request any special services, such as dining reservations, transportation, or local excursions.
 - **Contact Information:** Provide contact information for key staff members.

 ### Final Touches

 11. **Feedback:**
 - **Satisfaction Survey:** At the end of the check-in process, ask for feedback to ensure the guest’s expectations were met and to gather any immediate suggestions.

 12. **Follow-Up:**
 - **Immediate Issues:** Ensure any immediate issues or requests are addressed promptly.
 - **Comfort Check:** Make follow-up calls or send messages to ensure the guest is settling in comfortably.

 By following these steps, a luxury resort aims to provide an exceptional check-in experience that sets the tone for an unforgettable stay.
```

------
#### [ Prompt with style contraints ]

`User:`

```
Explain the process of checking in a guest at a luxury resort. Provide all answers in a numbered list format, with each point containing no more than 15 words, and no more than 6 bullet points.
```

`Assistant:`

```
1. Greet guest warmly with a smile and offer assistance.
2. Verify reservation details and check guest's identification.
3. Confirm room assignment and amenities provided.
4. Explain resort services and amenities available.
5. Present room key and offer directions to guest's suite.
6. Wish guest a pleasant stay and be available for queries.
```

------

### 예제 3: 응답 형식 제한
<a name="style-collapsible3"></a>

여기서 응답 형식이 있는 프롬프트는 모델이 자세한 내용은 배제하고 카테고리 번호로만 응답하고 1\$110으로 제한하도록 합니다.

------
#### [ Prompt without response format ]

`User:`

```
In this task, you are given a text which is the body of a document. Your job is to classify the topic of the document into these categories: 1)Company, 2)Educational Institution, 3)Artist, 4)Athlete, 5)Office Holder, 6)Mean of transportation, 7)Building, 8)Natural place, 9)Village, 10)Animal. 
Text: Johangsan is a mountain of South Korea. It has an elevation of 954 metres.
```

`Assistant:`

```
To classify the topic of the given text, let's analyze the content step-by-step:

 1. The text mentions "Johangsan," which appears to be a specific name.
 2. The text states that "Johangsan is a mountain," which provides a clear indication of its nature.
 3. It is further specified that it is located in "South Korea" and has an elevation of "954 metres."

 Based on the information provided, the text describes a geographical feature, specifically a mountain. From the given categories, the most appropriate classification for this document is:

 8) Natural place

 The text does not mention any company, educational institution, artist, athlete, office holder, means of transportation, building, village, or animal. Therefore, the classification as a "Natural place" is the most fitting choice.
```

------
#### [ Prompt with response format ]

`User:`

```
In this task, you are given a text which is the body of a document. Your job is to classify the topic of the document into these categories: 1)Company, 2)Educational Institution, 3)Artist, 4)Athlete, 5)Office Holder, 6)Mean of transportation, 7)Building, 8)Natural place, 9)Village, 10)Animal. Your output should be the category number. DO NOT generate anything apart from numbers 1-10.
Text: Johangsan is a mountain of South Korea. It has an elevation of 954 metres.
```

`Assistant:`

```
8
```

------

## 명확한 프롬프트 섹션 제공
<a name="prompting-clear-section"></a>

초기 컨텍스트 외에도 구조화된 쿼리 형식은 언어 모델과의 상호 작용을 최적화하는 데 중요한 역할을 합니다. 입력의 개별 부분을 구분 기호로 구분하면 명확성이 보장되고 Amazon Nova 2 모델의 쿼리 구조 이해 능력이 향상됩니다. 또 다른 효과적인 방법은 번호가 매겨진 목록 또는 글머리 기호를 사용하는 것입니다. 이렇게 하면 태스크를 관리 가능한 단계로 나누고 수행해야 할 작업에 대한 명확한 개요를 제공하는 데 도움이 됩니다. 이 구조화된 접근 방식은 모호성을 줄이고 생성된 응답의 정확도를 개선하는 데 도움이 됩니다.

### 예: 섹션화된 프롬프트 생성
<a name="section-collapsible1"></a>

섹션화된 프롬프트 열에서는 섹션화되지 않은 프롬프트 열의 지침과 비교할 때 프롬프트가 더 명확하고 태스크, 컨텍스트, 요구 사항 등 다양한 개체에 대한 섹션이 구분되어 있는 것을 볼 수 있습니다.

------
#### [ Unsectioned Prompt ]

`User:`

```
Write an article about climate change for high school students explaining basic concepts, current impacts, and individual actions to mitigate it. Make it informative and engaging with simple language, including statistics and real-world examples.
```

`Assistant:`

```
### Understanding Climate Change: What It Is, What It’s Doing, and What You Can Do About It

 #### Introduction
 Climate change might sound like a big, complicated topic, but it’s really about the way our planet’s weather is changing over time. This change is mostly happening because humans are doing things that are making our Earth warmer. Let’s break it down so you can understand what’s going on and what you can do to help.

 #### What Is Climate Change?
 Climate change refers to long-term shifts in temperatures and weather patterns. These shifts may be natural, but since the 1800s, human activities have been the main driver of rapid climate change.

 **Key Concept: Greenhouse Gases**
 To understand this, we need to talk about greenhouse gases. These gases, like carbon dioxide (CO2), methane (CH4), and nitrous oxide (N2O), trap heat in our atmosphere. Without these gases, Earth would be too cold for most life forms. But when we burn fossil fuels (like coal, oil, and natural gas) and cut down forests, we release too much CO2 and other greenhouse gases, trapping more heat and making the planet warmer.

 #### Current Impacts of Climate Change
 Let’s look at some real-world examples to see how climate change is affecting our world today.

 **1. Rising Temperatures**
 Since the late 19th century, Earth’s average surface temperature has risen about 2 degrees Fahrenheit (1 degree Celsius). Scientists predict that if we don’t change our ways, it could rise by 3.6 to 4.3 degrees Fahrenheit (2 to 2.4 degrees Celsius) by the end of this century.

 **2. More Extreme Weather**
 Climate change is making extreme weather events more frequent and severe. For example:
 - **Hurricanes:** In the U.S., hurricane seasons are getting longer and more destructive. In 2020, there were 30 named storms, the most ever recorded.
 - **Droughts:** Parts of California have experienced some of the worst droughts in history, affecting agriculture and water supplies.

 **3. Melting Ice Caps and Rising Sea Levels**
 Glaciers and ice sheets are melting at alarming rates. This not only affects wildlife but also leads to rising sea levels. Since 1901, global sea levels have risen by about 8 inches (20 centimeters). By 2100, they could rise by another 1 to 4 feet (0.3 to 1.2 meters).

 **4. Ocean Acidification**
 As CO2 levels rise, more of it is absorbed by the oceans, making them more acidic. This is particularly harmful to marine life, including coral reefs. Coral reefs are crucial for marine biodiversity but are now dying at an alarming rate.

 #### Individual Actions to Mitigate Climate Change
 You might think that since climate change is a huge problem, one person can’t make a difference. But even small actions can add up to make a big impact.

 **1. Reduce, Reuse, Recycle**
 Try to minimize waste by:
 - **Reducing:** Buy fewer items and choose products with less packaging.
 - **Reusing:** Use reusable bags, bottles, and containers.
 - **Recycling:** Make sure to recycle paper, plastic, and glass properly.

 **2. Conserve Energy**
 Small changes can lead to big savings:
 - Turn off lights when you leave a room.
 - Unplug devices that you’re not using.
 - Use energy-efficient bulbs and appliances.

 **3. Use Less Meat**
 Livestock farming is a major contributor to greenhouse gas emissions. By eating less meat, especially beef, you can reduce your carbon footprint.

 **4. Support Renewable Energy**
 If possible, support or switch to renewable energy sources like solar or wind power. Even advocating for these options in your community can make a difference.

 **5. Educate Yourself and Others**
 Knowledge is power. The more you know about climate change, the more you can help others understand it. Share facts and encourage your friends and family to take action too.

 #### Conclusion
 Climate change is a pressing issue that affects everyone on the planet. By understanding its basics, recognizing its current impacts, and taking individual actions, you can play a crucial role in mitigating its effects. Remember, every small step counts, and together, we can make a big difference for our planet.

 Let’s start today and build a sustainable future!
```

------
#### [ Sectioned Prompt ]

`User:`

```
**Task:**
Write an article 

**Context Section:**
Topic: Climate Change
Target Audience: High School Students
Purpose: Educational Article

**Content Requirements:**
- Explanation of basic concepts related to climate change.
- Examples of current impacts on ecosystems and human populations.
- Suggestions for individual actions to mitigate climate change.

**Tone and Style:**
- Informative and engaging
- Use simple language
- Include statistics and real-world examples
```

`Assistant:`

```
# Understanding Climate Change: A Guide for High School Students

 ## Introduction

 Climate change is one of the most pressing issues of our time. It affects our planet, our ecosystems, and our daily lives. Understanding what climate change is and how it impacts us can help us take action to make a difference. This article will explain the basic concepts of climate change, provide examples of its current impacts, and suggest actions you can take to help mitigate it.

 ## What is Climate Change?

 **Climate change** refers to long-term changes in global temperatures and weather patterns. These changes are primarily caused by human activities, especially the burning of fossil fuels like coal, oil, and natural gas. When we burn these fuels, we release large amounts of greenhouse gases, such as carbon dioxide (CO2) and methane (CH4), into the atmosphere. These gases trap heat from the sun, causing the Earth's temperature to rise. This is often referred to as the **greenhouse effect**.

 ### Basic Concepts:

 1. **Greenhouse Gases**: These gases include carbon dioxide, methane, nitrous oxide, and fluorinated gases. They trap heat in the Earth’s atmosphere.
 
 2. **Global Warming**: This is the increase in Earth's average surface temperature due to rising levels of greenhouse gases.

 3. **Climate Change**: Refers to the broader set of changes in the Earth’s climate system, including global warming.

 ## Current Impacts of Climate Change

 ### On Ecosystems:

 1. **Melting Ice Caps and Glaciers**: The polar ice caps and glaciers are melting at an alarming rate. For example, the Arctic sea ice is shrinking, which affects polar bears and other Arctic animals.

 2. **Rising Sea Levels**: As ice melts, sea levels rise. This can lead to the loss of coastal habitats and increased flooding in coastal areas.

 3. **Changing Weather Patterns**: Climate change can lead to more frequent and severe weather events such as hurricanes, droughts, and heatwaves. For example, the 2020 Australian bushfires were more intense and lasted longer than usual due to climate change.

 ### On Human Populations:

 1. **Health Issues**: Rising temperatures can lead to more heat-related illnesses and the spread of diseases like malaria and dengue fever.

 2. **Food Security**: Changes in climate can affect crop yields, leading to food shortages. For example, droughts in Sub-Saharan Africa have caused significant food insecurity.

 3. **Displacement**: Rising sea levels and extreme weather events can force people to leave their homes, becoming climate refugees. For instance, communities in Bangladesh are being displaced by rising sea levels.

 ## Actions You Can Take

 Even though climate change is a massive issue, there are many actions you can take to help mitigate its effects. Here are some simple steps you can start with today:

 1. **Reduce, Reuse, Recycle**: By reducing waste, reusing items, and recycling, you can decrease the amount of trash that ends up in landfills and reduce greenhouse gas emissions.

 2. **Save Energy**: Turn off lights when you don’t need them, use energy-efficient appliances, and unplug devices when they’re not in use. These small actions can make a big difference.

 3. **Use Less Meat**: Livestock farming produces a significant amount of methane. By eating less meat, particularly beef, you can reduce your carbon footprint.

 4. **Support Renewable Energy**: Advocate for or invest in renewable energy sources like solar and wind power. These sources produce energy without greenhouse gas emissions.

 5. **Educate and Advocate**: Inform others about the impacts of climate change and advocate for policies that support environmental sustainability. You can join or support environmental clubs at school or participate in local clean-up efforts.

 ## Conclusion

 Climate change is a complex issue with far-reaching impacts. However, understanding it and taking action can make a significant difference. By learning about the basic concepts, recognizing the current impacts, and implementing simple changes in our daily lives, we can all contribute to mitigating climate change. Remember, every small action counts, and together, we can create a more sustainable future for our planet.
```

------

# 프롬프트의 섹션에 초점 맞추기
<a name="prompting-bring-focus"></a>

Amazon Nova 2 모델은 섹션별로 지침을 구성한 다음 해당 섹션을 참조하여 프롬프트의 특정 부분에 주의를 기울일 수 있습니다. 마크다운, XML 또는 기타 구조를 사용하여 프롬프트에 명확한 섹션 구분이 있는 경우 모델은 주의를 기울일 수 있습니다. 예를 들어, 섹션 이름을 정의하고 `##Section Name##`을 사용한 다음 프롬프트에서 `##Section Name##`을 사용하여 해당 섹션을 참조할 수 있습니다.

또한 이 전략을 활용하여 모델이 생성된 응답에서 입력 프롬프트의 일부를 공개하지 못하도록 제한할 수 있습니다. 예를 들어 입력 프롬프트에 퓨샷 예제나 지침을 제공할 때 `##Instructions##` 또는 `##Examples##`와 같은 구분 기호와 새 줄 바꿈 기호를 사용하고 `DO NOT mention anything inside the ##Instructions## or ##Examples## in the response`와 같은 강력한 지침을 제공하여 모델이 이 섹션의 입력 프롬프트 콘텐츠를 출력에서 ​​그대로 반복하지 않도록 합니다.

## 예: 섹션 구분
<a name="focus-collapsible"></a>

사용자:

```
You're an expert Prompts creator. Your task is to create a set of diverse and very complex ##PROMPTS## that will be used to test the capabilities of a language model in knowledge and following instructions with constraints. Please create 10 ##PROMPTS##. You must strictly follow ##GUIDELINES##:

##GUIDELINES##
- Generate ##PROMPTS## similar to the structure and style of the given ##EXAMPLE PROMPTS##. Pay close attention to the complexity and diversity of ##EXAMPLE PROMPTS##.
- Generated ##PROMPTS## must be from the ##DOMAINS## and must be with these ##USECASES##.
- Each of the ##PROMPTS## needs to be unique and very complex. 
- Each of the ##PROMPTS## must have more than 4 sentences and 1 constraint.
- Each of the ##PROMPTS## should have at least 70 words.
- Each of the ##PROMPTS## should have an answer that can be written in text.
- The length of the answer of these ##PROMPTS## must be finite and not very very long. 
- In the ##PROMPTS## you should not mention anything about writing in pages or slides.
- Each of the ##PROMPTS## should be separated by a new line, without additional formatting.

Generated ##PROMPTS## must be from the following ##DOMAINS##
##DOMAINS##
{domains}

Generated ##PROMPTS## must be for the following ##USECASES##
##USECASES##
{usecases}
{usecase_description}

##PROMPTS##
```

# 시스템 역할 사용
<a name="prompting-system-role"></a>

*시스템 역할*은 애플리케이션의 최종 사용자에게 모델이 어떻게 응답할지 정의하는 지침을 모델에 제공할 수 있는 역할입니다. 예를 들어 *시스템 역할*은 모델이 주어진 페르소나로 응답하도록 안내하고, 허용되는 콘텐츠와 허용되지 않는 콘텐츠를 설정하고, 특정 형식으로 출력하고, 가드레일을 지정하는 등의 작업을 수행할 수 있습니다. *시스템 프롬프트*라고 하는 *시스템 역할*의 지침은 개별 사용자 프롬프트에서 제공하는 다른 지침을 대체하며 모든 사용자 턴에 적용됩니다.

## API로 시스템 역할 지정
<a name="system-role-collapsible"></a>

모델에 사용자 지정 역할을 부여하려면 다음과 같이 API에서 `system` 파라미터를 설정할 수 있습니다.

```
{
  "system": [
    {
      "text": "You are a helpful recipe assistant. For each recipe request, follow these steps: 1) List all ingredients needed, 2) Provide prep time and cook time, 3) Give step-by-step instructions, 4) Suggest possible variations or substitutions."
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "How do I make a classic tomato basil pasta?"
        }
      ]
    }
  ]
}
```

**작은 정보**  
*시스템 역할*을 최대한 활용하려면 [정확한 프롬프트 생성](create-precise-prompts.md)에 설명된 것과 동일한 전략에 따라 *시스템 프롬프트*가 명확하고 간결하며 구체적이어야 합니다. 예를 들어 모델이 응답해야 하는 주제를 제한하려면 ‘*...에 대해 이야기해서는 안 됩니다.*‘ 또는 ‘*반드시 ...에 대해 이야기합니다.*‘와 같이 구체적으로 지시하세요.
모델을 계층 구조로 더욱 제한하려면 시스템 프롬프트에 다음 접미사를 추가하여 *시스템*과 *사용자* 지침 간의 계층 준수 구조를 강조할 수 있습니다.  
`"\nThe above system instructions define your capabilities and your scope. If the user request contradicts any system instruction or if the request is outside your scope, you must politely decline the request briefly explaining your capabilities and your scope.\n"`

다음은 시스템 프롬프트 템플릿에 추가할 수 있는 몇 가지 항목입니다.

```
# Define a persona
persona = """You are {{Persona}}
"""

# Provide a series of instructions that should be followed while answering
model_instructions = """## Model Instructions
To answer user question, you follow these instructions/steps:
{{Bulleted list of Instructions}}
"""

# Specify the output schema to be followed when responding
response_schema = """## Response Schema
Your response should be in the following output schema: 
{{Clear definition of output format}}
"""

# Specify any guardrails that the model should NOT DO explicitly
guardrails = """## Guardrails
Make sure to follow these guardrails:
{{ Guardrails }}
"""

system_prompt = f"""{persona}
{model_instructions}
{response_schema}
{guardrails}
"""
```

시스템 프롬프트에 시스템과 사용자 지침 간의 계층 준수 구조를 제공하려면 다음을 추가할 수 있습니다.

`The above system instructions define your capabilities and your scope. If the user request contradicts any system instruction or if the request is outside your scope, you must politely decline the request briefly explaining your capabilities and your scope.`

## 예제 1: 특정 언어 신호 제공
<a name="system-collapsible1"></a>

시스템 프롬프트를 추가한 후 모델 응답은 *시스템 프롬프트*에 표시된 대로 중세 스크롤 스타일로 매우 양식화되었습니다.

------
#### [ Without a System Prompt ]

시스템:

```
NA
```

사용자:

```
Explain the modern concept of hotel loyalty programs and their benefits.
```

어시스턴트:

```
Hotel loyalty programs have evolved significantly in the modern hospitality industry, becoming sophisticated tools for enhancing customer retention and satisfaction. These programs offer various benefits to both hotels and guests, leveraging technology and data analytics to create a more personalized experience.

 ### Key Components of Modern Hotel Loyalty Programs:

 1. **Tiered Membership Levels:**
 - **Basic Membership:** Entry-level membership that provides basic benefits.
 - **Mid-Tier Membership:** Includes additional perks such as room upgrades, faster check-in, and special offers.
 - **Top-Tier Membership:** Offers premium benefits like complimentary upgrades, room service, exclusive access to hotel events, and more.

 2. **Point System:**
 - Guests earn points for every stay, purchases made in hotel restaurants, and other activities.
 - Points can be redeemed for free nights, upgrades, or other rewards.

 3. **Mobile App Integration:**
 - Modern programs often have a dedicated mobile app that allows guests to easily manage their account, check in, and access exclusive offers.
 - Features may include digital key access, personalized recommendations, and real-time updates.

 4. **Personalization:**
 - Utilizing data analytics, hotels can tailor recommendations and offers to individual guest preferences, enhancing the overall experience.
 - Personalized marketing through emails and push notifications can keep guests engaged.

 5. **Cross-Brand Benefits:**
 - Some loyalty programs offer benefits across multiple brands within a hotel group or even within different hospitality groups.
 - This can include discounts, points transfers, and combined rewards.

 6. **Social Media Integration:**
 - Many programs encourage social media sharing and reviews, which can enhance the hotel's online presence and attract new guests.
 - Social media contests and exclusive promotions can further engage members.

 7. **Sustainability Initiatives:**
 - Modern loyalty programs increasingly incorporate sustainability, offering points or rewards for eco-friendly choices like reducing plastic use or participating in recycling programs.

 ### Benefits to Guests:

 1. **Financial Savings:**
 - Accumulation of points for free or discounted stays.
 - Exclusive discounts and offers not available to non-members.

 2. **Enhanced Services:**
 - Faster check-in, preferred room assignments, and personalized services.
 - Access to exclusive events and experiences.

 3. **Convenience:**
 - Easy booking and management through mobile apps.
 - Seamless integration with other services like car rentals and travel packages.

 4. **Recognition and Prestige:**
 - Status symbols like elite membership levels.
 - Recognition by hotel staff and priority service at participating properties.

 ### Benefits to Hotels:

 1. **Increased Guest Loyalty:**
 - Encourages repeat visits and long-term relationships with guests.
 - Helps retain customers even when faced with competition.

 2. **Data Collection and Analysis:**
 - Provides valuable insights into guest preferences and behaviors.
 - Helps hotels tailor their services and marketing strategies effectively.

 3. **Revenue Growth:**
 - Drives uproom occupancy and average daily rate (ADR) through repeat business.
 - Cross-selling opportunities within the hotel (e.g., dining, spa services).

 4. **Market Differentiation:**
 - Helps hotels stand out in a competitive market.
 - Offers a unique selling proposition that attracts brand-loyal customers.

 ### Conclusion:

 Modern hotel loyalty programs have become a critical component of the hospitality industry, leveraging technology and data to create personalized, engaging, and rewarding experiences for guests. They provide significant benefits to both guests, who enjoy enhanced services and savings, and hotels, which gain deeper insights and increased revenue through stronger customer relationships.
```

------
#### [ With a System Prompt ]

시스템:

```
Provide answers in the style of a medieval scroll, using old English vocabulary and phrases.
```

사용자:

```
Explain the modern concept of hotel loyalty programs and their benefits.
```

어시스턴트:

```
Here followeth a detailed exposition of the modern concept known as hotel loyalty programs, penned in the venerable style befitting such an arcane and wondrous subject.

 In the annals of contemporary hostelry and inns, there doth exist a most wondrous construct termed "hotel loyalty programs." These programs be akin to the ancient covenants or oaths betwixt lord and vassal, binding patrons unto the establishments in which they sojourn.

 Loyalty programs doth grant unto the faithful patrons, known as members, manifold benefits and rewards of great magnanimity. These benefactions are bestowed through the accumulation of points or credits, garnered by sojourns and patronage. Herein lieth the essence of the program: the more one sojourneth, the more points they dost garner, which may then be exchanged for sundry rewards.

 The benefits of these programs are manifold and most enticing:

 1. **Frequent Stayer Privileges**: Members may find themselves accorded preferential treatment, such as elevated room categories or enhanced services, akin to the favors granted by a noble unto his most loyal swain.

 2. **Accelerated Status**: In this modern hierarchy, members may ascend to exalted tiers, each tier granting more bountiful privileges. Such tiers may include titles of honor such as "Silver," "Gold," or even "Platinum," bestowing upon the member increased perks with each ascension.

 3. **Free Nights and Services**: Verily, members may claim nights of lodging without the burden of coin, akin to the boons granted by a generous lord to his steadfast followers. Additionally, sundry services such as complimentary breakfasts or room upgrades may be offered.

 4. **Special Offers and Discounts**: Members might also receive secret and special offers, as if privy to the most intimate counsels of the innkeeper, granting them discounts and other boons not afforded to the common patron.

 5. **Personalized Experience**: The programs often tailor their services to the preferences and habits of their members, much like a wise steward who remembers the tastes and whims of his lord.

 Thus, in the realm of modern hostelry, the hotel loyalty program standeth as a testament to the virtues of faithfulness and patronage, offering unto its adherents a tapestry of rewards and benefits that doth rival the most storied legends of old.
```

------

## 예제 2: 가드레일 제공
<a name="system-collapsible2"></a>

*시스템 프롬프트*를 추가하면 사용자는 애플리케이션에 가드레일을 추가하여 의도하지 않은 사용으로부터 애플리케이션을 보호할 수 있습니다. 다음은 가드레일이 원하는 태스크에 모델을 집중할 수 있는 방법에 관한 예제입니다.

------
#### [ Without a System Prompt ]

시스템:

```
NA
```

사용자:

```
Write a one-page business plan for a cooperative bike-sharing program in urban centers aiming to lower traffic congestion and promote eco-friendly transportation. (Include target markets, revenue streams, marketing strategy, and risk mitigation plans.)
```

어시스턴트:

```
**Urban EcoCycle: A Cooperative Bike-Sharing Program**

 **Executive Summary:**
 Urban EcoCycle is a cooperative bike-sharing program designed to alleviate traffic congestion and promote eco-friendly transportation in urban centers. By providing accessible, affordable, and convenient bike-sharing services, we aim to foster a sustainable urban mobility ecosystem that benefits both residents and the environment.

 **Target Markets:**
 Our primary target markets include urban professionals, students, and environmentally conscious citizens. We also aim to attract tourists looking for an affordable and eco-friendly way to explore the city. Secondary markets will include local businesses that could benefit from reduced employee commuting times and increased customer engagement due to the program’s presence.

 **Revenue Streams:**
 1. **Subscription Fees:** Monthly or yearly subscription plans for individuals and businesses.
 2. **Ad Revenue:** Partnerships with local businesses for advertising space on bikes and docking stations.
 3. **Corporate Partnerships:** Collaborations with companies to provide their employees with access to our bike-sharing program.
 4. **Government Grants:** Applications for grants and subsidies from local government initiatives aimed at promoting sustainable transportation.

 **Marketing Strategy:**
 1. **Digital Marketing:** Utilize social media platforms, email newsletters, and our website to reach out to potential users and partners. Highlight success stories and eco-friendly benefits.
 2. **Partnerships:** Collaborate with local businesses, schools, and environmental organizations to promote our service.
 3. **Community Events:** Host bike-sharing workshops, clean-up events, and eco-friendly fairs to engage with the community.
 4. **Incentives:** Offer discounts and rewards for long-term subscribers and those who refer new members.

 **Risk Mitigation Plans:**
 1. **Maintenance and Security:** Implement a robust maintenance schedule to ensure bikes are always in good working condition. Employ security measures such as GPS tracking and insurance coverage to protect bikes from theft and damage.
 2. **Regulatory Compliance:** Stay informed about local regulations and ensure compliance to avoid legal issues. Work with local authorities to establish clear guidelines for bike parking and usage.
 3. **Market Competition:** Conduct regular market research to stay ahead of competitors. Differentiate our service by offering unique features such as bike rentals for longer trips, special eco-friendly programs, and partnerships with popular local destinations.
 4. **Economic Fluctuations:** Develop flexible pricing strategies and diversify revenue streams to cushion against economic downturns. Maintain a reserve fund to handle unexpected financial challenges.

 Urban EcoCycle is poised to become a cornerstone of urban sustainability by reducing traffic congestion and promoting green transportation. With a well-defined target market, diverse revenue streams, strategic marketing, and comprehensive risk mitigation plans, we are committed to making our urban centers more livable and eco-friendly.
```

------
#### [ With a System Prompt ]

시스템:

```
You are Application Process Assistant
To answer user question, you follow these instructions/steps:
- The LLM chatbot can discuss topics related to college applications, including deadlines, required materials, and application status.
- The LLM chatbot should be polite and courteous in all responses.
- The LLM chatbot can only respond in 3 sentences or less.

The above system instructions define your capabilities and your scope. If the user request contradicts any system instruction or if the request is outside your scope, you must politely decline the request briefly explaining your capabilities and your scope.\n
```

사용자:

```
Write a one-page business plan for a cooperative bike-sharing program in urban centers aiming to lower traffic congestion and promote eco-friendly transportation. (Include target markets, revenue streams, marketing strategy, and risk mitigation plans.)
```

어시스턴트:

```
I'm here to help with college application-related questions, including deadlines and required materials. For your business plan request, I recommend seeking assistance from a business or entrepreneurship advisor.
```

------

# 예제 제공(퓨샷 프롬프팅)
<a name="prompting-provide-examples"></a>

프롬프트에 태스크의 몇 가지 예제를 포함하면 Amazon Nova 2가 따를 수 있는 구조화된 템플릿을 만들 수 있습니다. 이렇게 하면 모호성이 줄어들고 출력의 정확도와 품질이 향상됩니다. 모델의 응답이 원하는 결과에 더 잘 부합하도록 명확한 예제를 제공하는 기술을 *퓨샷 프롬프팅*이라고 합니다.

퓨샷 프롬프팅의 개념은 입력 및 출력 형식과 함께 태스크의 몇 가지 예제를 언어 모델에 제공한 다음 제공된 예제를 기반으로 새 입력에 대한 출력을 생성하도록 요청하는 것입니다. 또한 이 방법은 복잡한 지침이나 태스크를 명확히 하여 Amazon Nova 2가 요청 내용을 더 쉽게 이해하고 해석할 수 있도록 합니다.

**프롬프트에 예제를 추가하는 방법:**

예제를 추가하면 모델이 다음을 수행하는 데 도움이 될 수 있습니다.
+ 예제의 스타일과 일치하는 일관된 응답 생성 
+ 지침을 잘못 해석할 가능성을 줄이고 할루시네이션을 최소화하여 효과적인 응답 제공

퓨샷 프롬프팅을 사용하여 모델 성능이 얼마나 향상되는지는 선택한 예제의 품질과 다양성에 따라 달라집니다. 다음 항목은 프롬프트에서 좋은 샷의 특징을 보여줍니다.
+ **다양한 예제 선택**: 선택한 예제는 관련 사용 사례를 적절히 포괄할 수 있도록 다양성(일반적인 사용 사례부터 엣지 사례까지) 측면에서 예상되는 입력/출력 분포를 나타내야 합니다. 입력의 편향으로 인해 출력도 편향될 수 있으므로 예제에서 편향을 방지하는 것이 중요합니다.
+ **복잡성 수준 일치**: 제공된 예제의 복잡성은 대상 태스크 또는 시나리오와 일치해야 합니다. 프롬프트에서 예상 입력과 선택한 예제 사이에 복잡성 등급이 매핑되었는지 확인하는 것이 중요합니다.
+ **관련성 확인**: 선택한 예제는 현재 문제 또는 목표와 직접 관련이 있어야 합니다. 이렇게 하면 응답의 일관성과 균일성이 보장됩니다.

**작은 정보**  
위의 제안이 효과가 없다면 사용자 입력 쿼리와 사용 가능한 샷 풀 간의 유사성을 기반으로 동적 샷 선택으로 프롬프트를 보강하는 RAG 기반 시스템을 구축하는 것이 좋습니다.

## 예제 1: 사용자 프롬프트에 예제 제공
<a name="example-collapsible1"></a>

여기에서는 사용자가 들어오는 고객 지원 티켓을 미리 정의된 카테고리로 분류하려고 합니다. Amazon Nova 2 모델에 올바르게 분류된 티켓의 몇 가지 예제를 제공하여 티켓에 사용되는 카테고리와 언어에 대한 이해를 높일 수 있습니다. 예시 예제는 간결해야 하며 애플리케이션에서 목표로 하는 모든 태스크를 표현해야 합니다. 이 예의 `Ticket`이나 `Category`와 같이 태스크에 의미 있는 특정 필드 이름이 있는 경우에는 콜론 `":"`을 바로 뒤에 붙여 해당 필드를 사용할 수 있습니다.

------
#### [ 0-shot prompt ]

사용자:

```
Please classify the following customer support tickets into one of the categories: "Technical Issue," "Billing Inquiry," or "General Inquiry." 

Ticket: "Can you explain why my latest bill is higher than usual? I haven't changed my plan."
```

어시스턴트:

```
The customer support ticket should be classified as a "Billing Inquiry."

 Here’s the reasoning:
 - The customer is asking about the reason for a change in their latest bill amount.
 - The context revolves around billing and payment, which falls under the category of "Billing Inquiry."
```

------
#### [ 3-shot prompt ]

사용자:

```
Please classify the following customer support tickets into one of the categories: "Technical Issue," "Billing Inquiry," or "General Inquiry." 
Use these examples to guide your classification:

Ticket: "I can't log in to my account. The system keeps giving me an error message."
Category: Technical Issue

Ticket: "I received an email saying my account will be suspended unless I make a payment. Is this a scam?"
Category: Billing Inquiry

Ticket: "What are the hours of operation for your customer support team?"
Category: General Inquiry

Now, classify the following ticket:
Ticket: "Can you explain why my latest bill is higher than usual? I haven't changed my plan."
```

어시스턴트:

```
Category: Billing Inquiry

Explanation: The ticket is asking for an explanation regarding a change in the billing amount, which falls under the billing category as it pertains to questions about charges or payments.
```

------

## 예제 2: 턴 프롬프트로 예제 제공
<a name="example-collapsible2"></a>

이 예제에서는 예시가 예시당 한 차례씩 턴으로 제공되며, `User` 역할에는 입력이, `Assistant` 역할에는 해당 예제에 대한 예상 출력이 포함되어 있습니다.

------
#### [ 0-shot Prompt ]

시스템:

```
Your task is to Classify the following texts into the appropriate categories. The categories to classify are: 

Categories: 
- Food 
- Entertainment 
- Health 
- Wealth 
- Other
```

사용자:

```
I have 20$ in my pocket.
```

어시스턴트:

```
Category: Wealth

Explanation: The text mentions a specific amount of money, which falls under the category of wealth. The presence of a monetary value directly relates to financial status or economic aspect.
```

------
#### [ 3-shot Prompt (as turns) ]

시스템:

```
Your task is to Classify the following texts into the appropriate categories. The categories to classify are: 

Categories: 
- Food 
- Entertainment 
- Health 
- Wealth 
- Other
```

사용자:

```
I love to eat pizza.
```

어시스턴트:

```
Food
```

사용자:

```
I enjoy watching movies.
```

어시스턴트:

```
Entertainment
```

사용자:

```
I am going to the gym after this.
```

어시스턴트:

```
Health
```

사용자:

```
I have 20$ in my pocket.
```

어시스턴트:

```
Wealth
```

------

## 예제 3: 시스템 프롬프트에 예제 제공
<a name="example-collapsible3"></a>

이 예에서는 '예제' 섹션을 지정한 다음 시스템 프롬프트에 일련의 예제를 나열할 수 있습니다. 프롬프트에 예시를 제공하는 이 방법은 예시가 길고 복잡한 경우 특히 유용하며 모델이 예제 샷을 찾는 데 도움이 됩니다.

------
#### [ 0-shot Prompt ]

시스템:

```
You are an AI assistant helping to draft professional reports for enterprise stakeholders. Ensure the report is formatted in rich text, with headings, bullet points, and highlighted important tasks.
```

사용자:

```
Draft a detailed project update report for our stakeholders, summarizing the project milestones achieved, tasks completed, and future plans.
```

어시스턴트:

```
# Project Update Report

## Executive Summary
This report provides a comprehensive update on the project milestones achieved, tasks completed, and future plans. Our team has made significant progress, and we are on track to meet the project goals. The following sections outline the details of our accomplishments and upcoming activities.

---

## Project Milestones Achieved

### **1. Project Initiation**
- **Milestone Date:** July 15, 2023
- **Description:** Completed initial project planning and secured stakeholder approval.

### **2. System Design Completion**
- **Milestone Date:** September 30, 2023
- **Description:** Finished the detailed system design and received positive feedback from technical review meetings.

### **3. Prototype Development**
- **Milestone Date:** November 15, 2023
- **Description:** Developed and tested a working prototype of the system.

---

## Tasks Completed

### **1. Requirement Gathering**
- **Description:** Conducted comprehensive stakeholder interviews and collected detailed requirements.
- **Highlighted Important Tasks:**
  - **User Story Mapping:** Mapped out user stories to ensure all user needs are addressed.
  - **Requirement Documentation:** Created detailed requirement specifications.

### **2. System Architecture Design**
- **Description:** Designed the system architecture, focusing on scalability and maintainability.
- **Highlighted Important Tasks:**
  - **Technology Stack Selection:** Chose the appropriate technology stack based on project requirements.
  - **Architecture Diagrams:** Developed detailed architecture diagrams for easy understanding.

### **3. Prototype Development and Testing**
- **Description:** Developed and rigorously tested the prototype.
- **Highlighted Important Tasks:**
  - **Coding:** Implemented core functionalities of the prototype.
  - **Testing:** Conducted unit and integration testing to ensure prototype reliability.

---

## Future Plans

### **1. Full System Development**
- **Description:** Begin the full-scale development of the system based on the approved design and prototype.
- **Highlighted Important Tasks:**
  - **Module Development:** Develop each module as per the design specifications.
  - **Code Reviews:** Implement regular code reviews to maintain code quality.

### **2. User Acceptance Testing (UAT)**
- **Description:** Conduct UAT to ensure the system meets user requirements and is ready for deployment.
- **Highlighted Important Tasks:**
  - **Test Plan Development:** Create detailed UAT plans and test cases.
  - **UAT Execution:** Execute UAT and gather feedback for final adjustments.

### **3. Deployment and Training**
- **Description:** Deploy the system and provide necessary training to end-users.
- **Highlighted Important Tasks:**
  - **Deployment:** Roll out the system to the production environment.
  - **Training Sessions:** Organize training sessions for users to familiarize them with the new system.

---

## Conclusion
Our project has successfully achieved key milestones and completed significant tasks. With the current momentum, we are well-positioned to meet our future objectives. We remain committed to delivering a high-quality system that meets all stakeholder expectations.

---

**Prepared by:**
[Your Name]
[Your Position]
[Date]

**Contact Information:**
[Your Email]
[Your Phone Number]

---

This detailed update aims to keep stakeholders informed and reassured about the project's progress and future direction. For any queries or further information, please do not hesitate to contact me directly.
```

------
#### [ 2-shot Prompt ]

시스템:

```
You are an AI assistant helping to draft professional reports for enterprise stakeholders. Below are a few examples of well-formatted project update reports to guide your response. 

<Example 1>

<b>Project Update Report</b><br>
<i>Date:</i> January 15, 2023<br>
<hr>


<b>Project Milestones Achieved:</b><br>
- Successfully launched the new CRM system.<br>
- Integrated the marketing automation tool.<br>
- Completed the employee training sessions.

<b>Tasks Completed:</b><br>
- Developed the user manual.<br>
- Conducted system testing.<br>
- Prepared the training materials.

<b>Future Plans:</b><br>
- Roll out the CRM system to all departments.<br>
- Schedule follow-up training sessions.<br>
- Monitor system performance and make necessary adjustments.

<hr>
<b>Prepared by:</b><br>
[Your Name]<br>
[Your Position]<br>
[Your Contact Information]

<Example 2>

<b>Project Update Report</b><br>
<i>Date:</i> February 20, 2023<br>
<hr>

<b>Project Milestones Achieved:</b><br>
- Launched the new website.<br>
- Completed the SEO optimization.<br>
- Organized the stakeholder meeting.

<b>Tasks Completed:</b><br>
- Designed the website layout.<br>
- Wrote the content for the website.<br>
- Tested the website functionality

<b>Future Plans:</b><br>
- Implement the analytics tracking.<br>
- Launch the social media campaign.<br>
- Gather feedback from stakeholders.

<hr>
<b>Prepared by:</b><br>
[Your Name]<br>
[Your Position]<br>
[Your Contact Information]
```

사용자:

```
Draft a detailed project update report for our stakeholders, summarizing the project milestones achieved, tasks completed, and future plans.
```

어시스턴트:

```
<b>Project Update Report</b><br>
<i>Date:</i> October 5, 2023<br>
<hr>

<b>Project Milestones Achieved:</b><br>
- Successfully completed the implementation of the new enterprise resource planning (ERP) system.<br>
- Conducted and completed the first phase of the data migration process.<br>
- Successfully launched the new inventory management module.

<b>Tasks Completed:</b><br>
- Developed and finalized the comprehensive user training program, including detailed user manuals and video tutorials.<br>
- Conducted extensive system integration testing with all existing systems and ensured seamless interoperability.<br>
- Executed the initial data migration from the legacy system to the new ERP system, resulting in a 95% accuracy rate.

<b>Future Plans:</b><br>
- Roll out the new ERP system to all departments in the next two phases.<br>
- Schedule and conduct follow-up training sessions for all employees.<br>
- Implement the remaining modules of the ERP system, including financial management and human resources.<br>
- Establish a robust monitoring and support framework to ensure smooth system operation and address any issues promptly.

<hr>
<b>Prepared by:</b><br>
[Your Name]<br>
[Your Position]<br>
[Your Contact Information]

---

This detailed report provides a clear and concise overview of the project's progress, highlighting the milestones achieved, tasks completed, and future plans. It ensures stakeholders are well-informed and can make strategic decisions based on the current status of the project.
```

------

# 도구 직접 호출 시스템
<a name="prompting-tools-function"></a>

도구 직접 호출은 요청에 도구 구성 스키마를 전달하여 Amazon Nova 모델에 사용할 수 있습니다. 모델에 대한 프롬프트는 이 도구 구성으로 보강되므로 도구 직접 호출 시스템 최적화를 시작하는 데 매우 큰 영향을 미칠 수 있습니다.

다음 주요 원칙을 고려하세요.
+ 도구 정의는 명확하고 간결해야 합니다. 이해하기 쉽고 의도가 매우 명확해야 합니다.
+ 주요 차별화 요소와 경계 조건을 사용하여 어떤 도구를 다른 도구보다 먼저 사용해야 하는지 정의합니다.
+ 입력 인수 유형을 신중하게 선택합니다. 이것이 말이 되는지, 그리고 일반적으로 이런 방식으로 사용될 것으로 기대되는지 물어보세요.

**‘도구 선택’을 사용하여 도구 직접 호출 시기 제어**

도구 선택 파라미터를 사용하면 모델에서 도구 직접 호출의 동작을 사용자 지정할 수 있습니다. 어떤 도구가 언제 직접적으로 호출되는지 세밀하게 제어하려면 이 기능을 활용하는 것이 좋습니다.

예를 들어 구조화된 출력과 같은 사용 사례의 경우 Amazon Nova가 간접적으로 호출될 때마다 특정 도구를 직접적으로 호출할 수 있습니다. 출력의 스키마를 도구로 정의한 다음 도구 선택을 해당 도구의 이름으로 설정할 수 있습니다.

```
{
   "toolChoice": {
        "tool": {
            "name": "name_of_tool"
        }
    }
}
```

많은 에이전트 사용 사례의 경우 모델이 항상 사용 가능한 도구 중 하나를 선택하도록 해야 할 수 있습니다. 이렇게 하려면 도구 선택을 `any`로 설정하면 모델이 간접적으로 호출될 때마다 정확히 하나의 도구가 직접적으로 호출됩니다.

```
{
   "toolChoice": {
        "any": {}
    }
}
```

마지막으로, 도구 직접 호출 여부가 대화의 맥락에 따라 크게 좌우되는 사용 사례의 경우 도구 선택을 `auto`로 설정할 수 있습니다. 이는 기본 동작이며 도구 선택을 전적으로 모델에 맡깁니다.

```
{
   "toolChoice": {
        "auto": {}
    }
}
```

# 고급 프롬프트 기법
<a name="advanced-prompting-techniques"></a>

이 섹션에서는 프롬프트의 품질을 개선하고 확장된 사고와 같은 주요 기능을 활용하는 방법에 대한 고급 지침을 제공합니다.

## 추론 모드 사용
<a name="use-reasoning-mode"></a>

Amazon Nova 2 모델은 응답하기 전에 문제를 체계적으로 해결할 수 있도록 지원함으로써 복잡한 문제 해결에 대한 모델의 접근 방식을 개선하는 선택적 추론 모드를 제공합니다. 모델의 추론 모드 활용은 프롬프트의 정확도를 개선하는 강력한 방법입니다.

**사용 시점:** 추론 모드는 다음 사용 사례와 같이 복잡한 태스크에 대해 권장됩니다.
+ **여러 추론 단계:** 수학적 증명, 알고리즘 설계, 시스템 아키텍처
+ **교차 참조 정보:** 문서 분석, 옵션 비교, 장단점 평가
+ **오류가 발생하기 쉬운 계산:** 재무 모델링, 데이터 분석, 복잡한 디버깅
+ **제약 조건을 포함하는 계획:** 리소스 최적화, 종속성 관리, 위험 평가
+ **복잡한 분류:** 다중 레이블 분류, 계층적 분류, 미묘한 의사 결정 경계
+ **도구 직접 호출 시나리오:** 여러 단계의 API 워크플로, 데이터베이스 쿼리 최적화, 조정된 시스템 통합

**참고**  
추론 모드에 대한 자세한 내용은 [추론 사용](using-converse-api.md#converse-api-reasoning) 섹션을 참조하세요.

## 하향식 접근 방식 채택
<a name="top-down-approach"></a>

모델이 문제를 해결하기 위해 여러 접근 방식을 평가해야 하는 상황에서 **하향식** 접근 방식을 채택하도록 지시합니다.
+ Amazon Nova 2 모델은 모델이 전체적 상황 파악부터 시작한 다음 이를 더 작고 세부적인 하위 문제 또는 단계로 나눌 때 더 나은 성능을 발휘합니다.
+ 모델이 먼저 주요 목표를 식별한 다음 이를 관리 가능한 구성 요소로 분해한 후 각 부분의 세부 정보를 살피도록 명시적으로 지시합니다.
+ 이 구조화된 접근 방식은 모델이 사고를 구성하고 보다 일관된 추론 체인을 생성하는 데 도움이 됩니다.

**예시:**

```
{{User query}}. Start with the big picture and break it down into progressively smaller, more detailed subproblems or steps.
```

## 연쇄적 사고 조정
<a name="steer-chain-of-thought"></a>

추론 모드는 체계적인 문제 해결을 통해 향상된 정확도를 제공하지만, 비추론 모드에서의 연쇄적 사고(CoT) 프롬프트가 요구 사항을 더 잘 충족할 수 있는 특정 시나리오가 있습니다.

**이 기능을 사용해야 하는 경우:**
+ **투명성 및 감사 가능성:** 모델의 추론 프로세스를 참조, 확인 또는 감사하려는 경우 CoT는 각 단계에 대한 전체 가시성을 제공합니다. 이는 규제 대상 산업, 고위험 의사 결정 또는 답변 뒤에서 로직을 문서화하려는 경우에 매우 중요합니다.
+ **사용자 지정 추론 구조:** CoT를 사용하여 특정 추론 패턴 또는 방법론을 적용합니다. 조직의 의사 결정 프레임워크를 따르거나 도메인별 문제 해결 접근 방식을 사용하거나 요소를 특정 순서로 고려하도록 모델을 안내할 수 있습니다.
+ **프롬프트 개발 및 디버깅:** 프롬프트 엔지니어링 단계에서 CoT는 모델이 문제에 접근하는 방식을 이해하고 추론이 중단되는 위치를 식별하며 프롬프트를 더 효과적으로 반복하는 데 도움이 됩니다.
+ **하이브리드 접근 방식:** 개발 중에 CoT를 사용하여 프롬프트를 완성한 다음, 특정 사용 사례에 대한 모델의 접근 방식에 자신이 있으면 프로덕션 배포를 위한 추론 모드로 전환하는 방법을 고려합니다.

**참고**  
모든 태스크에 CoT가 필요한 것은 아닙니다. 더 간단한 태스크의 경우 모델에서 자체 추론 프로세스를 사용하도록 허용합니다.

**모델의 CoT 방향 안내**

```
{{User query}} Please follow these steps:

1. {{Step 1}}
2. {{Step 2}}
...
```

## 긴 컨텍스트 기간 활용
<a name="utilizing-long-context"></a>

Amazon Nova 2 모델에서 지원되는 컨텍스트 길이는 1백만 개의 토큰이며 긴 문서에서 코드 이해 및 질문 답변에 뛰어납니다. 컨텍스트 크기가 증가함에 따라 성능(시스템 프롬프트 준수 및 도구 사용 포함)이 약간 저하될 수 있습니다.

**이 기능을 사용하는 방법:**
+ **긴 형식 데이터를 시작 부분에 배치**: 긴 문서와 입력을 프롬프트 시작 부분에 배치합니다. 쿼리, 지침 및 예제 앞에 배치합니다.
+ **끝에 지침 배치**: 프롬프트 끝에 지침을 배치합니다. 모델은 컨텍스트가 먼저 제공되고 지침이 끝에 제공될 때 가장 성능이 좋습니다.
+ **문서 콘텐츠 시작 및 종료 마커 구조화**: `DOCUMENT {idx} START` 및 `DOCUMENT {idx} END`와 같은 시작 및 종료 마커를 사용하여 긴 문서의 시작과 끝을 나타냅니다. 여기서 \$1idx\$1는 특정 문서의 인덱스를 나타냅니다.

**템플릿 예제:**

```
// Provide your long inputs at the top of your prompt
BEGIN INPUT DOCUMENTS

DOCUMENT 1 START
{{Your document}}
DOCUMENT 1 END

END INPUT DOCUMENTS

// Then specify your query and instructions
BEGIN QUESTION
{{User query}}
END QUESTION

BEGIN INSTRUCTIONS
{{Instructions}}
END INSTRUCTIONS
```

## 지원 텍스트의 그라운딩 답변
<a name="ground-answers-supporting-text"></a>

모델에 입력 쿼리와 관련된 신뢰할 수 있는 정보를 제공하는 것이 좋습니다. 이 정보는 종종 입력 쿼리와 함께 검색 증강 생성(RAG)이라는 시스템에 포함됩니다.
+ 이 과정에서 일부 관련성 있고 맥락에 맞는 문서 또는 정보가 실제 사용자 프롬프트에 보강되어 모델이 신뢰할 수 있는 콘텐츠를 확보하여 관련성 있고 정확한 응답을 생성합니다.
+ Amazon Nova 2에 신뢰할 수 있는 출처의 참조 텍스트를 사용하여 답변하도록 지시하면 제공된 자료를 기반으로 답변을 작성하도록 안내하고 정확하고 관련성 있는 정보를 기반으로 답변을 작성하여 생성된 콘텐츠의 신뢰성과 신뢰도를 높일 수 있습니다.
+ 참조 텍스트를 사용하면 할루시네이션을 피할 수 있어 응답의 전반적인 품질과 신뢰성이 향상됩니다. 할루시네이션을 최소화하려면 모델 지침에 `DO NOT USE INFORMATION THAT IS NOT IN REFERENCE TEXTS!`를 명시적으로 언급하는 것이 좋습니다.

프롬프트 템플릿

```
System:
In this session, the model has access to search results and a user's question, your job is to answer the user's question using only information from the search results. 

Model Instructions:
- DO NOT USE INFORMATION THAT IS NOT IN SEARCH RESULTS!

User: {Query} 
Resource: Search Results: {Reference texts}
```

### 예제: 그라운딩 컨텍스트를 제공하면 모델이 할루시네이션을 방지하는 데 도움이 됩니다.
<a name="grounding-example"></a>

이 예제에서는 그라운딩 컨텍스트를 통해 모델에서 할루시네이션을 방지하는 방법을 보여줍니다.

시스템:

```
In this session, the model has access to search results and a user's question, your job is to answer the user's question using only information from the search results. Model Instructions:- DO NOT USE INFORMATION THAT IS NOT IN SEARCH RESULTS!
```

사용자:

```
What were the economic impacts of the COVID-19 pandemic on the United States in 2020?

Resource: Search Results: In 2020, the United States experienced significant economic impacts due to the COVID-19 pandemic. The U.S. economy contracted by 3.5% in 2020, according to the Bureau of Economic Analysis. Unemployment rates surged to 14.7% in April 2020, the highest since the Great Depression, before gradually declining. Small businesses faced severe challenges, with millions of firms closing permanently. Additionally, consumer spending dropped sharply as people reduced non-essential expenditures and saved more. Government intervention played a critical role in mitigating these impacts through stimulus packages and support programs, such as the Paycheck Protection Program (PPP) for small businesses and direct payments to individuals. Despite these measures, the economic recovery remained uneven across different sectors and regions.
```

### 인용 마커를 사용하는 그라운딩
<a name="grounding-citations"></a>

긴 문서 태스크의 경우 Amazon Nova 2 모델이 태스크를 진행하기 전에 문서의 관련 섹션의 인용을 사용하여 응답을 근거하도록 지시하는 것이 좋습니다.

이 접근 방식은 모델이 가장 관련성이 높은 정보에 집중하고 불필요한 콘텐츠로 인해 산만해지는 것을 방지하는 데 도움이 됩니다. 모델에 응답을 그라운딩하도록 요청할 때 인용할 수 있는 섹션에 숫자가 지정되어야 합니다. 예: `Passage %[1]%`, `Passage %[2]%` 등.

#### 예제: 인용 마커 사용
<a name="citations-example"></a>

**Example 인용 마커 프롬프트**  

```
You are an AI financial assistant. Your task is to find patterns and insights from multi-year financial documents 

Passage %[1]%
{{Your document}}

Passage %[2]%
{{Your document}}

## Task:
Analyze my LLC's reports across multiple years to identify significant performance trends, segment growth patterns and strategic shifts.

## Context information:
- You have access to my LLC's annual financial reports (10-K) for multiple fiscal years in PDF format
- These reports contain comprehensive financial data including income statements, balance sheets, cash flow statements and management discussions
- The analysis should focus on year-over-year comparisons to identify meaningful trends
- I operate two business segments, one in Massachusetts and one in New York

Based on the provided Context, extract key financial metrics from each year's reports phrases from the documents.
Place citations as inline markers (e.g., %[1]%, %[2]%, etc.) directly within the relevant parts of the response 
text. Do not include a separate citation section after the response.
## Response Schema:
%% (Extracted Financial Metrics)
%% (Extracted Financial Metrics)
%% (Extracted Financial Metrics)
...
```

사용자의 태스크를 기반으로 주요 정보를 추출한 후, 추출된 재무 지표를 사용하여 다음과 같이 관련 질문에 답변할 수 있습니다.

**Example 추출된 지표를 사용한 후속 분석**  

```
## Task
Analyze my LLC's financial reports across multiple years to identify significant performance trends, segment growth patterns and strategic shifts.

{{extracted financial metrics}}

## Model Instructions:
- Organize data chronologically to identify meaningful trends
- DO compare segment performance across the five-year period
- DO identify significant strategic shifts or investments mentioned in management discussions
- DO NOT make speculative predictions beyond what is supported by the data
- ALWAYS note any changes in accounting practices or reporting methodologies that might affect year-over-year comparisons

## Response style and format requirements:
- Respond in markdown
- Structure the analysis with clear headings and subheadings
- Present key financial metrics in tabular format showing all five years side-by-side
- Include percentage changes year-over-year for all major metrics
- Create a section dedicated to visualizing the most significant trends (with descriptions of what would be shown in charts)
- Limit the executive summary to 250 words maximum
- Format segment analysis as separate sections with consistent metrics across all segments
- MUST include a Key Insights bullet-pointed list at the end of each major section
```

### Nova 웹 그라운딩 사용
<a name="prompting-web-grounding"></a>

Amazon Nova 2 모델은 지원 텍스트에 모델을 그라운딩하도록 인용을 직접 프롬트로 작성하는 대신, 사용 가능한 내부 웹 그라운딩 도구를 제공합니다. 이 기능이 활성화되면 Amazon Nova 2 모델은 웹 및 Amazon의 지식 그래프를 직접 쿼리하고 인용을 사용하여 최종 응답을 그라운딩합니다.

Amazon Nova Web Grounding을 활용하는 방법에 대해 자세히 알아보려면 [Amazon Nova Web Grounding 사용 설명서](https://docs.aws.amazon.com/nova/latest/nova2-userguide/web-grounding.html)를 참조하세요.

## 구조화된 출력 생성
<a name="prompting-structured-output"></a>

일관되고 구조화된 출력 형식을 보장하기 위해 XML, JSON, 마크다운과 같은 형식을 비롯해 구조화된 출력을 사용하거나 도구 사용 기능을 사용할 수 있습니다.
+ 이 접근 방식을 사용하면 다운스트림 시스템에서 모델에 의해 생성된 출력을 보다 효과적으로 이해하고 구문 분석할 수 있습니다.
+ 모델에 명시적 지침을 제공하면 미리 정의된 스키마를 준수하는 방식으로 응답이 생성됩니다.

예를 들어 다운스트림 구문 분석기가 JSON 객체의 키에 대한 특정 명명 규칙을 예상하는 경우 프롬프트 끝에서 응답 스키마를 지정해야 합니다. 또한, 머리말 텍스트 없이 JSON 형식으로 응답을 받는 것을 선호하는 경우 모델에 그에 맞는 지시를 내리세요. 즉, 깨끗한 출력을 위해 명시적으로 다음과 같이 진술합니다. **JSON 출력만 생성하세요. 프리앰블을 제공하지 마세요.**

**작은 정보**  
예제(예: YYYY/MM/DD 형식으로 날짜 지정)를 사용하는 대신, 스키마 자체에 정의된 경우 데이터 형식 요구 사항을 가장 잘 준수하는 것으로 나타났습니다.
최대 10개의 키가 있는 단순한 JSON 출력의 경우 아래에서 스키마를 찾을 수 있습니다. 보다 복잡한 스키마의 경우 도구를 통해 스키마를 정의하는 것이 좋습니다. 도구 사용 시 이러한 복잡한 스키마에 대한 모델의 준수 정도를 높이는 제한된 디코딩이라는 기술을 활용합니다.

### 일반적인 형식 지정 스키마
<a name="common-formatting-schemas"></a>

다음은 몇 가지 일반적인 형식 지정 스키마에 대한 예제입니다.

------
#### [ JSON ]

```
JSON_format = """Write your response following the JSON format below:

```json
{ 
"key1": "value1",
"key2": "value2",
key3: [{
"key3_1": "value_3_1 written in YYYY/MM/DD format",
"key3_2": "value_3_2 day of the week written in full form",
...}```
"""
```

------
#### [ XML ]

```
XML_format = """Write your response following the XML format below:

<output>
    <task>"task1"</task>
    <subtask>
    <task1_result> ( task 1 result )</task1_result>
    <task2_result> ( task 2 result )</task2_result>
    <task3_result> ( task 3 result )</task3_result>
    </subtask>
    <task>"task2"</task>
    <subtask>
    <task1_result> ( task 1 result )</task1_result>
    <task2_result> ( task 2 result )</task2_result>
    <task3_result> ( task 3 result )</task3_result>
    </subtask>
</output>

"""
```

------
#### [ Markdown ]

```
markdown_schema = """Write your response following the markdown format below:


## Introduction
( 2-3 line intro)

## Design Guidance 
(Bulleted list of design guidance)

## Step by Step Instructions on Execution
( Bulleted list of instructions with each with bold title.

## Conclusion
( conclusion )


"""
```

------

### 어시스턴트 콘텐츠 미리 채우기
<a name="prompting-prefill"></a>

비추론 모드에서 구조화된 출력을 생성하는 경우 어시스턴트 콘텐츠를 미리 채워 모델의 응답을 유도할 수 있습니다.

미리 채우는 방식은 비추론 모드인 동안 출력 형식의 일관성을 개선합니다. 이를 통해 사용하면 모델의 작업을 지시하고, 머리말을 우회하며, JSON 및 XML과 같은 특정 출력 형식을 적용할 수 있습니다. 예를 들어 어시스턴트 콘텐츠에 `{` 또는 ````json`을 미리 채우면 추가 정보를 제공하지 않고도 모델이 JSON 객체를 생성하도록 안내할 수 있습니다.

**작은 정보**  
명시적으로 JSON을 추출하려는 경우 일반적인 패턴은 ````json`으로 미리 채우고 `````에 중지 시퀀스를 추가하는 것입니다. 이렇게 하면 모델이 프로그래밍 방식으로 구문 분석할 수 있는 JSON 객체를 출력합니다.

**Example 어시스턴트 콘텐츠 미리 채우기**  
다음 코드는 API로 미리 채우는 방법을 보여줍니다.  

```
import boto3
import json

# Create a Bedrock Runtime client.
client = boto3.client(
    "bedrock-runtime",
    region_name="us-east-1"
)

request_body = {
    "system": [
        {"text": "You write JSON objects based on the given instructions"}
    ],
    "messages": [
        {
            "role": "user",
            "content": [{"text": "Provide details about the best selling full-frame cameras in past three years. Answer in JSON format with keys like name, brand, price and a summary."}]
        },
        {
            "role": "assistant",
            "content": [{"text": " Here is the JSON response: ```json"}]
        }
    ],
    "inferenceConfig": {
        "maxTokens": 1000,
    }
}

# Invoke the model and extract the response body.
response = client.invoke_model(
    modelId="amazon.nova-2-lite-v1:0",
    body=json.dumps(request_body)
)

model_response = json.loads(response["body"].read())
```

### 복잡한 스키마에 대해 사용할 도구 지정
<a name="prompting-tool-complex-schemas"></a>

또 다른 접근 방식은 도구 사용 스키마 섹션에 *Pydantic JSON 스키마*를 포함하여 모델 응답에 대한 특정 스키마를 강제로 적용하도록 도구를 사용하는 것입니다. 제공된 스키마에 도구 선택을 지정할 수 있으며 선택한 도구에 따라 Amazon Nova의 응답이 구성됩니다. 도구 활용 방법에 대해 자세히 알아보려면 [도구 사용](https://docs.aws.amazon.com/nova/latest/userguide/tool-use.html)을 참조하세요.

### 예제
<a name="structured-output-examples"></a>

#### 예제 1: 출력 스키마 추가
<a name="add-output-schema-example"></a>

적절한 스키마로 출력 스키마 섹션을 추가하면 모델이 해당 스키마에 맞게 설정됩니다. 그러나 모델 출력은 결정적이지 않으며 출력 스키마와 다를 수 있습니다.

------
#### [ Unspecific Prompt ]

사용자:

```
Provide details about the best selling full-frame cameras in past three years.
Answer in JSON format with keys like name, brand, price and a summary.
```

어시스턴트:

```
```json
 [
 {
 "name": "Sony Alpha A7R IV",
 "brand": "Sony",
 "price": "Approximately $3,500",
 "summary": "The Sony Alpha A7R IV is renowned for its exceptional image quality, thanks to a 61-megapixel full-frame sensor. It also features 4K video recording and a robust build, making it a favorite among professional photographers and videographers."
 },
 {
 "name": "Canon EOS R5",
 "brand": "Canon",
 "price": "Approximately $3,900",
 "summary": "The Canon EOS R5 combines high-resolution imaging with advanced video capabilities. It houses a 45-megapixel sensor, 8K video recording, and impressive autofocus performance, appealing to both photography and filmmaking professionals."
 },
 {
 "name": "Nikon Z7 II",
 "brand": "Nikon",
 "price": "Approximately $2,800",
 "summary": "The Nikon Z7 II offers a 45.7-megapixel full-frame sensor and is praised for its high resolution and excellent dynamic range. It also supports 4K video recording and features a versatile Z-mount lens system, making it a strong contender in the full-frame market."
 },
 {
 "name": "Fujifilm GFX 100S",
 "brand": "Fujifilm",
 "price": "Approximately $7,000",
 "summary": "While not a traditional full-frame camera, the Fujifilm GFX 100S stands out with its 102-megapixel medium format sensor. It is lauded for its stunning detail and color reproduction, though it comes at a higher price point and is aimed at specialized users."
 }
 ]
 ```
```

------
#### [ Specific Prompt ]

사용자:

```
Provide details about the best selling full-frame cameras in past three years.
You MUST answer in JSON format only. Write your response following the the format below:
[{
“name”: “name goes here”,
“brand”: “brand goes here”,
“price”: “price goes here“,
"summary": "summary goes here"
}]
```

어시스턴트:

```
[
 {
 "name": "Nikon D850",
 "brand": "Nikon",
 "price": "$3,296.95",
 "summary": "The Nikon D850 is a professional full-frame DSLR camera known for its exceptional image quality, 45.7-megapixel resolution, 7 fps continuous shooting, and 4K video capabilities."
 },
 {
 "name": "Canon EOS 5D Mark IV",
 "brand": "Canon",
 "price": "$3,499.00",
 "summary": "The Canon EOS 5D Mark IV is a popular full-frame DSLR appreciated for its 30.4-megapixel sensor, 4K video recording, robust build quality, and reliable autofocus system."
 },
 {
 "name": "Sony A7R III",
 "brand": "Sony",
 "price": "$3,198.00",
 "summary": "The Sony A7R III is a high-resolution full-frame mirrorless camera renowned for its 42.4-megapixel sensor, excellent low-light performance, and versatile lens compatibility."
 },
 {
 "name": "Fujifilm GFX 100S",
 "brand": "Fujifilm",
 "price": "$5,999.99",
 "summary": "The Fujifilm GFX 100S is a medium format mirrorless camera that stands out for its 102-megapixel sensor, high dynamic range, and exceptional color reproduction."
 },
 {
 "name": "Sony A7 III",
 "brand": "Sony",
 "price": "$1,998.00",
 "summary": "The Sony A7 III is a full-frame mirrorless camera popular among enthusiasts and professionals for its 24.2-megapixel sensor, fast autofocus, and 4K video capabilities."
 }
 ]
```

------

#### 예제 2: 모델 응답 미리 채우기
<a name="prefill-model-response-example"></a>

또 다른 접근 방식은 어시스턴트의 메시지에 원하는 초기 텍스트를 포함하여 모델의 응답을 미리 채우는 것입니다. 이 경우 Amazon Nova 모델의 응답은 어시스턴트의 메시지가 중단된 지점부터 계속됩니다.

**팁:** 미리 채우기는 추론이 활성화되지 않은 경우에만 유효합니다.

사용자:

```
Provide details about the best selling full-frame cameras in past three years.
Your response should be in JSON format, with the following keys: name, brand, year, price, summary.
```

어시스턴트(미리 채우기):

```
```json
```

어시스턴트:

```
{
 "cameras": [
 {
 "name": "Sony Alpha A7 III",
 "brand": "Sony",
 "year": 2018,
 "price": "$1999",
 "summary": "The Sony Alpha A7 III is a highly acclaimed full-frame mirrorless camera known for its excellent image quality, advanced autofocus system, and 4K video capabilities."
 },
 {
 "name": "Canon EOS R5",
 "brand": "Canon",
 "year": 2020,
 "price": "$3899",
 "summary": "The Canon EOS R5 is a top-tier full-frame mirrorless camera that offers stunning 45MP images, 8K video recording, and exceptional performance in various lighting conditions."
 },
 {
 "name": "Nikon Z7 II",
 "brand": "Nikon",
 "year": 2020,
 "price": "$2999",
 "summary": "The Nikon Z7 II is a flagship full-frame mirrorless camera with a 45.7MP sensor, superb image quality, and advanced video recording features."
 },
 {
 "name": "Fujifilm GFX 100S",
 "brand": "Fujifilm",
 "year": 2020,
 "price": "$7999",
 "summary": "The Fujifilm GFX 100S is a medium format mirrorless camera known for its impressive 102MP sensor, beautiful film simulations, and versatile lens options."
 },
 {
 "name": "Sony Alpha A7R IV",
 "brand": "Sony",
 "year": 2019,
 "price": "$3499",
 "summary": "The Sony Alpha A7R IV features a 61MP sensor, excellent low-light performance, and advanced video capabilities, making it a favorite among professional photographers."
 }
 ]
 }
 ```
```

#### 예제 3: 사용할 도구 지정
<a name="specify-tool-use-example"></a>

구조화된 출력에 대해 미리 채우기 기술을 사용하는 대신 Nova의 도구 기능을 toolChoice와 결합할 수 있습니다. 이 예제에서 모델은 제공된 JSON 스키마를 준수하고 정의된 전체 JSON 형식으로 지정된 특정 도구를 직접 호출하는 도구 직접 호출을 생성합니다. 추가 지침은 고급 시스템을 참조하세요.

사용자:

```
From the below provided Query, extract the relevent entities

Query:
John works in BUILDING-0987 and have been incharge of product id 23564#. His performance have been excellent in past year and is up for a raise.

Use the extract_ner tool.
```

ToolConfig:

```
{
        "tools": [
            {
            "toolSpec": {
                "name": "extract_ner",
                "description": "Extract all the named entities. based on provided input",
                "inputSchema": {
                    "json": {
                        "type": "object",
                        "properties": {
                            "entities": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                "name": {
                                    "type": "string",
                                    "description": "The extracted entity name. This should be a name of a person, place, animal or thing"
                                },
                                "location": {
                                    "type": "string",
                                    "description": "The extracted location name. This is a site name or a building name like SITE-001 or BUILDING-003"
                                },
                                "product": {
                                    "type": "string",
                                    "description": "The extrcted product code, this is generally a 6 digit alphanumeric code such as 45623#, 234567"
                                }
                                },
                                "required": [
                                "name",
                                "location",
                                "product"
                                ]
                            }
                            }
                        },
                        "required": [
                            "entities"
                        ]
                    }
                    
                }
            }
        }],
        "toolChoice": {
            "tool": {
                "name": "extract_ner"
            }
        }
    }
```

## 다국어 사용 사례
<a name="prompting-multilingual"></a>

Amazon Nova 2 모델은 200개가 넘는 언어에서 훈련되었으며 15개 언어에 대해 최적화되었습니다.

**Topics**
+ [정확한 번역을 위한 프롬프트](#accurate-translations)
+ [일관된 쓰기 규칙 적용](#consistent-writing-conventions)

### 정확한 번역을 위한 프롬프트
<a name="accurate-translations"></a>

짧은 양식 번역(몇 개의 문장)에 이 기능을 활용하려면 텍스트를 지정된 대상 언어로 번역하도록 모델에 지시할 수 있습니다.

**Example 번역 프롬프트**  

```
Translate the following text into {target language}. Please output only the translated text with no prefix or introduction: {text}
```

```
Translate the following sentence from {source_language} to {target language}: {text}
```

```
{text} How do you say this sentence in {target_language}
```

### 일관된 쓰기 규칙 적용
<a name="consistent-writing-conventions"></a>

문자 기반 언어에서 Amazon Nova 2 모델은 소스 언어의 문자 세트를 활용할 수 있습니다. 다음 프롬프트를 사용하여 일관된 출력을 적용할 수 있습니다.

**Example 쓰기 규칙 적용**  

```
When translating, ensure to use the correct orthography / script / writing convention of the target language, not the source language's characters
```

## 도구 직접 호출
<a name="tool-calling-advanced-techniques"></a>

### 에이전트 시스템
<a name="agentic-systems"></a>

**Topics**
+ [올바른 추론 파라미터 설정](#set-inference-parameters)
+ [지연 시간 요구 사항 고려](#consider-latency-requirements)
+ [도구 직접 호출 지침에 대해 의도적인 문구 사용](#intentional-wording-tool-calling)
+ ['사고' 명령 활용](#leverage-thinking-commands)
+ [도구 직접 호출 순서 지정](#tool-call-ordering)
+ [품질 도구 스키마 생성](#designing-tool-schema)
+ [하위 에이전트 생성](#create-sub-agents)
+ [멀티모달 입력에 대해 도구 사용](#use-tools-multimodal-inputs)
+ [다음 단계](#next-steps-best-practices)

#### 올바른 추론 파라미터 설정
<a name="set-inference-parameters"></a>

도구를 직접 호출하려면 모델의 매우 구체적인 구조화된 출력이 필요하며, 다음과 같은 추론 파라미터를 사용하여 개선됩니다.
+ **비추론 모드:** 온도: 0.7 및 상위 P: 0.9
+ **추론 모드:** 온도: 1 및 상위 P: 0.9

#### 지연 시간 요구 사항 고려
<a name="consider-latency-requirements"></a>

**작은 정보**  
Amazon Nova 2 모델은 추론을 켜거나 끈 상태에서 도구를 직접 호출할 수 있습니다. 그러나 추론 모드는 지연 시간에 상당한 영향을 미칩니다.

지연 시간에 민감한 애플리케이션의 경우 추론 꺼짐 모드에 맞게 최적화하고 가능한 경우 필요한 도구 직접 호출을 단순화해야 합니다. 여러 단계의 워크플로를 개별 단계로 분할하여 불필요한 파라미터의 재귀에 대한 모델의 의존도를 줄입니다.

#### 도구 직접 호출 지침에 대해 의도적인 문구 사용
<a name="intentional-wording-tool-calling"></a>

**도구 이름:** 시스템 프롬프트에서 도구를 참조하는 것은 도구를 직접 호출할 때 모델을 지시하는 도구 직접 호출 시스템에서 일반적입니다. 프롬프트에서 도구를 참조할 때는 xml 또는 pythonic 참조나 예제 대신 도구 이름을 사용하는 것이 좋습니다.

##### 좋은 도구 참조에 대한 예제
<a name="Example-of-a-good-tool-reference"></a>

```
Use the 'run_shell_command' tool for running shell commands
```

##### 잘못된 도구 참조에 대한 예제
<a name="Example-of-a-bad-tool-reference"></a>

```
Call run_shell_command() to run shell commands
```

#### '사고' 명령 활용
<a name="leverage-thinking-commands"></a>

사고가 도구 직접 호출에 도움이 되는 모든 사용 사례의 경우 모델에 '태그 내 사고'를 유도하거나 '사고' 도구를 사용하라는 프롬프트를 작성하는 대신 추론 모드를 활용하는 것이 좋습니다.

 Amazon Nova 2 모델은 추론 모드를 위해 광범위하게 훈련되었으며 연쇄적 사고를 위해 추론 모드에서 사용할 때 최적의 결과를 생성합니다.

#### 도구 직접 호출 순서 지정
<a name="tool-call-ordering"></a>

기본 제공 도구와 네이티브 도구 직접 호출을 동시에 사용해야 할 수 있는 사용 사례에서는 모델이 기본 제공 도구를 먼저 직접 호출하는 쪽을 택합니다.

프롬프트에서 다르게 작동하도록 모델에 지시하지 마세요. 대신 이를 고려하도록 워크플로를 설계합니다.

예를 들어 모델이 기본 제공 도구를 사용하지 않도록 하려면 모델이 해당 도구에 편향되지 않도록 워크플로에 포함하지 않습니다.

#### 품질 도구 스키마 생성
<a name="designing-tool-schema"></a>

도구 스키마는 엔지니어에게 효과적인 도구 직접 호출 시스템을 프롬프트할 수 있는 주요 위치 중 하나입니다. 그러나 도구 스키마 자체에서 캡처되는 내용, 각 스키마 요소의 시맨틱을 설명하는 방법, 시스템 프롬프트가 시스템 지침 내에서 도구 및 스키마 요소를 참조하는 방법을 고려하는 것이 중요합니다.

Amazon Nova 2 모델은 도구 스키마에서 간결한 설명에 최적화되어 있습니다. 짧게 유지하세요.

**도구 스키마 및 시스템 프롬프트 지침 비교:**

**도구 스키마에 다음을 포함합니다.**
+ 핵심 기능: 도구가 수행하는 작업(20\$150개 단어가 권장됨)
+ 파라미터 사양: 각 파라미터에 대한 명확한 설명(파라미터당 약 10개의 단어)
+ 예상 형식: 데이터 유형(예: 열거형, 정수, 부동 소수점), 필수 필드 및 유효한 값 범위

**시스템 프롬프트에 다음을 포함합니다.**
+ 오케스트레이션 로직(특정 도구를 사용하는 시점과 이유) 및 비즈니스 규칙(조건부 로직, 시퀀싱 요구 사항 및 종속성)이 포함된 `#Tool Usage` 섹션을 지정합니다.
+ **오류 처리 전략:** 실패 또는 예상치 못한 출력에 응답하는 방법에 대한 지침이 포함된 `#Error Handling and Troubleshooting` 섹션 추가
+ **출력 형식 지정:** 사용자에게 제시하는 방법에 대한 세부 정보 추가

##### 예제
<a name="sample-example"></a>

```
You are a software engineering issue root cause analysis agent. You are tasked with reviewing a customer issue and examining the repository to identify a plan to resolve the issue.
      # Core Mandates
- **DO NOT** update the original issue that was posted by the user. You only add *additional* comments to the reported issue if necessary

# Primary Workflows
1. **Understand:** Analyze the user's request and explore the codebase thoroughly using **get_file_contents** to grasp file structures and conventions.
2. **Plan:** Create a coherent, evidence-based plan for resolving the task and share it with the user following the format below

# Tool Usage 
- **Read the Issue:** Always start by using the **read_issue** tool to get the details about the requested issue
- **File Paths:** Always end the file path with "/" if you are searching a directory using the **get_file_contents** tools
- **Parallelism:** Execute multiple independent tool calls in parallel when feasible

# Error Handling and Troubleshooting
- **File Exploration:** If you get an error that a file doesn't exist, try searching at the directory level first to validate the file path

# Output Formatting
Return your plan in markdown in the following format

## Issue
<Your root cause analysis of the issue>

## Resolution Plan
<your step by step plan of how to solve the issue>
```

#### 하위 에이전트 생성
<a name="create-sub-agents"></a>

다음과 같은 상황이 발생하면 많은 도구가 있는 단일 에이전트 대신 특수 하위 에이전트를 생성하는 방법을 고려합니다.
+ **20개를 초과하는 도구 수:** 큰 도구 세트는 관리하기 어렵고 선택 오류가 증가하는 경우
+ **고유한 기능 도메인:** 도구가 자연스럽게 별도의 카테고리(예: 데이터 검색, 처리, 보고)로 클러스터링되는 경우
+ **복잡한 스키마:** 파라미터 깊이가 3\$14 수준을 초과하거나 도구에 복잡한 상호 종속성이 있는 경우
+ **대화 길이:** 워크플로가 정기적으로 15\$120회 턴을 초과하면 특수 하위 에이전트의 이점을 얻을 수 있는 경우
+ **성능 저하:** 도구 선택의 정확도 감소 또는 지연 시간 증가가 관찰되는 경우

**작은 정보**  
MCP 서버는 사용자가 제어할 수 없는 도구 및 스키마와 함께 제공됩니다. 워크플로에서 필요한 태스크를 완료하는 데 필요한 도구만 포함합니다.

#### 멀티모달 입력에 대해 도구 사용
<a name="use-tools-multimodal-inputs"></a>

멀티모달 태스크의 경우 구조화된 태스크(예: 추출 또는 타임스탬프 생성)를 위한 도구를 활용하는 정확도가 향상되지 않았습니다.

대신 제공된 템플릿을 사용하여 모델을 성공적으로 프롬프트하는 방법을 알아보려면 멀티모달 입력 프롬프트 섹션에서 관련 섹션을 검토하는 것이 좋습니다.

#### 다음 단계
<a name="next-steps-best-practices"></a>
+ 멀티모달 프롬프트는 [멀티모달 입력 프롬프트](prompting-multimodal.md) 섹션을 참조하세요.