4 releases (2 breaking)

0.4.1 Aug 16, 2024
0.4.0 Aug 16, 2024
0.3.0 Aug 10, 2024
0.2.0 Aug 10, 2024

#415 in Command line utilities

Custom license

57KB
1K SLoC

Bedrock Assistant / Artifact written in Rust

A CLI assistant (chat tool) written in Rust powered by AWS Bedrock Converse API with the following capabilities.

Capability Description Status
Chat Chat with Claude Available
Image Generation Generate image from prompt Available
Code Interpreter Running python code to accomplish data analysis and math tasks Available
Image variation Generate image variation based on existing images Coming Soon
Web Search Retrieve data from Web Coming Soon
Artifact Content and App Visualization Coming Soon

Install

This tool can be installed using cargo install bedrock_assistant.

For further details, please refer to cargo crate.io.

Requirements

  • AWS Account with Bedrock enabled
    • Default region: us-east-1
  • Give model access to the models you are planning to use
    • Default Chat Model ID: anthropic.claude-3-haiku-20240307-v1:0
    • Default Image Generation Model ID: amazon.titan-image-generator-v1
  • Set up AWS CLI
    • If you use SAML for your AWS account, consider setting up using saml2aws.

Optional Set up

  • If a different chat model, image generation model, or region other than the default one need to be used, add the following environment variable to your system.
  • For Chat Model: BEDROCK_CHAT_MODEL_ID
  • For Image Generation Model: BEDROCK_IAMGE_MODEL_ID
  • For Region: BEDROCK_REGION

Usage

  • Sign in through AWS Command Line Interface
  • To start the app: run bedrock_assistant in the terminal.
    • This app streams by default. To disable the streaming behavior, pass in --non-stream argument.
  • To chat: type in your message and press enter or return.
  • To exit the app: press ESC or Ctrl+C.

Image generation

Example queries for image generation:

  • Generate a cute hello world image in the test folder.
  • Generate 2 mathematics image of size 1024 * 1024 in the current folder.

Available configuration for the image to generate:

  • Number of images: max of 5. Default to 1.
  • Quality: standard or premium. Default to standard.
  • height: The height of the image in pixels. Default to 512 pixels.
  • width: The width of the image in pixels. Default to 512 pixels.

For more details on the parameters, check out Bedrock official document.

Code Interpreter

This app uses python3.11 by default for data analysis, data exploration, math, and etc.
Either add python3.11 to your path, or you can configure the executable python path using the environment variable BEDROCK_ASSISTANT_PYTHON.

For example, if you want to use python3.12 at a specific path.

export BEDROCK_ASSISTANT_PYTHON="/opt/homebrew/bin/python3.12"

Do NOT use alias as it will not be recognized by rust.

Example queries for code interpreting:

  • Draw a graph of y=x

The code and any aritifacts/files generated by the code will be save to the current working directory by default, but you can also specify where you want those to be saved like following.

  • Draw a graph of y=x and save the result in test folder

Libaraies you might want to install in your global environment: - pandas - numpy - matplotlib - seaborn - scikit-learn - diagrams

Other libraries may also be used.

Read File

Example queries for questioning regarding files:

  • Summarize the content in ./test/test.pdf.

Demo

App Demo

Coming Soon

Here are some of the tools/capabilities I am currently working on.

  • Image variation
  • artifacts for content and app visualization (HTML, Javascript, React)

If you have any other suggestiont, leave me a cooment, I would be happy to know!

Dependencies

~20–31MB
~486K SLoC