- Rust struct data model for
bedrock::InvokeModel
Amazon Nova text and Canvas models, including image/video input. - Rust struct data models for
bedrock::Converse
with support for image, video, and docuemnt input, and basic support for tool usage. - CLI references using the libraries (no tool usage)
clones and unwraps like crazy
$ cargo build
$ PATH=$PATH:./target/debug/
$
$ nova --help # interact with Amazon Nova text models
$ nova --verbose --aws-profile bedrock --system "you are a pirate" --assistant "Here is a rhyming answer:" "What should I have for dinner?"
$
$ canvas --help # interact with Amazon Canvas
$ canvas --negative "lily pads" "swan lake"
$
$ converse --help # Have an interactive conversation with the model of your choice
$ converse -v -aws-profile bedrock -s "system prompt for the entire conversation"
$
$ models --help # List foundational models with on demand invocation support
$ models anthropic
You must have Rust installed.
To use, you need to have access to an AWS account so you can interact with Amazon Bedrock. Additionally, you must request and obtain access to the Bedrock models you're interested in using.
You must also have access to Bedrock. One way to set this up is to get an IAM user with BedrockFullAccess
and store their credentials in a [default]
profile under ~/.aws/credentials
. The tooling also supports
overriding the default profile name via the --aws-profile
option.
- There are calls to
unwrap
abound, so if something goes wrong, behavior is often a panic. If this becomes anything serious will need to get serious about gracefully handling Error conditions. - Add RAG support via RetrieveAndGenerate
- Create a separate CLI that demonstrates tool usage (e.g. canvas can be the tool).
- Submit issue for shellfish/clap issue where the
shellfish
crate currently doesn't work with clap 4.x, since theclap_command
macro callsCommandFactory::into_app
from 3.x
The error with 4.x:
error[E0576]: cannot find method or associated constant `into_app` in trait `clap::CommandFactory`
--> src/cli/gen/main.rs:44:26
|
44 | .insert("greet", clap_command!((), GreetArgs, greet));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `clap::CommandFactory`
|
= note: this error originates in the macro `clap_command` (in Nightly builds, run with -Z macro-backtrace for more info)
InvokeModel
is Bedrock's low-level invocation API. It takes a model-id and a body, which is a freeform json document that's model specific.Converse
is Bedrock's normalized invocation API, which uses a common data model for invoking across models. Not all models can be invoked with converse, and for those that can not all features are supported.RetrieveAndGenerate
is Bedrock's RAG implementation that queries a knowledge base to aid in generation results. There is also aRetrieve
API that only queries the knowledge base and leaves the rest up to the developerhttps://docs.rs/aws-sdk-bedrockagentruntime/latest/aws_sdk_bedrockagentruntime/struct.Client.html#method.retrieve_and_generate.
- Bedrock Rust SDK (crate)
- Bedrock API Reference
- Bedrock User Guide
- [Nova User Guide][https://docs.aws.amazon.com/nova/latest/userguide/]
- APIs
- Amazon Bedrock: Control plane, including batch job invocation and management.
- Amazon Bedrock Rutime: Data plane for individual model invocation/conversing, including async invoke. Also includes guardrail application.
- Agents for Amazon Bedrock: Agent Control plane, including flow APIs and knowledge base APIs
- Agents for Amazon Bedrock Runtime: Agent Data plane, including flow APIs