View a markdown version of this page

입력 데이터 세트 준비 - Amazon Bedrock

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

입력 데이터 세트 준비

참고

전체 작동 예제와 노트북은 Amazon Bedrock Samples GitHub에서 확인할 수 있습니다.

파일 형식

입력 파일은 JSONL 형식을 사용합니다. 한 줄에 하나의 JSON 객체가 있습니다. 각 줄은 최적화할 프롬프트 템플릿 하나와 관련 필드를 나타냅니다. 작업당 하나의 입력 파일을 제공합니다.

스키마 참조

이 프롬프트 데이터 세트에서는 최적화를 조정할 평가 방법도 선택합니다. 평가 방법 선택에 대한 자세한 내용은 섹션을 참조하세요평가 방법 정의.

{ "version": "bedrock-2026-05-14", "templateId": "string", "promptTemplate": "string", "steeringCriteria": ["string"], "customEvaluationMetricLabel": "string", "customLLMJConfig": { "customLLMJPrompt": "string", "customLLMJModelId": "string" }, "evaluationMetricLambdaArn": "string", "evaluationSamples": [ { "inputVariables": [ {"variableName1": "string"} ], "referenceResponse": "string", "inputVariablesMultimodal": [ { "Arbitrary_Name": { "type": "string", "s3Uri": "string" } } ] } ] }

필드 설명

#Field유형필수설명
1version문자열고정 값: "bedrock-2026-05-14".
2templateId문자열이 프롬프트 템플릿의 고유 식별자입니다. 입력과 출력을 상호 연관시키는 데 사용됩니다.
3promptTemplate문자열최적화할 프롬프트 템플릿입니다. 변수 자리 표시자에 {{variableName}} 구문을 사용합니다.
4steeringCriteria문자열 목록아니요상위 수준 최적화 기준(예: ["PROFESSIONAL"]).
5customEvaluationMetricLabel문자열예(customLLMJConfig 또는 evaluationMetricLambdaArn을 사용하는 경우)평가 지표의 이름입니다.
6customLLMJConfig객체아니요사용자 지정 LLM-as-Judge 구성.
7customLLMJConfig.customLLMJPrompt문자열예(사용자 customLLMJConfig가 있는 경우)응답을 평가하는 데 사용되는 판단 프롬프트입니다. {{prompt}}, {{response}}{{referenceResponse}} 자리 표시자로 사용합니다.
8customLLMJConfig.customLLMJModelId문자열예(사용자 customLLMJConfig가 있는 경우)판사 모델의 Bedrock 모델 ID입니다.
9evaluationMetricLambdaArn문자열No사용자 지정 평가를 위한 Lambda 함수의 ARN입니다.
10evaluationSamples목록입력 변수 및 참조 응답이 포함된 평가 샘플입니다.
11evaluationSamples[].inputVariables객체 목록예(를 사용하지 않는 경우inputVariablesMultimodal){{variableName}} 자리 표시자와 일치하는 단일 키 객체입니다. 샘플당 inputVariables 또는 중 하나 이상이 있어야 inputVariablesMultimodal 합니다.
12evaluationSamples[].referenceResponse문자열No선택 사항인 Ground-truth 참조 응답입니다. 최상의 최적화 결과를 위해 권장됩니다.
13evaluationSamples[].inputVariablesMultimodal객체 목록예(를 사용하지 않는 경우inputVariables)다중 모달 파일 입력. 샘플당 inputVariables 또는 중 하나 이상이 있어야 inputVariablesMultimodal 합니다.
14evaluationSamples[].inputVariablesMultimodal[].Arbitrary_Name객체예(멀티모달이 있는 경우)다중 모달 변수의 이름을 지정합니다. 사용자가 선택한 임의의 이름입니다.
15evaluationSamples[].inputVariablesMultimodal[].Arbitrary_Name.type문자열예(멀티모달이 있는 경우)"IMAGE" 또는 "PDF". IMAGE는 png 및 jpg를 허용합니다.
16evaluationSamples[].inputVariablesMultimodal[].Arbitrary_Name.s3Uri문자열예(멀티모달이 있는 경우)멀티모달 파일의 S3 URI 경로입니다.

