Skip to content

feat: add Nexus Gateway integration for expanded model access #662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,20 @@ lib/user-interface/react-app/src/graphql/subscriptions.ts
/.project
/.pydevproject
/outputs.json

# Hatch
.hatch/

# IDE
.idea/
.vscode/
*.swp
*.swo
.env*
.envrc.local
.env.local
node_modules
.amazonq
AmazonQ.md
.DS_Store
cdk-exports.json
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.18
99 changes: 35 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,53 @@
# Building RAG use cases with GenAI Chatbot on AWS
# AWS GenAI LLM Chatbot

[![Release Notes](https://img.shields.io/github/v/release/aws-samples/aws-genai-llm-chatbot)](https://github.com/aws-samples/aws-genai-llm-chatbot/releases)
[![GitHub star chart](https://img.shields.io/github/stars/aws-samples/aws-genai-llm-chatbot?style=social)](https://star-history.com/#aws-samples/aws-genai-llm-chatbot)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Enterprise-ready generative AI chatbot with RAG capabilities.

[![Deploy with GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://aws-samples.github.io/aws-genai-llm-chatbot/guide/deploy.html#deploy-with-github-codespaces)
## Overview

[![Full Documentation](https://img.shields.io/badge/Full%20Documentation-blue?style=for-the-badge&logo=Vite&logoColor=white)](https://aws-samples.github.io/aws-genai-llm-chatbot/)
The AWS GenAI LLM Chatbot is a production-ready solution that enables organizations to deploy a secure, feature-rich chatbot powered by large language models (LLMs) with Retrieval Augmented Generation (RAG) capabilities.

![sample](docs/about/assets/chabot-sample.gif "GenAI Chatbot on AWS")
## Key Features

- **Multiple LLM Support**: Amazon Bedrock (Claude, Llama 2), SageMaker, and custom model endpoints
- **Nexus Gateway Integration**: Connect to Nexus Gateway for additional model access
- **Comprehensive RAG Implementation**: Connect to various data sources for context-aware responses
- **Enterprise Security**: Fine-grained access controls, audit logging, and data encryption
- **Conversation Memory**: Full conversation history with persistent storage
- **Web UI and API Access**: Modern React interface and API endpoints for integration
- **Cost Optimization**: Token usage tracking and cost management features
- **Deployment Flexibility**: Multiple deployment options to fit your needs

## 🚀 NEW! Support for new Amazon Nova Models 🚀
### Deploy this chatbot to use the recently announced [Amazon Nova models](https://aws.amazon.com/blogs/aws/introducing-amazon-nova-frontier-intelligence-and-industry-leading-price-performance/)!
### These powerful models can __understand__ and __generate__ images and videos.
## Getting Started

Deploy this chatbot to experiment with:
- `Amazon Nova Micro`
- `Amazon Nova Lite`
- `Amazon Nova Pro`
- `Amazon Nova Canvas`
- `Amazon Nova Reels`
This blueprint deploys the complete AWS GenAI LLM Chatbot solution in your AWS account.

### Prerequisites

- AWS Account with appropriate permissions
- AWS CLI configured with credentials
- Node.js 18+ and npm
- Python 3.8+

Make sure to request access to the new models [here](https://aws-samples.github.io/aws-genai-llm-chatbot/documentation/model-requirements.html#amazon-bedrock-requirements)
### Deployment

Read more about the new models [here](https://www.aboutamazon.com/news/aws/amazon-nova-artificial-intelligence-bedrock-aws)
The deployment process is fully automated using AWS CDK and SeedFarmer.

---
## Architecture

The solution architecture includes:

This solution provides ready-to-use code so you can start **experimenting with a variety of Large Language Models and Multimodal Language Models, settings and prompts** in your own AWS account.
- Amazon Bedrock for LLM access
- Amazon OpenSearch for vector storage
- Amazon S3 for document storage
- Amazon Cognito for authentication
- AWS Lambda for serverless processing
- Amazon API Gateway for API access
- React-based web interface

Supported model providers:
## Documentation

- [Amazon Bedrock](https://aws.amazon.com/bedrock/) which supports a wide range of models from AWS, Anthropic, Cohere and Mistral including the latest models from Amazon Nova. See [Recent announcements](https://aws.amazon.com/blogs/aws/introducing-amazon-nova-frontier-intelligence-and-industry-leading-price-performance/) for more details.
- [Amazon SageMaker](https://aws.amazon.com/sagemaker/) self-hosted models from Foundation, Jumpstart and HuggingFace.
- Third-party providers via API such as Anthropic, Cohere, AI21 Labs, OpenAI, etc. [See available langchain integrations](https://python.langchain.com/docs/integrations/llms/) for a comprehensive list.
For complete documentation, visit the [GitHub repository](https://github.com/aws-samples/aws-genai-llm-chatbot).

# Additional Resources
## License

| Resource |Description|
|:-------------|:-------------|
| [Secure Messenger GenAI Chatbot](https://github.com/aws-samples/secure-messenger-genai-chatbot) | A messenger built on Wickr that can interface with this chatbot to provide Q&A service in tightly regulated environments (i.e. HIPAA). |
| [Project Lakechain](https://github.com/awslabs/project-lakechain) | A powerful cloud-native, AI-powered, document (docs, images, audios, videos) processing framework built on top of the AWS CDK. |
| [AWS Generative AI CDK Constructs](https://github.com/awslabs/generative-ai-cdk-constructs/) | Open-source library extension of the [AWS Cloud Development Kit (AWS CDK)](https://docs.aws.amazon.com/cdk/v2/guide/home.html) aimed to help developers build generative AI solutions using pattern-based definitions for their architecture. |
| [Artifacts and Tools for Bedrock](https://github.com/aws-samples/artifacts-and-tools-for-bedrock) | An innovative chat-based user interface with support for tools and artifacts. It can create graphs and diagrams, analyze data, write games, create web pages, generate files, and much more. |

# Roadmap

Roadmap is available through the [GitHub Project](https://github.com/orgs/aws-samples/projects/69)

# Authors

- [Bigad Soleiman](https://www.linkedin.com/in/bigadsoleiman/)
- [Sergey Pugachev](https://www.linkedin.com/in/spugachev/)

# Contributors
[![contributors](https://contrib.rocks/image?repo=aws-samples/aws-genai-llm-chatbot&max=2000)](https://github.com/aws-samples/aws-genai-llm-chatbot/graphs/contributors)

# License

This library is licensed under the MIT-0 License. See the LICENSE file.

- [Changelog](CHANGELOG.md) of the project.
- [License](LICENSE) of the project.
- [Code of Conduct](CODE_OF_CONDUCT.md) of the project.
- [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.

Although this repository is released under the MIT-0 license, its front-end and SQL implementation use the following third party projects:
- [psycopg2-binary](https://github.com/psycopg/psycopg2)
- [jackspeak](https://github.com/isaacs/jackspeak)
- [package-json-from-dist](https://github.com/isaacs/package-json-from-dist)
- [path-scurry](https://github.com/isaacs/path-scurry)

These projects' licensing includes the LGPL v3 and BlueOak-1.0.0 licenses.

# Legal Disclaimer

You should consider doing your own independent assessment before using the content in this sample for production purposes. This may include (amongst other things) testing, securing, and optimizing the content provided in this sample, based on your specific quality control practices and standards.
This project is licensed under the MIT-0 License.
122 changes: 122 additions & 0 deletions aws-genai-llm-chatbot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# AWS GenAI LLM Chatbot - SeedFarmer Blueprint

This directory contains the SeedFarmer blueprint (also known as a "capability" in Nexus terminology) for deploying the AWS GenAI LLM Chatbot solution.

## What is SeedFarmer?

[SeedFarmer](https://seed-farmer.readthedocs.io/) is a deployment framework designed to simplify the process of deploying complex AWS solutions across multiple accounts and regions. It provides a consistent way to define, deploy, and manage infrastructure using a hierarchical structure of deployments, groups, and modules.

> **Note:** In the Nexus ecosystem, the terms "blueprint" and "capability" are used interchangeably to refer to a SeedFarmer deployment configuration.

## Directory Structure

```
aws-genai-llm-chatbot/
├── assets/ # Visual assets and example configurations
│ ├── chatbot-icon.svg # Icon for the catalog listing
│ ├── chatbot-thumbnail.svg # Thumbnail for the catalog detail page
│ └── example-input.yaml # Example input parameters
├── modules/ # SeedFarmer modules
│ └── chatbot/ # Main chatbot module
│ ├── deployspec.yaml # Deployment instructions
│ └── module.yaml # Module definition
├── package/ # Package for Nexus integration
│ └── package/ # Nested directory required by Nexus
│ └── capability.yaml # Copy of capability.yaml for Lambda processing
├── capability.yaml # Blueprint definition for Nexus catalog
├── deployment.yaml # SeedFarmer deployment manifest
├── README.md # This file
└── seedfarmer.yaml # Project metadata
```

## File Descriptions

### capability.yaml

This file defines the blueprint for the Nexus catalog, including:
- Metadata: name, description, version
- Input parameters and their validation rules
- Deployment environments
- Labels for categorization

This is the primary file that determines how the solution appears in the Nexus catalog and what configuration options are available to users.

### deployment.yaml

The main SeedFarmer deployment manifest that defines:
- Deployment structure
- Target accounts and regions
- Module groups and their relationships
- Environment variable mapping

This file serves as the entry point for SeedFarmer when deploying the solution.

### seedfarmer.yaml

Contains project metadata:
- Project name and description
- Reference to README.md for documentation

This file provides additional context for the SeedFarmer deployment.

### modules/chatbot/module.yaml

Defines the chatbot module:
- Parameters passed from environment variables
- Output definitions for deployed resources
- Stack naming convention

This file specifies how the CDK stack should be deployed and what outputs should be collected.

### modules/chatbot/deployspec.yaml

Contains deployment instructions:
- Commands to execute during deployment
- Environment variable handling
- CDK deployment configuration
- Cleanup commands for destruction

This file is executed by SeedFarmer during the deployment process.

### assets/example-input.yaml

Provides an example configuration with:
- Sample values for all parameters
- Comments explaining each parameter
- Default values and recommendations

This file helps users understand how to configure the solution.

### assets/chatbot-icon.svg and assets/chatbot-thumbnail.svg

Visual assets for the Nexus catalog:
- Icon: Small image for the catalog listing
- Thumbnail: Larger image for the catalog detail page

These files enhance the visual presentation of the solution in the Nexus catalog.

## Deployment Process

When deployed through SeedFarmer or the Nexus catalog, the process follows these steps:

1. User selects the blueprint from the Nexus catalog
2. User configures parameters through the Nexus UI
3. SeedFarmer creates a deployment manifest based on these parameters
4. SeedFarmer deploys the modules in the specified order
5. Outputs are collected and made available to the user

## Key Parameters

The blueprint supports several configuration parameters:

- **Core Parameters**: PREFIX, BEDROCK_REGION, TARGET_ACCOUNT
- **Feature Flags**: BEDROCK_ENABLE, RAG_ENABLE, NEXUS_ENABLE
- **Security Options**: CREATE_CMKS, RETAIN_ON_DELETE
- **RAG Options**: RAG_OPENSEARCH_ENABLE
- **Nexus Integration**: NEXUS_GATEWAY_URL, NEXUS_AUTH_CLIENT_ID, etc.

## Additional Resources

- [SeedFarmer Documentation](https://seed-farmer.readthedocs.io/)
- [Nexus Blueprint Guide](https://nexus-3p-vending-d523f3.pages.aws.dev/)
- [AWS GenAI LLM Chatbot Documentation](https://github.com/aws-samples/aws-genai-llm-chatbot)
5 changes: 5 additions & 0 deletions aws-genai-llm-chatbot/assets/chatbot-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions aws-genai-llm-chatbot/assets/chatbot-thumbnail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions aws-genai-llm-chatbot/assets/example-input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# AWS GenAI LLM Chatbot Configuration
# --------------------------------
# This file contains the configuration parameters for the AWS GenAI LLM Chatbot deployment.
# Modify the values below to customize your deployment.

# Core parameters
# ------------------------------
TARGET_ACCOUNT: 123456789012 # Your AWS Account ID
PREFIX: chatbot # Prefix for all resources (max 16 chars)
BEDROCK_REGION: us-east-1 # AWS region for Amazon Bedrock

DEPLOYMENT_TYPE: default # Deployment type (default or custom)
RETAIN_ON_DELETE: false # Retain resources on delete
CREATE_CMKS: false # Create customer managed KMS keys

# Bedrock integration
# ------------------------------
BEDROCK_ENABLE: false # Enable Amazon Bedrock integration

# RAG capabilities
# ------------------------------
RAG_ENABLE: false # Enable RAG capabilities
# RAG_OPENSEARCH_ENABLE: true # Use OpenSearch as vector store
# RAG_AURORA_ENABLE: false # Enable Aurora as RAG engine
# RAG_KENDRA_ENABLE: false # Enable Kendra as RAG engine
# RAG_KENDRA_CREATE_INDEX: false # Create a new Kendra index
# RAG_KENDRA_ENTERPRISE: false # Use Kendra Enterprise edition
# RAG_KNOWLEDGE_BASE_ENABLE: false # Enable Knowledge Base as RAG engine
# RAG_CROSS_ENCODING_ENABLE: false # Enable cross-encoding for RAG

# Nexus integration (if needed)
# ------------------------------
NEXUS_ENABLE: false # Enable Nexus integration
# NEXUS_GATEWAY_URL: https://your-nexus-gateway.example.com # Nexus Gateway URL
# NEXUS_AUTH_CLIENT_ID: client-12345 # Nexus Auth Client ID
# NEXUS_AUTH_CLIENT_SECRET: secret-xyz # Nexus Auth Client Secret
# NEXUS_AUTH_TOKEN_URL: https://your-token-url.example.com # Nexus Auth Token URL
Loading