- Newest
- Most votes
- Most comments
Hi,
If you look at official documentation and for the time being (Prompt management is brand new), only Converse & InvokeModel when you infer directly with Bedrock models can work with Prompt Management:
Amazon Bedrock Runtime APIs Converse and InvokeModel support executing a
prompt using a Prompt identifier. You can simply provide the prompt identifier
as a parameter to Converse and InvokeModel API calls.
We will retrieve the necessary prompt information including the Foundation Model,
model configuration, system instructions, user/assistant messages, and tool configuration
to execute the prompt and return the model response.
from https://aws.amazon.com/bedrock/prompt-management/
Best,
Didier
Your assumption is correct. The RetrieveAndGenerate API for Knowledge Bases in Amazon Bedrock does not support using prompts from Prompt Management directly.
When using RetrieveAndGenerate with a Knowledge Base, you cannot provide a promptArn or use prompts created in Prompt Management. The prompt is under service control in this API.
As an alternative, you have a couple of options:
-
Use the textPromptTemplate field in the generationConfiguration as you've shown. This allows you to provide a custom prompt template as a string, but it doesn't use saved prompts from Prompt Management.
-
If you want more control over the prompt, you can use a two-step process: a. First, use the Retrieve API to get the relevant information from your Knowledge Base. b. Then, use this retrieved information to construct your own prompt, which you can then use with a model inference call.
This approach gives you more flexibility in crafting your prompt, including the ability to use prompts you've created in Prompt Management. However, it requires more work on your part to manage the retrieval and prompt construction process.
Remember that while this method requires more manual handling, it offers greater control over the prompt used in your application.
Sources
Can we send system prompt in Retrieve and generate | AWS re:Post
Relevant content
asked 2 years ago
asked 2 years ago
- AWS OFFICIALUpdated 5 years ago

what is the recommended ways to store the generation prompt then, of course not in the code :)