필수 필드

  • version: 고정 값 "bedrock-2026-05-14"

  • templateId:이 프롬프트 템플릿의 고유한 문자열 식별자

  • promptTemplate: {{variableName}} 자리 표시자에를 사용하여 최적화할 프롬프트

  • evaluationSamples: 1~100개의 샘플 배열

자리 표시자 변수

프롬프트 템플릿의 자리 표시자에 {{variableName}} 구문(이중 중괄호)을 사용합니다. 의 키는 자리 표시자 이름과 정확히 일치해야 inputVariables 합니다. 각 키는 목록의 자체 객체에 있어야 합니다. 템플릿당 최대 20개의 텍스트 자리 표시자 변수. 다중 모달 파일의 S3 위치를 가리키는 데 자리 표시자 변수를 사용해서는 안 됩니다. 자리 표시자 변수는 텍스트 전용입니다. 멀티모달 파일이 있는 경우 텍스트 프롬프트와 함께 페이로드의 모델로 전송됩니다.

평가 샘플

를 단일 키 객체 목록inputVariables으로 제공합니다[{"variable1": "value1"}, {"variable2": "value2"}]. 하나의 객체에 여러 키를 넣지 마십시오. 최적화 결과를 개선하려면 선택적으로를 실제 답변referenceResponse으로 제공합니다. 멀티모달 입력의 경우 Arbitrary_Name 객체와 함께 inputVariablesMultimodal 배열을 사용합니다. 멀티모달 파일은 텍스트 프롬프트와 함께 페이로드의 모델로 전송됩니다. 지원되는 유형은 IMAGE(png, jpg) 및 PDF이며 샘플당 최대 2개의 멀티모달 파일이 있습니다. 멀티모달 입력(이미지 및 PDFs)은 프롬프트와 함께 페이로드에서 모델로 전송되지만 이중 중괄호 {{placeholder}} 변수에서 참조해서는 안 됩니다.

평가 전략

템플릿당 평가 방법 하나를 선택하거나 시스템 기본값에 대한 모든 선택적 평가 필드를 생략합니다(정확성, 답변 완전성 및 주관적 쓰기 스타일 평가 결합). 최상의 결과를 얻으려면 자체 평가 방법을 정의하는 것이 좋습니다. 동일한 작업의 템플릿 간에 서로 다른 방법을 사용할 수 있습니다. 세부 정보는 평가 방법 정의 섹션을 참조하세요.

한도

할당량의 전체 목록은 섹션을 참조하세요지원되는 리전, 모델 및 할당량. 입력 파일 준비를 위한 키 제한:

  • 작업당 최대 10개의 템플릿

  • 템플릿당 최대 100개의 평가 샘플

  • 작업당 최대 5개 모델

  • 템플릿당 최대 20개의 텍스트 변수

  • 샘플당 최대 2개의 멀티모달 파일

  • 템플릿당 최대 5개의 조향 기준

일반적인 실수

  • steeringCriteria AND customLLMJConfig/evaluationMetricLambdaArn = ValidationException 모두 제공

  • LLMJ 또는 evaluationMetricLambdaArn = ValidationException 사용 customEvaluationMetricLabel 시 누락

  • 하나의 inputVariables 객체에 있는 여러 키 = 자동 실패

  • 와 같은 이중 중괄호 {variable} 대신와 같은 단일 중괄호 사용 {{variable}}

  • inputVariables 키는의 {{variableName}} 자리 표시자와 일치해야 합니다. promptTemplate

  • 허용된 LLMJ 모델: anthropic.claude-opus-4-6-v1, anthropic.claude-sonnet-4-5-20250929-v1:0, anthropic.claude-sonnet-4-6

