Today we are announcing the general availability of Amazon Bedrock Prompt Management, with new features that provide enhanced options for configuring your prompts and enabling seamless integration for invoking them in your generative AI applications.
Amazon Bedrock Prompt Management simplifies the creation, evaluation, versioning, and sharing of prompts to help developers and prompt engineers get better responses from foundation models (FMs) for their use cases. In this post, we explore the key capabilities of Amazon Bedrock Prompt Management and show examples of how to use these tools to help optimize prompt performance and outputs for your specific use cases.
New features in Amazon Bedrock Prompt Management
Amazon Bedrock Prompt Management offers new capabilities that simplify the process of building generative AI applications:
- Structured prompts – Define system instructions, tools, and additional messages when building your prompts
- Converse and InvokeModel API integration – Invoke your cataloged prompts directly from the Amazon Bedrock Converse and InvokeModel API calls
To showcase the new additions, let’s walk through an example of building a prompt that summarizes financial documents.
Create a new prompt
Complete the following steps to create a new prompt:
- On the Amazon Bedrock console, in the navigation pane, under Builder tools, choose Prompt management.
- Choose Create prompt.
- Provide a name and description, and choose Create.
Build the prompt
Use the prompt builder to customize your prompt:
- For System instructions, define the model’s role. For this example, we enter the following:
You are an expert financial analyst with years of experience in summarizing complex financial documents. Your task is to provide clear, concise, and accurate summaries of financial reports.
- Add the text prompt in the User message box.
You can create variables by enclosing a name with double curly braces. You can later pass values for these variables at invocation time, which are injected into your prompt template. For this post, we use the following prompt:
- Configure tools in the Tools setting section for function calling.
You can define tools with names, descriptions, and input schemas to enable the model to interact with external functions and expand its capabilities. Provide a JSON schema that includes the tool information.
When using function calling, an LLM doesn’t directly use tools; instead, it indicates the tool and parameters needed to use it. Users must implement the logic to invoke tools based on the model’s requests and feed results back to the model. Refer to Use a tool to complete an Amazon Bedrock model response to learn more.
- Choose Save to save your settings.
Compare prompt variants
You can create and compare multiple versions of your prompt to find the best one for your use case. This process is manual and customizable.
- Choose Compare variants.
- The original variant is already populated. You can manually add new variants by specifying the number you want to create.
- For each new variant, you can customize the user message, system instruction, tools configuration, and additional messages.
- You can create different variants for different models. Choose Select model to choose the specific FM for testing each variant.
- Choose Run all to compare outputs from all prompt variants across the selected models.
- If a variant performs better than the original, you can choose Replace original prompt to update your prompt.
- On the Prompt builder page, choose Create version to save the updated prompt.
This approach allows you to fine-tune your prompts for specific models or use cases and makes it straightforward to test and improve your results.
Invoke the prompt
To invoke the prompt from your applications, you can now include the prompt identifier and version as part of the Amazon Bedrock Converse API call. The following code is an example using the AWS SDK for Python (Boto3):
We have passed the prompt Amazon Resource Name (ARN) in the model ID parameter and prompt variables as a separate parameter, and Amazon Bedrock directly loads our prompt version from our prompt management library to run the invocation without latency overheads. This approach simplifies the workflow by enabling direct prompt invocation through the Converse or InvokeModel APIs, eliminating manual retrieval and formatting. It also allows teams to reuse and share prompts and track different versions.
For more information on using these features, including necessary permissions, see the documentation.
You can also invoke the prompts in other ways:
- Use the Amazon Bedrock prompt flow. Include any prompt version from Amazon Bedrock Prompt Management using the prompt node in your flow.
- Use the Amazon Bedrock SDK and the
get_prompt
This allows you to integrate the prompt information into your code application or, if preferred, using open source frameworks such as LangChain or LlamaIndex. Refer to Integrate Amazon Bedrock Prompt Management in LangChain applications for more details.
Now available
Amazon Bedrock Prompt Management is now generally available in the US East (N. Virginia) and US West (Oregon) AWS Regions. For pricing information, see Amazon Bedrock Pricing.
Conclusion
The general availability of Amazon Bedrock Prompt Management introduces powerful capabilities that enhance the development of generative AI applications. By providing a centralized platform to create, customize, and manage prompts, developers can streamline their workflows and work towards improving prompt performance. The ability to define system instructions, configure tools, and compare prompt variants empowers teams to craft effective prompts tailored to their specific use cases. With seamless integration into the Amazon Bedrock Converse API and support for popular frameworks, organizations can now effortlessly build and deploy AI solutions that are more likely to generate relevant output.
About the Authors
Dani Mitchell is a Generative AI Specialist Solutions Architect at AWS. He is focused on computer vision use cases and helping accelerate EMEA enterprises on their ML and generative AI journeys with Amazon SageMaker and Amazon Bedrock.
Ignacio Sánchez is a Spatial and AI/ML Specialist Solutions Architect at AWS. He combines his skills in extended reality and AI to help businesses improve how people interact with technology, making it accessible and more enjoyable for end-users.
Subscribe to our email newsletter to get the latest posts delivered right to your email.
Comments