admin管理员组文章数量:1188225
How do you use prompts stored in prompt management with a single invocation of the model? I setup a prompt with a variable called myInput
but the docs don't specify how I can use this other than this example which implies I need to setup a flow just to use the prompt? Am I unable to use the prompt I created in prompt management directly with the InvokeModelCommand
?
Nothing in the docs I'm seeing explicitly calls tells you how to specify prompt variables even though the modelId
field states this in this doc:
If you use a prompt created through Prompt management, specify the ARN of the prompt.
import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
...
const bedrockClient = new BedrockRuntimeClient({});
...
const command = new InvokeModelCommand({
modelId: "arn:aws:bedrock:us-east-1:12345678:prompt/ABCDEFG:2",
body: JSON.stringify({
promptVariables: {
myInput: myInputValue
}
})
});
const response = await bedrockClient.send(command);
Specifying the modelId is ok but gives an error because the prompt variables can't be passed.
ValidationException: Malformed request for promptVariablesreceived
How do you use prompts stored in prompt management with a single invocation of the model? I setup a prompt with a variable called myInput
but the docs don't specify how I can use this other than this example which implies I need to setup a flow just to use the prompt? Am I unable to use the prompt I created in prompt management directly with the InvokeModelCommand
?
Nothing in the docs I'm seeing explicitly calls tells you how to specify prompt variables even though the modelId
field states this in this doc:
If you use a prompt created through Prompt management, specify the ARN of the prompt.
import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
...
const bedrockClient = new BedrockRuntimeClient({});
...
const command = new InvokeModelCommand({
modelId: "arn:aws:bedrock:us-east-1:12345678:prompt/ABCDEFG:2",
body: JSON.stringify({
promptVariables: {
myInput: myInputValue
}
})
});
const response = await bedrockClient.send(command);
Specifying the modelId is ok but gives an error because the prompt variables can't be passed.
ValidationException: Malformed request for promptVariablesreceived
Share
Improve this question
asked Jan 24 at 20:27
AdamAdam
4,78011 gold badges57 silver badges90 bronze badges
1 Answer
Reset to default 0Although the InvokeModelCommand
explicitly states you can specify the ARN of the prompt managed template, there appears to be no way to pass prompt variables as part of the request. The ConverseCommand
supports it but not the InvokeModelCommand
and the examples only show managed prompt templates being used in flows so for now I'm assuming those are the only two scenarios where they can be used unfortunately.
本文标签: amazon web servicesUsing AWS Bedrock Prompt Management with InvokeCommandStack Overflow
版权声明:本文标题:amazon web services - Using AWS Bedrock Prompt Management with InvokeCommand - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738387336a2084249.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论