멀티모달 입력 사용

지원되는 파일 유형: IMAGE(png, jpg) 및 PDF.

포함 방법: inputVariablesMultimodal 배열을 type 및가 포함된 Arbitrary_Name 객체와 함께 사용합니다s3Uri.

제한: 평가 샘플당 최대 2개의 멀티모달 파일. 최대 20개의 텍스트 변수와 평가 샘플 레코드당 2개의 멀티모달 파일이 있도록 섞고 일치시킬 수 있습니다.

텍스트와 멀티모달 혼합: inputVariables (텍스트)와를 모두 동일한 샘플inputVariablesMultimodal에 포함할 수 있습니다. 이중 중괄호{{placeholders}}는 일반 텍스트 전용입니다. 자리 표시자를 통해 멀티모달 파일을 참조할 수 없습니다. 다중 모달 파일의 S3 위치를 가리키는 데 자리 표시자 변수를 사용해서는 안 됩니다. 멀티모달 파일이 있는 경우 텍스트 프롬프트와 함께 페이로드의 모델로 전송됩니다.

예제

예제 1: 단일 템플릿, 여러 변수, 단일 평가 샘플, 조향 기준

{ "version": "bedrock-2026-05-14", "templateId": "customer-support-v1", "promptTemplate": "You are a customer support agent.\n\nProduct info:\n{{productInfo}}\n\nQuestion:\n{{customerQuestion}}\n\nProvide a helpful response.", "steeringCriteria": ["PROFESSIONAL"], "evaluationSamples": [{ "inputVariables": [{"productInfo": "Product: Sony WH-1000XM5. Battery: 30 hours."}, {"customerQuestion": "How long does the battery last?"}], "referenceResponse": "The battery lasts up to 30 hours on a single charge." }] }

예제 2: 단일 템플릿, 여러 변수, 여러 평가 샘플, 조향 기준

{ "version": "bedrock-2026-05-14", "promptTemplate": "You are a customer support agent for an electronics store.\n\nGiven the following product information:\n{{productInfo}}\n\nAnswer the customer's question:\n{{customerQuestion}}\n\nProvide a helpful, accurate, and concise response.", "templateId": "template-support-1", "steeringCriteria": ["PROFESSIONAL", "CONCISE"], "evaluationSamples": [ {"inputVariables": [{"productInfo": "Product: Sony WH-1000XM5 Headphones. Price: $349.99. Battery Life: 30 hours. Noise Cancellation: Yes, adaptive. Connectivity: Bluetooth 5.2, 3.5mm jack. Weight: 250g."}, {"customerQuestion": "How long does the battery last and can I use them wired?"}], "referenceResponse": "The Sony WH-1000XM5 headphones have a battery life of up to 30 hours on a single charge. And yes, they do come with a 3.5mm jack, so you can use them in wired mode as well."}, {"inputVariables": [{"productInfo": "Product: Sony WH-1000XM5 Headphones. Price: $349.99. Battery Life: 30 hours. Noise Cancellation: Yes, adaptive. Connectivity: Bluetooth 5.2, 3.5mm jack. Weight: 250g."}, {"customerQuestion": "Do these have noise cancellation?"}], "referenceResponse": "Yes, the Sony WH-1000XM5 headphones feature adaptive noise cancellation, which automatically adjusts the level of noise cancellation based on your environment."}, {"inputVariables": [{"productInfo": "Product: Apple MacBook Air M3. Price: $1,099. RAM: 8GB. Storage: 256GB SSD. Display: 13.6-inch Liquid Retina. Battery Life: Up to 18 hours."}, {"customerQuestion": "Is 8GB of RAM enough for video editing?"}], "referenceResponse": "The MacBook Air M3 comes with 8GB of unified memory. It can handle light video editing but you may want more RAM for heavy work."} ] }

