From the course: Secure Generative AI with Amazon Bedrock

Foundation models (FMs) supported by Amazon Bedrock

From the course: Secure Generative AI with Amazon Bedrock

Foundation models (FMs) supported by Amazon Bedrock

- [Instructor] Amazon Bedrock offers a wide choice of Foundation Models, from leading artificial intelligence startups and Amazon itself. Each of these FMs cater to different generative artificial intelligence or gen AI use cases, such as summarization, language translation, coding, and image generation. Amazon Titan is the family of models built by Amazon that are pretrained on large data sets, which makes them powerful general-purpose models. Titan Text for text summarization and Titan Embeddings for embeddings and search. Jurassic-2 from AI21 Labs is multilingual large language models for text generation in Spanish, French, German, Portuguese, Italian, and Dutch. They are used for natural language processing to generate text in a variety of different languages. Claude 2 from Anthropic is LLM for thoughtful dialogue, content creation, complex reasoning, creativity, and coding based on Constitutional AI and harmlessness training. They are built with our latest research on responsible AI to perform conversational and text processing task. Command and Embed from Cohere is that text generation model for business applications such as summarization, copywriting, dialogue, extraction, and question answering, and embeddings model for search clustering or classification in more than a hundred languages. Fine-tuned versions of LLaMA 2 models from Meta are ideal for dialogue use cases. Bedrock also supports Stability AI's Foundation Models including the widely popular is Stable Diffusion model, which is capable of generating unique, high quality images, logos, arts and design. To interact with Foundation Model, you can configure the inference parameters to customize the FM response. Generally, you should only adjust one parameter at a time, and the results can vary depending on the Foundation Model. The inference parameters can be used to modify the output from the LLMs. Not all parameters are available with all LLMs. To control randomness and diversity in the response, we have temperature controls randomness in word choice. Lower values lead to more predictable responses. Top K limits word choices to the K most probable options. Lower values reduced unusual responses. And Top P cuts off low probability word choices based on cumulative probability. To control the length of the generated response, we have response length. It sets the minimum and maximum token counts. It sets a hard limit on response size. Then we have length penalty, which encourages more concise responses by penalizing longer ones, it sets a soft limit on size. Stop sequences include specific character combinations that signal the model to stop generating tokens when encountered. It is used for the early termination of responses. Amazon bedrock APIs provide a list of APIs you can access in your respective notebooks and Lambda functions. To access Amazon Bedrock, let's explore Amazon Bedrock configuration and runtime related APIs. ListFoundationModels. This method is used to provide a list of Amazon Bedrock Foundation Models that you can use. The following example, demonstrate how to list the base models using Python. For information about Amazon Bedrock runtime APIs, we have InvokeModel. InvokeModel API invokes the specified Amazon Bedrock model to run inference using the input provided in the request body. You use InvokeModel to run inference for text models, image models, and embedding models. The following example details how to generate text with Python using the prompt, "What is Amazon Bedrock?" InvokeModelWithResponseStream API invokes the specified Amazon Bedrock model to run inference using the input provided. It returns the response in a stream. The example details how to generate streaming text with Python. It uses the Amazon Titan TG-1 Large model and the prompt, "Write an essay for living on Mars using 10 sentences."

Contents