Amazon Bedrock Documentation

Amazon Bedrock is a fully managed service that offers a choice of foundation models (FMs) from AI companies like AI21 Labs, Anthropic, Cohere, Meta, Mistral AI, Stability AI, and Amazon via a single API, along with a broad set of capabilities you need to build generative AI applications with security, privacy, and responsible AI. Using Amazon Bedrock, you can experiment with and evaluate top FMs for your use case, privately customize them with your data using techniques such as fine-tuning and Retrieval Augmented Generation (RAG), and build agents that execute tasks using your enterprise systems and data sources. Since Amazon Bedrock is serverless, you don't have to manage any infrastructure, and you can integrate and deploy generative AI capabilities into your applications using the AWS services you are already familiar with.

Agents for Amazon Bedrock

Prompt creation

Agents for Amazon Bedrock creates a prompt from the developer-provided instructions, API details needed to complete the tasks, and company data source details from knowledge bases.

Retrieval augmented generation

Agents for Amazon Bedrock is designed to securely connect to your company’s data sources, convert data into numerical representations, and augment the user request with the right information to generate a response.

Orchestrate and execute multistep tasks

Customers can create an agent in Amazon Bedrock in just a few clicks, accelerating the time it takes to build generative AI capabilities into applications. Customers first select their desired model and write a few instructions in natural language. Agents orchestrate and analyze the task and break it down into the correct logical sequence using the FM’s reasoning abilities. Agents call the necessary APIs to transact with the company systems and processes to fulfill the request, determining along the way if they can proceed or if they need to gather more information. 

Trace through the Chain of Thought (CoT) reasoning

You can step through the agent's reasoning and orchestration plan with the trace capability. With these insights, you can troubleshoot different orchestration issues to steer the model towards the desired behavior for a better user experience. Moreover, you can review the steps and adjust the instructions as you iterate on the application. With visibility into the model's reasoning, you can create differentiated applications faster.

Prompt engineering

Agents for Amazon Bedrock creates a prompt template from the user instructions, action group, and knowledge bases. You can use this template as a baseline to further refine the generated prompt template to enhance the user experience. You can also update the user input, orchestration plan, and the FM response. Lastly, with the ability to modify the prompt template, you can gain better control over the agent orchestration.

Amazon Bedrock Developer Experience

Choose from leading FMs

Amazon Bedrock makes building with a range of FMs as easy as an API call. Amazon Bedrock provides access to leading models including AI21 Labs' Jurassic, Anthropic's Claude, Cohere's Command and Embed, Meta's Llama 2, and Stability AI's Stable Diffusion, as well as our own Amazon Titan models. With Amazon Bedrock, you can select the FM that is best suited for your use case and application requirements.

Experiment with FMs for different tasks

You can experiment with different FMs using interactive playgrounds for various modalities including text, chat, and image. The playgrounds allow you to try out various models for your use case to get a feel for the model’s suitability for a given task.

Evaluate FMs to select the best one for your use case

Model Evaluation on Amazon Bedrock allows you to use automatic and human evaluations to select FMs for a specific use case. Automatic model evaluation uses curated datasets and provides pre-defined metrics including accuracy, robustness, and toxicity. For subjective metrics, you can use Amazon Bedrock to set up a human evaluation workflow with a few clicks. With human evaluations, you can bring your own datasets and define custom metrics, such as relevance, style, and alignment to brand voice. Human evaluation workflows can leverage your own employees as reviewers or you can engage an AWS-managed team to perform the human evaluation, where AWS hires skilled evaluators and manages the end-to-end workflow on your behalf.

Privately customize FMs with your data

With a few clicks, Amazon Bedrock lets you go from generic models to ones that are specialized and customized for your business and use case. You can use a technique called fine-tuning to adapt an FM for a specific task. Simply point to a few labeled examples in an Amazon Simple Storage Service (S3) bucket, and Amazon Bedrock makes a copy of the base model, trains it with your data, and creates a fine-tuned model accessible only to you, so you get customized responses. Fine-tuning is available for Command, Llama 2, Titan Text Lite and Express, Titan Image Generator, and Titan Multimodal Embeddings models. You can also adapt Titan Text Lite and Express FMs in Amazon Bedrock with continued pre-training, a technique that uses your unlabeled datasets to customize the FM for your domain or industry. With both fine-tuning and continued pre-training, Amazon Bedrock creates a private, customized copy of the base FM for you. Your data is not used to train the original base models. Your data used to customize models is designed to be securely transferred through your Amazon Virtual Private Cloud (VPC).

Single API

Use a single API to perform inference, regardless of the model you choose. Having a single API provides the flexibility to use different models from different model providers and keep up-to-date with the latest model versions with minimal code changes.

Guardrails for Amazon Bedrock

Bring consistent level of AI safety across all your applications

