Amazon Nova Model Cookbook

repository·main·Indexed 19 days ago

https://github.com/aws-samples/amazon-nova-samples

A collection of code examples and implementations for Amazon Nova models. It includes guides for real-time audio streaming (Sonic), Knowledge Base integration, meta-prompting via the nova-metaprompter package, and detailed pipelines for model distillation in Amazon Bedrock. Specific distillation recipes cover citation-aware question answering and function calling, featuring tools for dataset validation using dataset_validator.py and evaluation frameworks like the Berkeley Function Calling Leaderboard (BFCL).

Tokens
305.2K
Snippets
753
Records
1.2K
Agent score
66%

What's inside amazon-nova-samples

  1. Overview of Amazon Nova 2.0 models

    main

    Amazon Nova 2.0 models provide multimodal capabilities. The amazon.nova-2-lite-v1:0 model supports Text, Image, and Video for both input and output modalities. It features a 1M context window and supports up to 64K max output tokens. It is compatible with various document formats including pdf, csv, doc, docx, xls, xlsx, html, txt, and md.

    Key features include support for the Converse API, InvokeAPI, Streaming, Batch Inference, Fine Tuning, Bedrock Knowledge Bases, Bedrock Agents, and Bedrock Prompt flows.

    Model ID: amazon.nova-2-lite-v1:0
    Input modalities: Text, Image, Video
    Output Modalities: Text, Image, Video
    Context Window: 1M
    Max Output Tokens: 64K
  2. Overview of the Citation-Aware Model Distillation Pipeline

    main

    The Citation-Aware Model Distillation Pipeline is a four-stage process designed to distill knowledge from large language models (LLMs) into smaller, specialized models specifically for citation-aware question answering. The goal is to create efficient models that maintain high-quality citation capabilities.

    The pipeline follows these four stages:

    1. Data Preparation: Preparing datasets (like SQuAD v2.0) with structured XML formats.
    2. Model Distillation: Transferring knowledge from a teacher model to a student model.
    3. Batch Inference: Running large-scale inference with robust error handling.
    4. Evaluation: Assessing citation quality using specific metrics like coverage, correctness, and faithfulness.
  3. Overview of Bedrock NotebookLM

    main

    Bedrock NotebookLM is a tool inspired by NotebookLM that uses AWS Bedrock LLMs and AWS Polly text-to-speech models to transform content into audio podcasts. It processes PDF and video files to generate natural, engaging dialogues and outputs the final result as an MP3 file.

    Core Capabilities:

    • PDF to Podcast: Convert uploaded PDF content into a podcast dialogue.
    • S3 Integration: Process documents stored directly in Amazon S3.
    • Video Processing: Upload video files to use as source content for the podcast.
    • Gradio Interface: Provides a user-friendly web interface for interaction.
  4. Overview of Nova CLI Utility Modules

    main

    The Nova CLI utility is an experimental toolset designed to manage the machine learning model lifecycle through specialized modules. Each module targets a specific stage of the ML workflow, from data preparation to deployment.

    Available Modules

    • 001 Data Preparation Module: Used for preparing and validating datasets. It handles data validation, formatting, transformation, and JSONL processing to ensure compatibility with Nova.
    • 002 Tuner Module: Used for fine-tuning and optimizing models via hyperparameter optimization and training configuration.
    • 003 Model Analysis Module: Used to inspect model artifacts and analyze training results and performance metrics.
    • 004 Evaluation Module: Used for comprehensive model evaluation, including metrics calculation, visual analysis, and format conversion of results.
    • 005 Model Export Module: Used for exporting models to different platforms and performing platform-specific packaging.
    • 006 Custom Model BR Inferencer Module: Used for executing custom model inference, implementing custom logic, and handling inference logging.
  5. Overview of Amazon Nova 1.0 models

    main

    Amazon Nova 1.0 offers a range of models from Premier to Micro, varying in modality support, context window, and performance.

    • Amazon Nova Premier (us.amazon.nova-premier-v1:0): Full multimodal (Text, Image, Video) input/output with a 1M context window.
    • Amazon Nova Pro (us.amazon.nova-pro-v1:0): Multimodal input (Text, Image, Video) with Text output and a 300k context window.
    • Amazon Nova Lite (us.amazon.nova-lite-v1:0): Multimodal input (Text, Image, Video) with Text output and a 300k context window.
    • Amazon Nova Micro (us.amazon.nova-micro-v1:0): Text-only input and output with a 130k context window.

    Note: For models with large context windows, degradation may occur past 200k tokens (approx. 150K words, 65 documents, or 20min of video).

    | Model Characteristics      | Amazon Nova Premier                          | Amazon Nova Pro                                 | Amazon Nova Lite                             | Amazon Nova Micro                                |
    | -------------------------- | -------------------------------------------- | ----------------------------------------------- | --------------------------------------------- | ------------------------------------------------- |
    | Model ID                   | us.amazon.nova-premier-v1:0                  | us.amazon.nova-pro-v1:0                         | us.amazon.nova-lite-v1:0                     | us.amazon.nova-micro-v1:0                         |
    | Input modalities           | Text, Image, Video                           | Text, Image, Video                              | Text, Image, Video                            | Text                                             |
    | Output Modalities          | Text                                         | Text                                            | Text                                          | Text                                             |
    | Context Window             | 1M                                           | 300k                                            | 300k                                          | 130k                                             |
    | Max Output Tokens*         | 10K                                          | 5k                                              | 5k                                            | 5k                                               |
  6. Overview of Multimodal Document Search Open Source Framework

    main
    This framework enables searching through documents that contain multiple types of media—such as text, images, and presentations—using natural language queries. It allows for cross-modal retrieval, meaning you can use a text query to find relevant images or documents, or vice versa, by leveraging multimodal embeddings.
  7. Overview of Visual Product Search with Image-Text Embeddings

    main

    This pattern enables e-commerce customers to search for products using either images or text descriptions. By leveraging multimodal embeddings, the system can find visually and semantically similar items within a product catalog.

    Supported Modalities:

    • Images: Users can upload a photo to find similar products.
    • Text: Users can type descriptions to find matching items.

    Core AWS Architecture:

    • Amazon Bedrock: Uses the Nova Multimodal Embedding model to generate embeddings for both image and text inputs.
    • Amazon S3: Used for storing the product catalog.
    • Vector Storage: Employs either Amazon S3 Vectors or Amazon OpenSearch Serverless as the vector database to perform similarity searches.
  8. Overview of Amazon Nova Act

    main
    Amazon Nova Act is an AI-powered browser automation tool designed for adaptive UI testing. Unlike traditional automation that relies on hardcoded DOM selectors (e.g., #submit-btn), Nova Act uses natural language instructions and visual context to interact with web elements. This allows tests to remain resilient even when UI structures change, such as when IDs are refactored, labels are updated, or elements are reordered.
  9. Overview of Amazon Nova Lite 2.0 Agent Samples

    main

    This sample demonstrates how to use Amazon Bedrock Nova Lite 2.0, a large language model (LLM) optimized for complex reasoning and agentic applications, with popular agent frameworks.

    A primary implementation provided is an Academic Paper Analysis agent using the LangGraph ReAct pattern. This agent uses specific tools to:

    • Load and parse PDF documents
    • Summarize papers
    • Extract research questions
    • Extract key results and findings
    • Identify research gaps and future work

    Key technical features include LangGraph implementation of the ReAct pattern, PDF text extraction, and structured JSON outputs for research analysis.

  10. Overview of the Email Assistant with Strands Agents SDK

    main

    The Email Assistant is a multi-agent system built using the Strands Agents SDK and a Streamlit interface. It leverages specialized agents to provide context-aware email assistance, including image generation, audio-based information retrieval, and professional composition.

    Core Agents

    • Image Agent: Generates images based on user descriptions and manages files.
    • Audio RAG (Retrieval-Augmented Generation): Uses Bedrock Data Automation (BDA) to parse audio content (e.g., Amazon earnings calls) and answer queries based on that audio knowledge base.
    • Email Assistant Agent: The primary orchestrator that uses web search, Audio RAG, and Image Generation to compose professional emails.
    • Report Writing Agent: Specialized in systematic planning and report generation.
  11. Overview of Nova Act Tool Integration Patterns

    main

    This tutorial series demonstrates production-ready patterns for integrating tools into Nova Act workflows using the @workflow decorator. Workflows defined here can be packaged into containers and deployed to the AgentCore runtime.

    Key integration patterns covered include:

    • Model Context Protocol (MCP): Standardizing tool discovery and invocation via servers (e.g., connecting to an AWS Documentation server).
    • AgentCore Gateway: Centralized enterprise tool management, providing discovery, authentication, and governance.
    • Security Guardrails: Implementing URL-based access controls and state guardrails to manage tool permissions.