Elevate Your AI Journey with Amazon Bedrock: Unraveling The Key Features


Post Views: 3,853

Amazon Bedrock, which was announced in April 2023, has drawn a lot of attention from businesses looking to leverage their existing AWS architecture for building Generative AI applications. Amazon announced the General Availability (GA) of Bedrock on September 28 — a service that offers a choice of Generative AI models from Amazon and third-party providers through an API-based interface.

With the current market landscape (high demand for leveraging GAI for building innovative business capabilities) and increasing competitive offerings (Azure’s OpenAI partnership & Azure AI and Google Cloud’s Vertex AI and Duet AI), expanding the capabilities of its end-to-end Generative AI landscape has been a key priority for Amazon. Amazon Bedrock is the foundational building block to provide these GAI capabilities along with the existing AWS ecosystem of 30+ AI and ML Services.

While there are many features as part of the offering, this article summarizes key features that help enterprise organizations elevate their AI journey by addressing their novel concerns:

#1 – Unified Serverless Abstraction Layer for Foundation Models

Amazon Bedrock provides a serverless abstraction to the foundation models from leading providers like AI21 Labs, Anthropic, Cohere, Meta, Stability AI and Amazon. With AWS’s in-built security, scalability, performance and manageability — it is a key differentiator for existing AWS customers. Note that Bedrock provides provisioned throughput capability to ensure a consistent user experience during peak traffic hours.

AWS provides Boto3 — a Python-based SDK as a unified interface to interface with different foundation models. Refer to the Additional Information section below for code examples.

Amazon Bedrock As Abstraction Layer - Elevate Your AI Journey with Amazon Bedrock: Unraveling The Key Features
Amazon Bedrock As Abstraction Layer

#2 Seamless Integration with existing AWS-based Cloud Architecture

The key differentiator for Bedrock is the seamless integration with enterprise-specific Cloud architecture, particularly if you are AWS-oriented. In my observation, while Generative AI capabilities are yet to be enabled across AWS services, it will happen incrementally. Currently, the following services support Generative AI-based applications:

  • Automatic prompt generation helps to save developers’ effort in applying prompt engineering. It creates a prompt from the developer-provided instructions, API schemas, and enterprise-specific data sources including vector databases.The orchestration plan feature elevates the build experience for complex tasks by determining the right sequence of tasks and handling error scenarios.The retrieval augmented generation (RAG) pattern is supported along with secure integration to the existing data sources.
  • Elevate Your AI Journey with Amazon Bedrock: Unraveling The Key Features
    A Sample Flow using Amazon Bedrock Agent (Source: AWS)

    #4 Amazon CodeWhisperer for integrated Developer’s Experience

    • Amazon CodeWhisperer, an AI coding companion built by Amazon, helps developers build software applications faster by providing code suggestions across 15 languages.
    • CodeWhisperer’s ability to integrate with the organization’s codebase and generate recommendations accordingly, mitigates the security and related concerns for enterprise applications.
    • Amazon CodeWhisperer customization capability elevates enterprise-specific code generation capability as it can include the enterprise’s internal APIs, libraries, best practices and architectural patterns.

    A. Amazon Sagemaker Jumpstart provides a unified interface to explore and launch a foundation model.

    Elevate Your AI Journey with Amazon Bedrock: Unraveling The Key Features
    Amazon Sagemaker Jumpstart for Foundation Model (Source: AWS)

    B. Launch Custom Model with fine-tuned using Enterprise Data

    1. Launch Custom Models from Amazon Bedrock:
    Amazon Bedrock Custom Model Screen
    Amazon Bedrock Custom Model Screen

    2. Create a fine-tune job with your data sources:

    Amazon Bedrock: Create a fine-tune job with your data sources

Elevate Your AI Journey with Amazon Bedrock: Unraveling The Key Features
    Amazon Bedrock Custom Model Fine-Tune Job

    C. An Example of Generating Blog with Bedrock and Amazon & AI21 Labs Models

    import boto3
    import json
    import pandas as pd
    
    bedrock = boto3.client(service_name="bedrock", region_name="us-west-2")
    
    # To see all the FMs
    # bedrock.list_foundation_models()
    
    prompt_data = (
        """Write a paragraph about benefits of using AWS Services in 3 Bullet Points"""
    )
    
    body = json.dumps(
        {
            "inputText": prompt_data,
            "textGenerationConfig": {"maxTokenCount": 200, "temperature": 0.6, "topP": 1},
        }
    )
    
    modelId = "amazon.titan-tg1-large"
    accept = "application/json"
    contentType = "application/json"
    
    response = bedrock.invoke_model(
        body=body, modelId=modelId, accept=accept, contentType=contentType
    )
    response_body = json.loads(response.get("body").read())
    
    titan_response = response_body.get("results")[0].get("outputText")
    
    # Switching the model to AI21 Labs' Jurassic-2 Ultra
    modelId = "ai21.j2-ultra-v1"
    body = json.dumps(
        {
            "prompt": prompt_data,
            "maxTokens": 200,
            "temperature": 0.6,
            "topP": 1,
        }
    )
    
    response = bedrock.invoke_model(
        body=body, modelId=modelId, accept=accept, contentType=contentType
    )
    response_body = json.loads(response.get("body").read())
    ultra_response = response_body.get("completions")[0].get("data").get("text")
    
    response_df = [[titan_response, ultra_response]]
    pd.set_option("display.max_colwidth", 0)
    pd.DataFrame(
        response_df, columns=["Amazon Titan Text TG1 Large", "AI21 Labs Jurassic-2 Ultra"]
    )

    D. Current Limitations Observed in Amazon Bedrock

    • It has been launched in two regions only — US East (N. Virginia) and US West (Oregon).
    • Comparatively, Google Vertex AI has launched Generative AI Search and Conversation Builder . Bedrock has not launched a similar user-friendly capability yet, but you can leverage Amazon Kendra and Amazon Lex.

    References

    Must Read

    Related Articles