Guardrails for Amazon Bedrock evaluates user inputs and FM responses based on use case specific policies, and provides an additional layer of safeguards regardless of the underlying FM. Guardrails can be applied across FMs, including Anthropic Claude, Meta Llama 2, Cohere Command, AI21 Labs Jurassic, and Amazon Titan Text, as well as fine-tuned models. Customers can create multiple guardrails, each configured with a different combination of controls, and use these guardrails across different applications and use cases. Guardrails can also be integrated with Agents for Amazon Bedrock to build generative AI applications aligned with your responsible AI policies.

Block undesirable topics in your generative AI applications

Organizations recognize the need to manage interactions within generative AI applications for a relevant and safe user experience. They want to further customize interactions to remain on topics relevant to their business, and align with company policies. Using a short natural language description, Guardrails for Amazon Bedrock allows you to define a set of topics to avoid within the context of your application. Guardrails detects and blocks user inputs and FM responses that fall into the restricted topics.

Filter harmful content based on your responsible AI policies

Guardrails for Amazon Bedrock provides content filters with configurable thresholds to filter harmful content across hate, insults, sexual, and violence categories. Most FMs already provide built-in protections to prevent the generation of harmful responses. In addition to these protections, Guardrails lets you configure thresholds across the different categories to filter out harmful interactions. Guardrails automatically evaluate both user queries and FM responses to detect and help prevent content that falls into restricted categories.

Redact PII to protect user privacy

Guardrails for Amazon Bedrock allows you to detect Personally Identifiable Information (PII) in user inputs and FM responses. Based on the use case, you can selectively reject inputs containing PII or redact PII in FM responses.

Knowledge Bases for Amazon Bedrock

Managed support for end-to-end RAG workflow

To equip FMs with up-to-date and proprietary information, organizations use Retrieval Augmented Generation (RAG), a technique that fetches data from company data sources and enriches the prompt to provide more relevant and accurate responses. Knowledge Bases for Amazon Bedrock is a fully managed capability that helps you implement the entire RAG workflow from ingestion to retrieval and prompt augmentation without having to build custom integrations to data sources and manage data flows. Session context management is built in, so your app can readily support multi-turn conversations.

Connect FMs and agents to data sources

Point to the location of your data in Amazon S3, and Knowledge Bases for Amazon Bedrock fetches the documents, divides them into blocks of text, converts the text into embeddings, and stores the embeddings in your vector database. If you do not have an existing vector database, Amazon Bedrock creates an Amazon OpenSearch Serverless vector store for you. You can also specify an existing vector store in one of the supported databases, including Amazon OpenSearch Serverless, Pinecone, and Redis Enterprise Cloud, with support for Amazon Aurora and MongoDB coming soon.

Easily retrieve relevant data and augment prompts

You can use the Retrieve API to fetch relevant results for a user query from knowledge bases. The RetrieveAndGenerate API uses the retrieved results to augment the FM prompt and return the response. You can also add knowledge bases to Agents for Amazon Bedrock to provide contextual information to agents.

Provide source attribution

All the information retrieved from Knowledge Bases for Amazon Bedrock is provided with citations to improve transparency and minimize hallucinations.

Amazon Bedrock Privacy and Security

Secure your generative AI applications

With Amazon Bedrock, you have full control over the data you use to customize the FMs for your generative AI applications. Your data is encrypted in transit and at rest. Additionally, you can create, manage, and control encryption keys using the AWS Key Management Service (AWS KMS). Identity-based policies provide further control over your data, helping you manage what actions users and roles can perform, on which resources, and under what conditions.

Build with comprehensive data protection and privacy

Amazon Bedrock helps ensure that your data stays under your control. Customer inputs provided to and outputs generated from FMs on Amazon Bedrock are not shared with third-party model providers, and are not used to train or improve the base FMs. When you fine-tune an FM on Amazon Bedrock, we base it on a private copy of that model. You can use AWS PrivateLink to establish private connectivity from your Amazon Virtual Private Cloud (VPC) to Amazon Bedrock, without having to expose your VPC to internet traffic.

Implement governance, and auditability

Amazon Bedrock offers monitoring and logging capabilities that can support your governance and audit requirements. You can use Amazon CloudWatch to track usage metrics and build customized dashboards with metrics that can be used for your audit purposes. You can also use AWS CloudTrail to monitor API activity and troubleshoot issues as you integrate other systems into your generative AI applications. You can also choose to store the metadata, requests, and responses in your Amazon S3 bucket, as well as to Amazon CloudWatch Logs. Finally, to prevent potential misuse, Amazon Bedrock implements automated abuse detection mechanisms.

Additional Information

For additional information about service controls, security features and functionalities, including, as applicable, information about storing, retrieving, modifying, restricting, and deleting data, please see https://docs.aws.amazon.com/index.html. This information does not form part of the Documentation for purposes of the AWS Customer Agreement available at http://aws.amazon.com/agreement, or other agreement between you and AWS governing your use of AWS’s services.