feat(py/plugins/amazon-bedrock): finish the sample app and README - #6048
feat(py/plugins/amazon-bedrock): finish the sample app and README#6048hilariie wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request expands the Amazon Bedrock plugin for Genkit Python by adding comprehensive documentation, live tests, and sample flows for advanced features including vision/document input, prompt caching, image generation, and reranking. The review feedback focuses on improving robustness: specifically, using the standard response.text property in tests to avoid potential AttributeErrors when accessing message content, and safely handling potential None values during text part concatenation in the sample application to prevent TypeErrors.
7f2c670 to
14eb853
Compare
14eb853 to
f582c13
Compare
f582c13 to
fac97c2
Compare
cabljac
left a comment
There was a problem hiding this comment.
Docs check out against the code. Options table, inference-profile prefixes, embedder table and the cache-token behaviour all match what the plugin actually does, and the sample's flows line up with the core API. One thing inline.
cabljac
left a comment
There was a problem hiding this comment.
Approving. The quick-start model ID is worth fixing before this merges, since it's the first thing a new user copies, but it's a two-line change and nothing else needs to block on it.
… rerank flows to the sample Covers the surfaces the sample was missing: prompt caching, image and document input, image generation, and reranking. Rerank is a plugin method rather than an action, so the sample now keeps the Bedrock instance. Adds live tests for the three paths that had none: Converse image input, document input, and a cache read.
Covers the five new flows, switches the suggested region to us-west-2 since it runs all but one of them, and registers the sample in the samples index. summarize_pdf runs on Claude rather than the Nova default: document support is per model, and Claude is what the Go plugin's document example uses.
…roubleshooting docs Prompt caching was exported but documented nowhere. The rest is the AWS onboarding the Go README carries and this one lacked: model access, IAM, credentials, the plugin options, inference profiles, and the error codes. The IAM policy adds the inference-profile resource the Go one omits. Without it every us. model ID fails with AccessDeniedException. The invalid-model ValidationException entry is verified live: both Converse and InvokeModel report a model missing from the region that way, not as ResourceNotFound.
…k start Sonnet 4.5 has no on-demand throughput, so the bare ID fails on the first call.
fac97c2 to
5778077
Compare
|
Why
This is slice 8 of #5820, stacked on #6046
Changes
The sample gains five flows, matching the Go repo's example coverage: describe_image, summarize_pdf, prompt_caching, generate_image, and rerank. Rerank is a method on the plugin instance (Python core has no reranker primitive), so the sample now keeps a reference to the Bedrock it passes to Genkit, the pattern the plugin README documents. The image and PDF inputs are inline constants (a 64x48 striped PNG, a 722-byte PDF). summarize_pdf runs on Claude since document support is per model, and Claude is what the Go plugin's own document example uses.
Three env-gated live tests cover the paths that had none: Converse image input, document input, and a cache read.
The plugin README gains AWS setup (model access, IAM, credentials), a plugin options table, inference profiles, prompt caching, and troubleshooting. The IAM policy adds the inference-profile resource the Go README omits; without it
every
usmodel ID fails with AccessDeniedException. Troubleshooting also documents, verified live, that a model missing from the calling region fails as "ValidationException: The provided model identifier is invalid" on both Converse and InvokeModel, not as ResourceNotFoundException.The sample README covers the new flows and now suggests us-west-2, as it is the only region with active text-to-image models, it has both rerank models, and it runs everything here except the us-east-1-only Nova 2 embedder. The sample
also gets its missing row in samples/README.md.
Dev UI Screenshots