




















@@ -9,14 +9,9 @@ import {
99} from "openclaw/plugin-sdk/plugin-test-runtime";
1010import { withEnvAsync } from "openclaw/plugin-sdk/test-env";
1111import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest";
12-import { setAwsSharedIniFileLoaderForTest } from "./aws-credential-refresh.js";
1312import { supportsBedrockPromptCaching } from "./bedrock-options.js";
1413import { resetBedrockDiscoveryCacheForTest } from "./discovery.js";
1514import amazonBedrockPlugin from "./index.js";
16-import {
17-resetBedrockAppProfileCacheEligibilityForTest,
18-setBedrockAppProfileControlPlaneForTest,
19-} from "./register.sync.runtime.js";
20152116type BedrockClientResult =
2217| {
@@ -96,6 +91,10 @@ vi.mock("@aws-sdk/client-bedrock", () => {
9691};
9792});
989394+vi.mock("@smithy/shared-ini-file-loader", () => ({
95+loadSharedConfigFiles: refreshSharedConfigCache,
96+}));
97+9998type RegisteredProviderPlugin = Awaited<ReturnType<typeof registerSingleProviderPlugin>>;
10099101100/** Register the amazon-bedrock plugin with an optional pluginConfig override. */
@@ -149,6 +148,8 @@ const ANTHROPIC_MODEL_DESCRIPTOR = {
149148150149const APP_INFERENCE_PROFILE_ARN =
151150"arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/my-claude-profile";
151+const OPUS_APP_INFERENCE_PROFILE_ARN =
152+"arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/opus-temperature-profile";
152153const APP_INFERENCE_PROFILE_DESCRIPTOR = {
153154api: "openai-completions",
154155provider: "amazon-bedrock",
@@ -267,26 +268,12 @@ describe("amazon-bedrock provider plugin", () => {
267268inferenceProfileGetResults.length = 0;
268269bedrockClientConfigs.length = 0;
269270refreshSharedConfigCache.mockClear();
270-setAwsSharedIniFileLoaderForTest({ loadSharedConfigFiles: refreshSharedConfigCache });
271271sendBedrockCommand.mockClear();
272272resetBedrockDiscoveryCacheForTest();
273-resetBedrockAppProfileCacheEligibilityForTest();
274-setBedrockAppProfileControlPlaneForTest((region) => ({
275-async getInferenceProfile(input) {
276-class GetInferenceProfileCommand {
277-constructor(readonly inputLocal: Record<string, unknown> = {}) {}
278-}
279-bedrockClientConfigs.push(region ? { region } : {});
280-return await sendBedrockCommand(new GetInferenceProfileCommand(input));
281-},
282-}));
283273});
284274285275afterEach(() => {
286-setBedrockAppProfileControlPlaneForTest(undefined);
287-setAwsSharedIniFileLoaderForTest(undefined);
288276resetBedrockDiscoveryCacheForTest();
289-resetBedrockAppProfileCacheEligibilityForTest();
290277});
291278292279afterAll(() => {
@@ -1501,8 +1488,8 @@ describe("amazon-bedrock provider plugin", () => {
1501148815021489await callWrappedStreamWithPayload(
15031490provider,
1504-APP_INFERENCE_PROFILE_ARN,
1505-APP_INFERENCE_PROFILE_DESCRIPTOR,
1491+OPUS_APP_INFERENCE_PROFILE_ARN,
1492+makeAppInferenceProfileDescriptor(OPUS_APP_INFERENCE_PROFILE_ARN),
15061493{ temperature: 0.3, maxTokens: 10, cacheRetention: "short" },
15071494payload,
15081495);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。