Repository navigation
Conversation
Bedrock serves Claude and OpenAI GPT-6 only through cross-region inference profiles, so filtering the catalog to ON_DEMAND hid them from model discovery. List those chat models under their active system-defined profile ids; keep embedding models on-demand only, and fall back to the on-demand list when the credential cannot list inference profiles. Closes infiniflow#20162
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughBedrock model discovery now includes eligible profile-only chat models by listing active system-defined inference profiles. On-demand models and supported embeddings remain listed by foundation-model ID. If profile lookup fails, profile-only models are omitted and eligible on-demand models remain available. ChangesBedrock model discovery
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant ListModels
participant controlPlaneGET
participant BedrockControlPlane
ListModels->>controlPlaneGET: Get foundation-model catalog
controlPlaneGET->>BedrockControlPlane: GET foundation-models
BedrockControlPlane-->>ListModels: Catalog response
ListModels->>controlPlaneGET: Get profiles when profile-only chat models exist
controlPlaneGET->>BedrockControlPlane: GET inference-profiles with pagination
BedrockControlPlane-->>ListModels: Active profile summaries
ListModels-->>ListModels: Return eligible model and profile IDs
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change adds inference-profile-only chat models while retaining existing on-demand listings when profile lookup fails. No concrete merge-blocking issue is established; live regional checks remain outstanding. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Discovery now offers cross-region inference options while retaining request authentication and permission-failure behavior. No authorization bypass was established, but deployment-specific access and data-residency policies remain unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks the model list, Comment |
kimnamu
left a comment
There was a problem hiding this comment.
Thanks for porting this to the Go driver, and for carrying over the embedding exclusion and the 403 fallback as well.
I ran the one unchecked item in your test plan, a live check with a Bedrock API key in us-east-1, us-west-2 and eu-west-1, against a4710ac. It behaves as described, and I don't have any changes to suggest.
ListModels, Bedrock API key |
us-east-1 | us-west-2 | eu-west-1 |
|---|---|---|---|
| Models listed, main → this PR | 51 → 116 | 51 → 118 | 33 → 80 |
| Claude ids, main → this PR | 0 → 28 | 0 → 28 | 0 → 26 |
| GPT-6 Sol/Luna/Astra | us. and global. |
us. and global. |
global. only |
| Entries from main still listed with the same types | ✅ 51/51 | ✅ 51/51 | ✅ 33/33 |
| Embedding models | ✅ unchanged | ✅ unchanged (cohere.embed-v4:0 is INFERENCE_PROFILE only here and stays out) |
✅ unchanged |
$ go test -run 'TestBedrockListModels|TestBedrockCheckConnection' ./internal/entity/models/
bedrock.go from main: --- FAIL: TestBedrockListModelsListsInferenceProfileOnlyModels
bedrock_test.go:607: len(got)=1 want 4
this PR: 4 passed
ChatWithMessages with ids from the new list (API key):
us-east-1 us.anthropic.claude-haiku-4-5-20251001-v1:0 -> "pong"
us-east-1 global.anthropic.claude-opus-5-5 -> "pong"
eu-west-1 eu.anthropic.claude-sonnet-4-5-20250929-v1:0 -> "pong"
us-east-1 us.openai.gpt-6-sol -> "pong"
eu-west-1 global.openai.gpt-6-luna -> "pong"
us-east-1 anthropic.claude-haiku-4-5-20251001-v1:0 (bare id, for contrast)
-> status 400: Invocation of model ID anthropic.claude-haiku-4-5-20251001-v1:0 with on-demand throughput isn’t supported.
Other checks
- SigV4 (
assume_rolethrough a local profile) returns the same three lists as the API key, so the signedtypeEquals=SYSTEM_DEFINED&maxResults=1000query is accepted. go test ./internal/entity/models/: 912 passed, 1 skipped. I left out two tokenizer tests that need the cl100k table, which my machine doesn't have; they fail the same way without this PR.go vetandgofmt -lare clean.- Unchanged from main and outside this PR: an empty
inferenceTypesSupportedstill counts as on-demand, someta.llama3-3-70b-instruct-v1:0:128k(us-west-2,[]) stays listed, and Converse answers it with 404Model not found.
|
Duplicated with #20163 |
|
@yuzhichang thanks for going through the Bedrock threads. I think this one is a different fix from #20163, though. #20163 went into Would you be open to reopening this PR and #20162? They were closed together, so nothing on |
Summary
Closes #20162.
When you list Bedrock models, the Go driver drops every model that does not support
ON_DEMAND(internal/entity/models/bedrock.go). Bedrock serves Claude and the OpenAI GPT-6 models only through cross-region inference profiles, so they never appear. In API-key mode the add-model form shows this list in place of a model-name field, which leaves these models reachable only through "+ custom model". Invoking the bare id fails anyway:Invocation of model ID openai.gpt-6-sol with on-demand throughput isn't supported.#20163 fixed this in
rag/llm/model_meta.py, which has since been removed frommain(#20289). The Go driver is now the only path, and it still has the filter. This PR applies the approach from the issue to the Go driver.Change
ON_DEMAND,ListModelsalso readsGET /inference-profiles?typeEquals=SYSTEM_DEFINED, followingnextToken. It maps each active profile back to its foundation model throughmodels[].modelArn, then lists that model under its profile ids (us.anthropic.claude-…,global.openai.gpt-6-sol).ON_DEMANDare listed exactly as before. A catalog that has no profile-only chat model sends no extra request, soCheckConnectionstill makes a single call.Embedchooses the request body from the bareamazon./cohere.prefix, so a profile id such asus.cohere.embed-v4:0would be rejected.bedrock:ListInferenceProfiles, the driver logs a warning and returns the on-demand list as before.Test plan
TestBedrockListModelsListsInferenceProfileOnlyModels: profile-only chat models are listed under their active profile ids across two pages. An inactive profile and a profile-only embedding model are left out. Fails onmain(len(got)=1 want 4), passes with this change.TestBedrockListModelsKeepsOnDemandModelsWhenProfilesUnavailable: a 403 on/inference-profilesstill returns the on-demand list.bash build.sh --test ./internal/entity/models/passes, including the existingTestBedrockListModelsParsesCatalogandTestBedrockCheckConnectionDelegates.