Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/api/providers/__tests__/bedrock-inference-profiles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,46 @@ describe("Amazon Bedrock Inference Profiles", () => {
const usModel = usHandler.getModel()
expect(usModel.id).toBe("us.anthropic.claude-3-sonnet-20240229-v1:0")
})

it("should prioritize global inference over cross-region inference when both are enabled", () => {
// When both global inference and cross-region inference are enabled,
// global inference should take precedence
const handler = createHandler({
awsUseCrossRegionInference: true,
awsUseGlobalInference: true,
awsRegion: "us-east-1",
apiModelId: "anthropic.claude-sonnet-4-20250514-v1:0", // Model that supports global inference
})

const model = handler.getModel()
// Should use global. prefix, not us. prefix
expect(model.id).toBe("global.anthropic.claude-sonnet-4-20250514-v1:0")
})

it("should fall back to cross-region inference when global inference is disabled", () => {
const handler = createHandler({
awsUseCrossRegionInference: true,
awsUseGlobalInference: false,
awsRegion: "us-east-1",
apiModelId: "anthropic.claude-sonnet-4-20250514-v1:0",
})

const model = handler.getModel()
// Should use cross-region prefix since global is disabled
expect(model.id).toBe("us.anthropic.claude-sonnet-4-20250514-v1:0")
})

it("should not apply global inference prefix to unsupported models even when enabled", () => {
const handler = createHandler({
awsUseCrossRegionInference: true,
awsUseGlobalInference: true,
awsRegion: "us-east-1",
apiModelId: "anthropic.claude-3-sonnet-20240229-v1:0", // Model that does NOT support global inference
})

const model = handler.getModel()
// Should fall back to cross-region prefix since model doesn't support global inference
expect(model.id).toBe("us.anthropic.claude-3-sonnet-20240229-v1:0")
})
})
})
6 changes: 1 addition & 5 deletions webview-ui/src/components/settings/providers/Bedrock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,17 @@ export const Bedrock = ({ apiConfiguration, setApiConfigurationField, selectedMo
{supportsGlobalInference && (
<Checkbox
checked={apiConfiguration?.awsUseGlobalInference || false}
disabled={apiConfiguration?.awsUseCrossRegionInference || false}
onChange={(checked: boolean) => {
// Enabling Global Inference should disable cross-region inference
// Global Inference takes priority over cross-region when both are enabled
setApiConfigurationField("awsUseGlobalInference", checked)
if (checked) setApiConfigurationField("awsUseCrossRegionInference", false)
}}>
{t("settings:providers.awsGlobalInference")}
</Checkbox>
)}
<Checkbox
checked={apiConfiguration?.awsUseCrossRegionInference || false}
disabled={apiConfiguration?.awsUseGlobalInference || false}
onChange={(checked: boolean) => {
setApiConfigurationField("awsUseCrossRegionInference", checked)
if (checked) setApiConfigurationField("awsUseGlobalInference", false)
}}>
{t("settings:providers.awsCrossRegion")}
</Checkbox>
Expand Down
Loading