예제 3: 템플릿 2개, 프롬프트당 단일 변수, 여러 샘플, 조향 기준

이 예제는 JSONL 파일의 두 줄(한 작업에 두 개의 프롬프트 템플릿)을 보여줍니다.

{"version": "bedrock-2026-05-14", "promptTemplate": "You are a helpful assistant. Answer the following: {{question}}", "templateId": "template-qa-1", "steeringCriteria": ["ACCURATE"], "evaluationSamples": [{"inputVariables": [{"question": "What is 2+2?"}], "referenceResponse": "4"}, {"inputVariables": [{"question": "What is the largest planet in our solar system?"}], "referenceResponse": "Jupiter is the largest planet in our solar system."}]} {"version": "bedrock-2026-05-14", "promptTemplate": "Translate the following to French: {{text}}", "templateId": "template-translate-1", "steeringCriteria": ["PRECISE"], "evaluationSamples": [{"inputVariables": [{"text": "Hello, how are you?"}], "referenceResponse": "Bonjour, comment allez-vous?"}, {"inputVariables": [{"text": "Thank you very much."}], "referenceResponse": "Merci beaucoup."}]}

예제 4: 단일 템플릿, 여러 변수, 여러 샘플, LLM-as-a-judge

{ "version": "bedrock-2026-05-14", "promptTemplate": "You are a customer support agent for an electronics store.\n\nGiven the following product information:\n{{productInfo}}\n\nAnswer the customer's question:\n{{customerQuestion}}\n\nProvide a helpful, accurate, and concise response.", "templateId": "template-llmj-1", "customEvaluationMetricLabel": "responseaccuracy", "evaluationSamples": [ {"inputVariables": [{"productInfo": "Product: Sony WH-1000XM5 Headphones. Price: $349.99. Battery Life: 30 hours. Noise Cancellation: Yes, adaptive."}, {"customerQuestion": "How long does the battery last?"}], "referenceResponse": "The Sony WH-1000XM5 headphones have a battery life of up to 30 hours on a single charge."}, {"inputVariables": [{"productInfo": "Product: Apple MacBook Air M3. Price: $1,099. RAM: 8GB. Storage: 256GB SSD."}, {"customerQuestion": "Is 8GB of RAM enough for video editing?"}], "referenceResponse": "The MacBook Air M3 comes with 8GB of unified memory. It can handle light video editing but you may want more RAM for heavy work."} ], "customLLMJConfig": { "customLLMJPrompt": "Evaluate how accurate the response is to the customer question. Consider whether the response uses only the provided product information and does not hallucinate details. Here is the information you are supposed to evaluate: \n\nPrompt: {{prompt}}\nResponse: {{response}}\n\n \n\n ground truth answer: {{referenceResponse}}. Grading scale: Rate the response on a scale of 1-5. 1 means the answer is full of hallucinations and does not answer the question. 5 means the answer does not hallucinate at all and perfectly answers the question with no extra information. Interpolate the rest of the grading scale", "customLLMJModelId": "anthropic.claude-sonnet-4-5-20250929-v1:0" } }

예제 5: 단일 템플릿, 여러 변수, 여러 샘플, 평가 방법 없음(시스템 기본값)

평가 또는 조향이 제공되지 않으므로 프롬프트 옵티마이저는 정확도, 완전성 및 쓰기 스타일을 결합한 내장 일반 LLM-as-a-judge를 사용합니다.

