amazon Titan Text Premier, the latest addition to the amazon Titan family of large language models (LLM), is now generally available on amazon Bedrock. amazon Bedrock is a fully managed service that offers a selection of high-performance foundation models (FM) from leading artificial intelligence (ai) companies such as AI21 Labs, Anthropic, Cohere, Meta, Stability ai, and amazon through a single API, along with a broad set of capabilities to build generative ai applications with security, privacy, and responsible ai.
amazon Titan Text Premier is an advanced, high-performance, cost-effective LLM designed to deliver superior performance for enterprise-grade text generation applications, including agent-optimized performance and Retrieval Augmented Generation (RAG). The model is built from the ground up following responsible, safe and trustworthy ai practices, and stands out for delivering exceptional generative ai text capabilities at scale.
Exclusive to amazon Bedrock, amazon Titan Text models support a wide range of text-related tasks, including summarization, text generation, classification, question answering, and information extraction. With amazon Titan Text Premier, you can unlock new levels of efficiency and productivity for your text generation needs.
In this post, we explore building and deploying two sample applications powered by amazon Titan Text Premier. To speed up development and deployment, we use open source. ai-cdk-constructs” target=”_blank” rel=”noopener”>AWS Generative ai CDK Builds (thrown out by Werner Vogels at AWS re:Invent 2023). AWS Cloud Development Kit (AWS CDK) builds accelerate application development by providing developers with reusable infrastructure patterns that they can seamlessly incorporate into their applications, allowing you to focus on what differentiates your application.
Document Explorer Sample Application
He ai-cdk-constructs-samples/tree/main/samples/document_explorer” target=”_blank” rel=”noopener”>Document Explorer Generative ai Application Example can help you quickly understand how to build end-to-end generative ai applications on AWS. Includes examples of key components needed in generative ai applications, such as:
- ai-cdk-constructs/tree/main/src/patterns/gen-ai/aws-rag-appsync-stepfn-opensearch” target=”_blank” rel=”noopener”>Data ingestion channel – Ingests documents, converts them to text and stores them in a knowledge base for retrieval. This enables use cases like RAG to adapt generative ai applications to your data.
- ai-cdk-constructs/tree/main/src/patterns/gen-ai/aws-summarization-appsync-stepfn” target=”_blank” rel=”noopener”>Document summary – Summarize PDF documents using amazon Titan Premier through amazon Bedrock.
- ai-cdk-constructs/tree/main/src/patterns/gen-ai/aws-qa-appsync-opensearch” target=”_blank” rel=”noopener”>Answer to questions – Answer questions in natural language by retrieving relevant documents from the knowledge base and using LLMs such as amazon Titan Premier through amazon Bedrock.
Follow the steps of ai-cdk-constructs-samples/tree/main/samples/document_explorer” target=”_blank” rel=”noopener”>READ ME to clone and deploy the app to your account. The application implements all the required infrastructure, as shown in the following architecture diagram.
After you deploy the application, upload a sample PDF file to the amazon Simple Storage Service (amazon S3) input bucket by choosing Select document in the navigation panel. For example, you can download amazon annual letters to shareholders from 1997 to 2023 and upload using the web interface. In the amazon S3 console, you can see that the files you uploaded are now located in the S3 bucket whose name starts with persistencestack-inputassets
.
After you've uploaded a file, open a document to see it rendered in the browser.
Choose Questions and answers in the navigation panel and choose your preferred model (for this example, amazon Titan Premier). You can now ask a question about the document you uploaded.
The following diagram illustrates a sample workflow in Document Explorer.
Don't forget to remove AWS CloudFormation stacks to avoid unexpected charges. First make sure to delete all data from S3 buckets, specifically anything in buckets whose names start with persistencestack
. Then run the following command from a terminal:
amazon Bedrock Agent sample app and custom knowledge base
He ai-cdk-constructs-samples/tree/main/samples/bedrock-agent” target=”_blank” rel=”noopener”>Sample generative ai application from amazon Bedrock Agent and Custom Knowledge Basen is a chat assistant designed to answer questions about literature using RAG from a selection of Project Gutenberg books.
This application implements an amazon Bedrock agent that can query an amazon Bedrock knowledge base backed by amazon OpenSearch Serverless as a vector store. An S3 bucket is created to store the knowledge base books.
Follow the steps of ai-cdk-constructs-samples/tree/main/samples/bedrock-agent” target=”_blank” rel=”noopener”>READ ME to clone the sample app to your account. The following diagram illustrates the architecture of the implemented solution.
Update ai-cdk-constructs-samples/blob/main/samples/bedrock-agent/lib/bedrock-agent-stack.ts#L66″ target=”_blank” rel=”noopener”>archive define which base model to use when creating the agent:
Follow the steps of ai-cdk-constructs-samples/tree/main/samples/bedrock-agent” target=”_blank” rel=”noopener”>READ ME to deploy the sample code to your account and ingest the sample documents.
Navigate to the Agents in the amazon Bedrock console in your AWS Region and locate your newly created agent. He AgentId
can be found in the outputs section of the CloudFormation stack.
Now you can ask some questions. You may need to tell the agent which book you want to ask about or refresh the session when asking about different books. The following are some examples of questions you can ask:
- What are the most popular books in the library?
- Who is Mr. Bingley quite taken with at the ball at Meryton?
The following screenshot shows an example of the workflow.
Don't forget to remove the CloudFormation stack to avoid unexpected charges. Delete all data from S3 buckets, then run the following command from a terminal:
Conclusion
amazon Titan Text Premier is available today in the US East (N. Virginia) region. The custom wrap for amazon Titan Text Premier is also available today in preview in the US East (N. Virginia) region. Please see the full list of regions for future updates.
For more information on the amazon Titan family of models, visit the amazon Titan product page. For pricing details, check out amazon Bedrock pricing. Visit the ai-cdk-constructs/tree/main” target=”_blank” rel=”noopener”>AWS Generative ai CDK builds a GitHub repository for more details on available builds and additional documentation. For practical examples to get you started, see the ai-cdk-constructs-samples” target=”_blank” rel=”noopener”>AWS Sample Repository.
About the authors
Alain Krok is a Senior Solutions Architect with a passion for emerging technologies. His past experience includes designing and implementing IIoT solutions for the oil and gas industry and working on robotics projects. He likes to push the limits and play extreme sports when he is not designing software.
Laith Al-Saadoon is a lead prototype architect on the Prototyping and Cloud Engineering (PACE) team. He creates prototypes and solutions using generative ai, machine learning, data analytics, IoT and edge computing, and end-to-end development to solve real-world customer challenges. In his personal time, Laith enjoys the outdoors: fishing, photography, drone flying, and hiking.
Justin Lewis leads the Emerging Technologies Accelerator at AWS. Justin and his team help clients build with emerging technologies like generative ai by providing open source software examples to inspire their own innovation. He lives in the San Francisco Bay Area with his wife and his son.
anupam dewan is a Senior Solutions Architect passionate about Generative ai and its real-life applications. He and his team train amazon Builders to build customer-facing applications using generative ai. He lives in the Seattle area and, outside of work, loves to hike and enjoy nature.