Skip to content

feat(py/plugins/amazon-bedrock): finish the sample app and README - #6048

Open
hilariie wants to merge 7 commits into
py-bedrock-rerankfrom
py-bedrock-sample
Open

feat(py/plugins/amazon-bedrock): finish the sample app and README#6048
hilariie wants to merge 7 commits into
py-bedrock-rerankfrom
py-bedrock-sample

Conversation

@hilariie

Copy link
Copy Markdown
Contributor

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 us model 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

Screenshot 2026-08-13 at 10 42 11 Screenshot 2026-08-13 at 10 44 23 Screenshot 2026-08-13 at 10 44 52 Screenshot 2026-08-13 at 10 46 08 Screenshot 2026-08-13 at 11 08 31

@hilariie
hilariie requested a review from cabljac August 13, 2026 11:12
@github-actions github-actions Bot added docs Improvements or additions to documentation python Python labels Aug 13, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread py/packages/genkit-amazon-bedrock/tests/live_test.py Outdated
Comment thread py/packages/genkit-amazon-bedrock/tests/live_test.py Outdated
Comment thread py/samples/amazon-bedrock-sample/src/main.py Outdated

@cabljac cabljac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread py/packages/genkit-amazon-bedrock/README.md

@cabljac cabljac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@hilariie

Copy link
Copy Markdown
Contributor Author
  • Quick start now uses us.anthropic.claude-sonnet-4-5-20250929-v1:0
  • The rebase surfaced a stale Plugin options table. It listed the old hardcoded client defaults and was missing total_timeout. Those knobs are all unset now and fall back under your AWS config, so the table says that instead.
  • Dropped the leftover Go comparisons from the docs and comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation python Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants