여러 안내나 단계가 필요한 복잡한 태스크의 경우 프롬프트를 하위 태스크로 나누면 모델 응답이 개선될 수 있습니다. 프롬프트를 작게 하면 제어 가능성, 디버깅, 정확성을 향상시키는 데 도움이 됩니다.
복잡한 프롬프트를 분해하여 모델로 수집하는 방법에는 두 가지가 있습니다.
프롬프트 연결: 태스크를 하위 태스크로 분할하고 하위 태스크를 순차적으로 실행합니다.
응답 합산: 태스크를 하위 태스크로 분할하고 하위 태스크를 동시에 실행합니다.
프롬프트 연결
여러 순차적 단계가 포함된 복잡한 태스크의 경우 각 단계를 프롬프트로 만들고 프롬프트를 순서대로 연결합니다. 이 순차적인 프롬프트 체인에서 시퀀스의 한 프롬프트 출력이 다음 프롬프트의 입력이 됩니다. 시퀀스에서 마지막 프롬프트 출력이 최종 출력입니다.
예
예를 들어 통신 비즈니스를 운영하고 있으며 모델을 사용하여 고객 의견을 분석해 일반적인 고객 문제를 파악하고 문제를 카테고리로 분류하고 문제 카테고리에 대한 해결책을 생성하려고 한다고 가정해 보겠습니다.
태스크 1: 고객 문제 파악
모델이 완료해야 하는 첫 번째 태스크는 원시 고객 의견에서 의미 있는 데이터를 추출하는 것입니다. 이 태스크를 수행하는 프롬프트는 다음과 유사할 수 있습니다. 여기서 CUSTOMER_FEEDBACK은 고객 의견이 포함된 파일입니다.
데이터 추출
Extract the main issues and sentiments from the customer feedback on our telecom services.
Focus on comments related to service disruptions, billing issues, and customer support interactions.
Please format the output into a list with each issue/sentiment in a sentence, separated by semicolon.
Input: CUSTOMER_FEEDBACK
모델 응답에 고객 의견에서 추출된 문제 및 감정의 목록이 포함되어야 합니다.
태스크 2: 문제를 카테고리로 분류
다음으로, 이전 태스크의 응답을 사용하여 고객이 겪는 문제 유형을 파악할 수 있도록 모델이 데이터를 카테고리로 분류하도록 프롬프트하려고 합니다. 이 태스크를 수행하는 프롬프트는 다음과 유사할 수 있습니다. 여기서 TASK_1_RESPONSE는 이전 태스크의 응답입니다.
데이터 분류
Classify the extracted issues into categories such as service reliability, pricing concerns, customer support quality, and others.
Please organize the output into JSON format with each issue as the key, and category as the value.
Input: TASK_1_RESPONSE
모델 응답에 분류된 문제가 포함되어야 합니다.
태스크 3: 솔루션 생성
이제 이전 태스크의 응답을 사용하여 고객 만족도가 향상되도록 모델이 분류된 문제를 기반으로 실행 가능한 추천을 생성하도록 프롬프트합니다. 이 태스크를 수행하는 프롬프트는 다음과 유사할 수 있습니다. 여기서 TASK_2_RESPONSE는 이전 태스크의 응답입니다.
추천 생성
Generate detailed recommendations for each category of issues identified from the feedback.
Suggest specific actions to address service reliability, improving customer support, and adjusting pricing models, if necessary.
Please organize the output into a JSON format with each category as the key, and recommendation as the value.
Input: TASK_2_RESPONSE
모델 응답에는 고객 경험과 서비스 품질이 향상되고 전반적인 목표가 달성되도록 각 카테고리의 추천이 포함되어야 합니다.
응답 집계
복잡한 태스크가 있지만 특정 순서로 태스크를 수행할 필요가 없으면 프롬프트를 동시에 실행하고 모델 응답을 합산할 수 있습니다.
예
예를 들어 음반 매장을 운영하고 있으며 음악 스트리밍 동향과 매장의 판매 데이터를 기반으로 재고를 보충할 음반을 결정하는 데 도움이 되는 모델을 사용하려고 한다고 가정해 보겠습니다.
태스크 1: 데이터 분석
먼저 스트리밍 데이터와 판매 데이터라는 두 데이터 세트를 분석해야 합니다. 프롬프트를 실행하여 이러한 태스크를 동시에 완료할 수 있습니다. 이러한 태스크를 수행하는 프롬프트는 다음과 유사할 수 있습니다. 여기서 STORE_SALES_DATA는 판매 데이터가 포함된 파일이고 STREAMING_DATA는 스트리밍 데이터가 포함된 파일입니다.
태스크 1a: 판매 데이터 분석
Analyze the sales data to identify the number of sales of each record.
Please organize the output into a JSON format with each record as the key, and sales as the value.
Input: STORE_SALES_DATA
출력에는 JSON 형식의 각 음반 판매 수가 포함되어야 합니다.
태스크 1b: 스트리밍 데이터 분석
Analyze the streaming data to provide a the number of streams for each album.
Please organize the output into a JSON format with each album as the key, and streams as the value.
Input: STREAMING_DATA
출력에는 JSON 형식의 각 앨범 스트리밍 수가 포함되어야 합니다.
태스크 2: 합산 데이터
이제 두 데이터 세트에서 데이터를 합산하여 구매 결정을 계획할 수 있습니다. 데이터를 합산하려면 두 태스크의 출력을 입력으로 포함합니다. 이 태스크를 수행하는 프롬프트는 다음과 같이 유사할 수 있습니다. 여기서 TASK_1A_RESPONSE 및 TASK_1B_RESPONSE는 이전 태스크의 응답입니다.
판매 및 스트리밍 데이터 합산
Recommend a stocklist of about 20 records based on the most sold and most streamed records.
Roughly three quarters of the stock list should be based on record sales, and the rest on streaming.
Input: TASK_1A_RESPONSE and TASK_1B_RESPONSE
출력에는 음반 판매 및 스트리밍을 기반으로 한 음반 약 20개에 대한 추천 재고 목록이 포함되어야 하며 스트리밍 인기도가 높은 음반보다 입증된 판매 이력이 있는 음반이 더 많이 포함되어야 합니다.
[[["이해하기 쉬움","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,["For complex tasks that require multiple instructions or steps, you can improve the model's\nresponses by breaking your prompts into subtasks. Smaller prompts can help you improve\ncontrollability, debugging, and accuracy.\n\nThere are two ways to break down complex prompts and ingest them into a model:\n\n- **Chain prompts:** split a task into subtasks and run the subtaks sequentially.\n- **Aggregate responses:** split a task into subtasks and run the subtasks in parallel.\n\nChain prompts\n\nFor complex tasks that involve multiple *sequential* steps, make each step a prompt and\nchain the prompts together in a sequence. In this sequential chain of prompts, the output of one\nprompt in the sequence becomes the input of the next prompt. The output of the last prompt in the\nsequence is the final output.\n\nExample\n\nFor example, suppose you run a telecommunications business and want to use a model to help you\nanalyze customer feedback to identify common customer issues, classify issues into categories, and\ngenerate solutions for categories of issues.\n\nTask 1: identify customer issues\n\nThe first task you want the model to complete is extracting meaningful data from raw customer\nfeedback. A prompt that achieves this task might be similar to the following, where\n\u003cvar translate=\"no\"\u003eCUSTOMER_FEEDBACK\u003c/var\u003e is a file that contains the customer feedback:\n\n| Extract data |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Prompt:** ``` Extract the main issues and sentiments from the customer feedback on our telecom services. Focus on comments related to service disruptions, billing issues, and customer support interactions. Please format the output into a list with each issue/sentiment in a sentence, separated by semicolon. Input: CUSTOMER_FEEDBACK ``` |\n\nWe would expect the model's response to contain a list of extracted issues and sentiment from the\ncustomer feedback.\n\nTask 2: classify issues into categories\n\nNext, you want to prompt the model to classify the data into categories so that you can\nunderstand the types of issues customers face, using the response from the previous task. A prompt\nthat achieves this task might look similar to the following, where\n\u003cvar translate=\"no\"\u003eTASK_1_RESPONSE\u003c/var\u003e is the response from the previous task:\n\n| Classify data |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Prompt:** ``` Classify the extracted issues into categories such as service reliability, pricing concerns, customer support quality, and others. Please organize the output into JSON format with each issue as the key, and category as the value. Input: TASK_1_RESPONSE ``` |\n\nWe would expect the model's response to contain categorized issues.\n\nTask 3: generate solutions\n\nNow, you want to prompt the model to generate actionable recommendations based on the\ncategorized issues to improve customer satisfaction, using the response from the previous task. A\nprompt that achieves this might look similar to the following, where\n\u003cvar translate=\"no\"\u003eTASK_2_RESPONSE\u003c/var\u003e is the response from the previous task:\n\n| Generate suggestions |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Prompt:** ``` Generate detailed recommendations for each category of issues identified from the feedback. Suggest specific actions to address service reliability, improving customer support, and adjusting pricing models, if necessary. Please organize the output into a JSON format with each category as the key, and recommendation as the value. Input: TASK_2_RESPONSE ``` |\n\nWe would expect the model's response to contain recommendations for each category, aimed at\nimproving customer experience and service quality, which satifies our overall objective.\n\nAggregate responses\n\nIn cases where you have complex tasks but you don't need to perform the tasks in a specific\norder, you can run parallel prompts and aggregate the model's responses.\n\nExample\n\nFor example, suppose you own a record store and want to use a model to help you decide which\nrecords to stock based on music streaming trends and your store's sales data.\n\nTask 1: analyze data\n\nThe first thing you need to do is analyze the two datasets, streaming data and sales data. You\ncan run the prompts to complete these tasks in parallel. Prompts that achieve these tasks might be\nsimilar to the following, where \u003cvar translate=\"no\"\u003eSTORE_SALES_DATA\u003c/var\u003e is a file that contains\nthe sales data and \u003cvar translate=\"no\"\u003eSTREAMING_DATA\u003c/var\u003e is a file that contains the streaming\ndata:\n\n| Task 1a: analyze sales data |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Prompt:** ``` Analyze the sales data to identify the number of sales of each record. Please organize the output into a JSON format with each record as the key, and sales as the value. Input: STORE_SALES_DATA ``` |\n\nWe would expect the output to contain the number of sales for each record, formatted in JSON.\n\n| Task 1b: analyze streaming data |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Prompt:** ``` Analyze the streaming data to provide a the number of streams for each album. Please organize the output into a JSON format with each album as the key, and streams as the value. Input: STREAMING_DATA ``` |\n\nWe would expect the output to contain the number of streams for each album, formatted in JSON.\n\nTask 2: aggregate data\n\nNow you can aggregate the data from both datasets to help you plan your purchasing decisions. To\naggregate the data, include the output from both tasks as the input. A prompt that achieves this\nmight look similar to the following, where \u003cvar translate=\"no\"\u003eTASK_1A_RESPONSE\u003c/var\u003e and\n\u003cvar translate=\"no\"\u003eTASK_1B_RESPONSE\u003c/var\u003e are the responses from the previous tasks:\n\n| Aggregate sales and streaming data |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Prompt:** ``` Recommend a stocklist of about 20 records based on the most sold and most streamed records. Roughly three quarters of the stock list should be based on record sales, and the rest on streaming. Input: TASK_1A_RESPONSE and TASK_1B_RESPONSE ``` |\n\nWe would expect the output to contain a suggested stocklist of about 20 records, based on record\nsales and streams, with more favor given to records with proven sales history than to those with\nmore streaming popularity.\n\nWhat's next\n\n- Explore examples of prompts in the [Prompt gallery](/vertex-ai/generative-ai/docs/prompt-gallery)."]]