Skip to main content

No project description provided

Project description

Bedrock Bot

This project is a basic CLI-based chat bot that uses Bedrock to resolve questions. It can take input from stdin, CLI arguments or interactively when no parameters have been passed.

Installation

  1. pip install bedrock-bot
  2. You will also need some AWS credentials available in your shell (any usual way works - CLI configured IAM user access key/secret keys, environment variables, etc)
  3. Bedrock requires you to opt in to models in order to use them

Usage

bedrock --help
Usage: bedrock [OPTIONS] [ARGS]...

Options:
  -r, --region TEXT               The AWS region to use for requests
  -m, --model [Claude-3-Haiku|Claude-3-Sonnet]
                                  The model to use for requests
  --help                          Show this message and exit.

Directly as a chat bot:

$ bedrock

Hello! I am an AI assistant powered by Amazon Bedrock and using the model Claude-3-Haiku. Enter 'quit' or 'exit' at any time to exit. How may I help you today?
(You can clear existing context by starting a query with 'new>' or 'reset>')

> Hi, what is your name?
My name is Claude.

Using CLI arguments:

$ bedrock "Hi, what is your name?"

Hello! I am an AI assistant powered by Amazon Bedrock and using the model Claude-3-Haiku. Enter 'quit' or 'exit' at any time to exit. How may I help you today?
(You can clear existing context by starting a query with 'new>' or 'reset>')

> Hi, what is your name?
My name is Claude. It's nice to meet you!

Using stdin (Note that you can only use this for one-shot questions as input is reserved by your pipe to stdin and is not an interactive TTY any more):

$ echo "Hi, what is your name?" > input-file

$ cat input-file | bedrock
Hello! I am an AI assistant powered by Amazon Bedrock and using the model Claude-3-Haiku. Enter 'quit' or 'exit' at any time to exit. How may I help you today?
(You can clear existing context by starting a query with 'new>' or 'reset>')

> Hi, what is your name?

My name is Claude. I'm an AI created by Anthropic. It's nice to meet you!                                                         


Note that you can only do one-shot requests when providing input via stdin

Shell auto-complete

Shell auto-complete is also supported.

ZSH

  1. _BEDROCK_COMPLETE=zsh_source bedrock > ~/.bedrock-completion.zsh
  2. Add the following to your ~/.zshrc: source ~/.bedrock-completion.zsh

Bash

  1. _BEDROCK_COMPLETE=bash_source bedrock > ~/.bedrock-completion.bash
  2. Add the following to your ~/.bashrc: source ~/.bedrock-completion.bash

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bedrock_bot-1.0.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

bedrock_bot-1.0.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file bedrock_bot-1.0.3.tar.gz.

File metadata

  • Download URL: bedrock_bot-1.0.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.14 Linux/6.5.0-1018-azure

File hashes

Hashes for bedrock_bot-1.0.3.tar.gz
Algorithm Hash digest
SHA256 67b5eef4ea75ac2809251d6e601c217b819da3e1e7c62922d5978f3a62fdba0c
MD5 91e3e9c1f9df189cc1927dfa719e075d
BLAKE2b-256 c853807f51343de84db57ed739a89b185a704a3051077ab6a2883a8ea36c1a73

See more details on using hashes here.

File details

Details for the file bedrock_bot-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: bedrock_bot-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.14 Linux/6.5.0-1018-azure

File hashes

Hashes for bedrock_bot-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 92d006d8bff9dc0dc36e076d04614cdcd2570940c69434a348f94a0062b264b0
MD5 819e402b2b42aba5da3971be258d623c
BLAKE2b-256 25df4a084823bb883679a6b1d9c7e52c660d63d7500eed038fa67e89a2c0abaf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page