翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
retrieve-and-generate評価ジョブには、JSON 行形式を使用したプロンプトデータセットが必要です。データセットには最大 1000 個のプロンプトを含めることができます
Amazon Bedrock がナレッジベースをretrieve-and-generate評価ジョブ用のデータセットを準備する
Amazon Bedrock がナレッジベースを呼び出す取得専用評価ジョブを作成するには、プロンプトデータセットに次のキーと値のペアが含まれている必要があります。
-
referenceResponses
– この親キーは、 が返RetrieveAndGenerate
すと予想されるグラウンドトゥルースレスポンスを指定するために使用されます。text
キーにグラウンドトゥルースを指定します。referenceResponses
は、評価ジョブでコンテキストカバレッジメトリクスを選択した場合に必要です。 -
prompt
– この親キーは、評価ジョブの実行中にモデルが応答するプロンプト (ユーザークエリ) を指定するために使用されます。
以下は、6 つの入力を含み、JSON Lines 形式を使用するカスタムデータセットの例です。
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you want to use during inference"
}]},"referenceResponses":[{"content":[{"text":"Specify a ground-truth response"
}]}]}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you want to use during inference"
}]},"referenceResponses":[{"content":[{"text":"Specify a ground-truth response"
}]}]}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you want to use during inference"
}]},"referenceResponses":[{"content":[{"text":"Specify a ground-truth response"
}]}]}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you want to use during inference"
}]},"referenceResponses":[{"content":[{"text":"Specify a ground-truth response"
}]}]}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you want to use during inference"
}]},"referenceResponses":[{"content":[{"text":"Specify a ground-truth response"
}]}]}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you want to use during inference"
}]},"referenceResponses":[{"content":[{"text":"Specify a ground-truth response"
}]}]}]}
次のプロンプトが展開され、わかりやすくなりました。実際のプロンプトデータセットでは、各行 (プロンプト) は有効な JSON オブジェクトである必要があります。
{
"conversationTurns": [
{
"prompt": {
"content": [
{
"text": "What is the recommended service interval for your product?"
}
]
},
"referenceResponses": [
{
"content": [
{
"text": "The recommended service interval for our product is two years."
}
]
}
]
}
]
}
独自の推論レスポンスデータを使用して、評価ジョブretrieve-and-generateのためのデータセットを準備する
独自の推論レスポンスデータを提供するretrieve-and-generate評価ジョブを作成するには、プロンプトデータセットは会話ターンのリストであり、ターンごとに以下が含まれます。ジョブごとに評価できる RAG ソースは 1 つだけです。
-
prompt
– 結果を生成するためにモデルに指定したプロンプト。 -
referenceResponses
– この親キーは、取得結果と入力クエリを取り込んだ後に LLM からの最終出力に予想される Ground-truth レスポンスを指定するために使用されます。 -
referenceContexts
(オプション) – このオプションの親キーは、RAG ソースから取得される予定のグラウンドトゥルースパッセージを指定するために使用されます。このキーは、独自のカスタム評価メトリクスで使用する場合にのみ含める必要があります。Amazon Bedrock が提供する組み込みメトリクスは、このプロパティを使用しません。 -
output
– 以下で構成される RAG ソースからの出力。-
text
– RAG システムの LLM からの最終出力。 -
retrievedPassages
– この親キーは、RAG ソースが取得したコンテンツを指定するために使用されます。
-
output
データには、推論レスポンスの生成に使用した RAG ソースknowledgeBaseIdentifier
を定義する文字列も含める必要があります。使用した LLM を識別するオプションのmodelIdentifier
文字列を含めることもできます。retrievalResults
および にはretrievedReferences
、オプションの名前とメタデータを指定できます。
以下は、6 つの入力を含み、JSON Lines 形式を使用するカスタムデータセットの例です。
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you used to generate the response"}]},"referenceResponses":[{"content":[{"text":"A ground truth for the final response generated by the LLM"}]}],"referenceContexts":[{"content":[{"text":"A ground truth for a received passage"}]}],"output":{"text":"The output of the LLM","modelIdentifier":"(Optional) a string identifying your model","knowledgeBaseIdentifier":"A string identifying your RAG source","retrievedPassages":{"retrievalResults":[{"name":"(Optional) a name for your retrieval","content":{"text":"The retrieved content"},"metadata":{"(Optional) a key for your metadata":"(Optional) a value for your metadata"}}]}}}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you used to generate the response"}]},"referenceResponses":[{"content":[{"text":"A ground truth for the final response generated by the LLM"}]}],"referenceContexts":[{"content":[{"text":"A ground truth for a received passage"}]}],"output":{"text":"The output of the LLM","modelIdentifier":"(Optional) a string identifying your model","knowledgeBaseIdentifier":"A string identifying your RAG source","retrievedPassages":{"retrievalResults":[{"name":"(Optional) a name for your retrieval","content":{"text":"The retrieved content"},"metadata":{"(Optional) a key for your metadata":"(Optional) a value for your metadata"}}]}}}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you used to generate the response"}]},"referenceResponses":[{"content":[{"text":"A ground truth for the final response generated by the LLM"}]}],"referenceContexts":[{"content":[{"text":"A ground truth for a received passage"}]}],"output":{"text":"The output of the LLM","modelIdentifier":"(Optional) a string identifying your model","knowledgeBaseIdentifier":"A string identifying your RAG source","retrievedPassages":{"retrievalResults":[{"name":"(Optional) a name for your retrieval","content":{"text":"The retrieved content"},"metadata":{"(Optional) a key for your metadata":"(Optional) a value for your metadata"}}]}}}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you used to generate the response"}]},"referenceResponses":[{"content":[{"text":"A ground truth for the final response generated by the LLM"}]}],"referenceContexts":[{"content":[{"text":"A ground truth for a received passage"}]}],"output":{"text":"The output of the LLM","modelIdentifier":"(Optional) a string identifying your model","knowledgeBaseIdentifier":"A string identifying your RAG source","retrievedPassages":{"retrievalResults":[{"name":"(Optional) a name for your retrieval","content":{"text":"The retrieved content"},"metadata":{"(Optional) a key for your metadata":"(Optional) a value for your metadata"}}]}}}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you used to generate the response"}]},"referenceResponses":[{"content":[{"text":"A ground truth for the final response generated by the LLM"}]}],"referenceContexts":[{"content":[{"text":"A ground truth for a received passage"}]}],"output":{"text":"The output of the LLM","modelIdentifier":"(Optional) a string identifying your model","knowledgeBaseIdentifier":"A string identifying your RAG source","retrievedPassages":{"retrievalResults":[{"name":"(Optional) a name for your retrieval","content":{"text":"The retrieved content"},"metadata":{"(Optional) a key for your metadata":"(Optional) a value for your metadata"}}]}}}]}
{"conversationTurns":[{"prompt":{"content":[{"text":"Provide the prompt you used to generate the response"}]},"referenceResponses":[{"content":[{"text":"A ground truth for the final response generated by the LLM"}]}],"referenceContexts":[{"content":[{"text":"A ground truth for a received passage"}]}],"output":{"text":"The output of the LLM","modelIdentifier":"(Optional) a string identifying your model","knowledgeBaseIdentifier":"A string identifying your RAG source","retrievedPassages":{"retrievalResults":[{"name":"(Optional) a name for your retrieval","content":{"text":"The retrieved content"},"metadata":{"(Optional) a key for your metadata":"(Optional) a value for your metadata"}}]}}}]}
以下は、わかりやすくするために展開されたプロンプトデータセット形式を示しています。実際のプロンプトデータセットでは、各行 (プロンプト) は有効な JSON オブジェクトである必要があります。
{
"conversationTurns": [
{
"prompt": {
"content": [
{
"text": "Provide the prompt you used to generate the responses"
}
]
},
"referenceResponses": [
{
"content": [
{
"text": "A ground truth for the final response generated by the LLM"
}
]
}
],
"referenceContexts": [
{
"content": [
{
"text": "A ground truth for a received passage"
}
]
}
],
"output": {
"text": "The output of the LLM",
"modelIdentifier": "(Optional) a string identifying your model",
"knowledgeBaseIdentifier": "A string identifying your RAG source",
"retrievedPassages": {
"retrievalResults": [
{
"name": "(Optional) a name for your retrieval",
"content": {
"text": "The retrieved content"
},
"metadata": {
"(Optional) a key for your metadata": "(Optional) a value for your metadata"
}
}
]
}
}
}
]
}