{ "version": "bedrock-2026-05-14", "promptTemplate": "You are a customer support agent for an electronics store.\n\nGiven the following product information:\n{{productInfo}}\n\nAnswer the customer's question:\n{{customerQuestion}}\n\nProvide a helpful, accurate, and concise response.", "templateId": "template-default-llmj-1", "evaluationSamples": [ {"inputVariables": [{"productInfo": "Product: Sony WH-1000XM5 Headphones. Price: $349.99. Battery Life: 30 hours. Noise Cancellation: Yes, adaptive."}, {"customerQuestion": "How long does the battery last?"}], "referenceResponse": "The Sony WH-1000XM5 headphones have a battery life of up to 30 hours on a single charge."}, {"inputVariables": [{"productInfo": "Product: Apple MacBook Air M3. Price: $1,099. RAM: 8GB. Storage: 256GB SSD."}, {"customerQuestion": "Is 8GB of RAM enough for video editing?"}], "referenceResponse": "The MacBook Air M3 comes with 8GB of unified memory. It can handle light video editing but you may want more RAM for heavy work."} ] }

예제 6: 단일 템플릿, 단일 변수, 여러 샘플, Lambda 평가자

{ "version": "bedrock-2026-05-14", "promptTemplate": "You are a helpful assistant. Answer the following: {{question}}", "templateId": "template-byo-1", "customEvaluationMetricLabel": "accuracygraderlambda", "evaluationSamples": [ {"inputVariables": [{"question": "What is the capital of France?"}], "referenceResponse": "The capital of France is Paris."}, {"inputVariables": [{"question": "What is 2+2?"}], "referenceResponse": "4"} ], "evaluationMetricLambdaArn": "arn:aws:lambda:us-west-2:<YOUR_ACCOUNT_ID>:function:<YOUR_EVAL_FUNCTION>" }

예제 7: 단일 템플릿, 텍스트 변수 없음, 멀티모달만, LLM-as-judge

멀티모달 입력이 포함되어 있기 {{variables}} 때문에가 없는 경우에도 허용 가능한 입력입니다.

{ "version": "bedrock-2026-05-14", "templateId": "multimodal_only_01", "promptTemplate": "Does this image contain a dog? Respond yes or no", "customEvaluationMetricLabel": "binarydogjudge", "customLLMJConfig": { "customLLMJPrompt": "Determine if the model response matches the ground truth. Grading scale: 0 if the response does not match the ground truth, 1 if the response matches the ground truth. Here is the input: \n\n input: {{prompt}} \n\n model response: {{response}} \n\n ground truth: {{referenceResponse}}.", "customLLMJModelId": "anthropic.claude-sonnet-4-5-20250929-v1:0" }, "evaluationSamples": [ {"inputVariablesMultimodal": [{"dogimage": {"type": "IMAGE", "s3Uri": "s3://my-bucket/images/dog-photo.jpg"}}], "referenceResponse": "Yes"}, {"inputVariablesMultimodal": [{"catimage": {"type": "IMAGE", "s3Uri": "s3://my-bucket/images/cat-photo.png"}}], "referenceResponse": "No"} ] }

예제 8: 단일 템플릿, 여러 변수, LLM-as-judge, 혼합 텍스트 및 멀티모달

{ "version": "bedrock-2026-05-14", "templateId": "multimodal_with_text_01", "promptTemplate": "Given the context in attached documents and the user question, provide a short answer. User question: {{question}}", "customEvaluationMetricLabel": "documentinfograder", "customLLMJConfig": { "customLLMJPrompt": "Evaluate whether the response correctly answers the question using information from the provided document. Score 1-5 where 5 means fully correct and grounded in the source material, and 1 means the answer was completely hallucinated and inaccurate. Here's the information: \n Prompt: {{prompt}}, Model response: {{response}}, ground truth: {{referenceResponse}}", "customLLMJModelId": "anthropic.claude-sonnet-4-5-20250929-v1:0" }, "evaluationSamples": [ { "inputVariables": [{"question": "What is the total revenue for Q1?"}], "inputVariablesMultimodal": [ {"Q1report": {"type": "PDF", "s3Uri": "s3://my-bucket/docs/quarterly-report.pdf"}}, {"revenuechart": {"type": "IMAGE", "s3Uri": "s3://my-bucket/images/revenue-chart.png"}} ], "referenceResponse": "The total revenue for Q1 was $4.2M." } ] }