npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@amazon-codecatalyst/blueprints.gen-ai-chatbot

v0.4.17

Published

Create your own private LLM playground in minutes with code you can instantly customize and deploy.

Downloads

656

Readme

Bedrock GenAI chatbot

This blueprint allows you to build, customize, and manage a chatbot using Anthropic’s LLM Claude, a model provided by Amazon Bedrock for generative AI. The chatbot supports multiple languages, content formats, conversation capabilities, and ability to monitor usage. You can set necessary permissions with IAM roles for a secure and login-protected LLM playground that can be customized to your data.

Bot conversation and bot personalization

You can personalize your chatbot through custom instructions and external knowledge that can be provided through URLs or files (for example, retrieval-augmented generation (RAG)). When a chatbot is created or updated, it pulls and breaks down data into text, and uses Cohere Multilingual to find and match the text to provide responses to user questions. The customized bot can be shared among application users.

Features

With this blueprint, you can modify your chatbot capabilities using chat features, customization capabilities, personal data, and usage tracking. The features besides IP address restriction are made available by default.

Basic chat features

  • Authentication (Sign-up, Sign-in)
  • Creation, storage, and deletion of conversations
  • Copying of chatbot replies
  • Automatic subject suggestion for conversations
  • Syntax highlighting for code
  • Rendering of Markdown
  • Streaming Response
  • IP address restriction (not available by default)
  • Edit message and resend
  • I18n
  • Model switch (Claude Instant / Claude)

Customized bot featuers

  • Customized bot creation
  • Customized bot sharing

Retrieval-augmented generation (RAG) features

  • Web (html)
  • Text data (txt, csv, markdown and etc)
  • PDF
  • Microsoft office files (pptx, docx, xlsx)
  • Youtube transcript

Admin features

  • Admin console to analyze user usage

Supported languages

The following languages are supported for a custom chatbot:

  • English
  • Japanese (日本語)
  • Korean (한국어)
  • Chinese (中文)
  • Français
  • Deutsch
  • Español

Deployment

After building your chatbot, you can also deploy it with this blueprint. Before a chatbot can be deployed with a CodeCatalyst workflow, you must enable model access.

To enable model access a chatbot

  1. Navigate to the AWS Management Console.
  2. From the region dropdown menu, choose the region where Amazon Bedrock will be called. This should be the same deployment region you choose under Additional configurations when creating a project in Amazon CodeCatalyst with the Bedrock GenAI chatbot blueprint.
  3. Navigate to Amazon Bedrock access.
  4. Choose Manage model access.
  5. Choose the checkboxes for Anthropic / Claude 3 Haiku, Anthropic / Claude 3 Sonnet and Cohere / Embed Multilingual.
  6. Choose Request model access.

Architecture

The architecture of this blueprint leverages AWS-managed services to minimize the need for infrastructure management. Integration of Amazon Bedrock eliminates the need to communicate with external APIs, which allows for scalable, reliable, and secure applications.

The following AWS services are integrated in the architecture:

Connections and permissions

This blueprint supports the Amazon CodeCatalyst development administrator role in IAM, which can be created from the AWS Management Console. The role can be used across multiple blueprints. An alternative option is creating a blueprint-specific IAM role by adding an existing IAM role to your CodeCatalyst space. For more information, see Adding an AWS account to a space and Adding IAM roles to account connections.

When using an existing IAM role, make sure it contains the CodeCatalyst trust policy, as well as the following permissions:

{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Effect": "Allow",
          "Action": [
            "iam:DeleteRole",
            "iam:GetRole",
            "iam:TagRole",
            "iam:CreateRole",
            "iam:AttachRolePolicy",
            "iam:DetachRolePolicy",
            "iam:DeleteRolePolicy",
            "cloudformation:*",
            "lambda:*",
            "apigateway:*",
            "ecr:*",
            "ssm:PutParameter",
            "ssm:DeleteParameter",
            "iam:PutRolePolicy",
            "s3:*",
            "ssm:GetParameter",
            "ssm:GetParameters",
            "bedrock:InvokeModel"
          ],
          "Resource": "*"
      },
      {
          "Effect": "Allow",
          "Action": [
              "sts:AssumeRole"
          ],
          "Resource": [
              "arn:aws:iam::*:role/cdk-*"
          ]
      }
  ]
}

The IAM roles also require the Amazon CodeCatalyst service principals codecatalyst.amazonaws.com and codecatalyst-runner.amazonaws.com.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "",
            "Effect": "Allow",
            "Principal": {
                "Service": [
                    "codecatalyst.amazonaws.com",
                    "codecatalyst-runner.amazonaws.com"
                ]
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

Additional resources

See the Amazon CodeCatalyst user guide for additional information on using the features and resources of Amazon CodeCatalyst. To learn more about blueprints, see the Project blueprint reference and Working with custom blueprints in CodeCatalyst.