惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
博客园 - Franky
V
V2EX
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
J
Java Code Geeks
T
The Blog of Author Tim Ferriss
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
博客园 - 叶小钗
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
D
Docker
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(bedrock): strip inference profile prefix from model I...
LiuwqGit · 2026-06-16 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -108,3 +108,47 @@ describe("bedrock embedding response parsers", () => {

108108

).toThrow("Amazon Bedrock embedding response returned malformed JSON");

109109

});

110110

});

111+
112+

describe("stripInferenceProfilePrefix", () => {

113+

it("strips global prefix", () => {

114+

expect(testing.stripInferenceProfilePrefix("global.cohere.embed-v4:0")).toBe(

115+

"cohere.embed-v4:0",

116+

);

117+

});

118+
119+

it("strips us prefix", () => {

120+

expect(testing.stripInferenceProfilePrefix("us.cohere.embed-v4:0")).toBe("cohere.embed-v4:0");

121+

});

122+
123+

it("strips eu prefix", () => {

124+

expect(testing.stripInferenceProfilePrefix("eu.cohere.embed-v4:0")).toBe("cohere.embed-v4:0");

125+

});

126+
127+

it("strips ap prefix", () => {

128+

expect(testing.stripInferenceProfilePrefix("ap.cohere.embed-v4:0")).toBe("cohere.embed-v4:0");

129+

});

130+
131+

it("strips apac prefix", () => {

132+

expect(testing.stripInferenceProfilePrefix("apac.cohere.embed-v4:0")).toBe(

133+

"cohere.embed-v4:0",

134+

);

135+

});

136+
137+

it("strips au prefix", () => {

138+

expect(testing.stripInferenceProfilePrefix("au.cohere.embed-v4:0")).toBe("cohere.embed-v4:0");

139+

});

140+
141+

it("strips jp prefix", () => {

142+

expect(testing.stripInferenceProfilePrefix("jp.cohere.embed-v4:0")).toBe("cohere.embed-v4:0");

143+

});

144+
145+

it("returns unchanged model ID without prefix", () => {

146+

expect(testing.stripInferenceProfilePrefix("cohere.embed-v4:0")).toBe("cohere.embed-v4:0");

147+

});

148+
149+

it("returns unchanged model ID for amazon.titan-embed-text-v2:0", () => {

150+

expect(testing.stripInferenceProfilePrefix("amazon.titan-embed-text-v2:0")).toBe(

151+

"amazon.titan-embed-text-v2:0",

152+

);

153+

});

154+

});

Original file line numberDiff line numberDiff line change

@@ -69,12 +69,18 @@ const MODELS: Record<string, ModelSpec> = {

6969

"twelvelabs.marengo-embed-3-0-v1:0": { maxTokens: 512, dims: 512, family: "twelvelabs" },

7070

};

7171
72+

/** Strip AWS inference profile prefix (us., eu., ap., apac., au., jp., global.) from model ID. */

73+

function stripInferenceProfilePrefix(modelId: string): string {

74+

return modelId.replace(/^(?:us|eu|ap|apac|au|jp|global)\./, "");

75+

}

76+
7277

/** Resolve spec, stripping throughput suffixes like `:2:8k` or `:0:512`. */

7378

function resolveSpec(modelId: string): ModelSpec | undefined {

74-

if (MODELS[modelId]) {

75-

return MODELS[modelId];

79+

const bare = stripInferenceProfilePrefix(modelId);

80+

if (MODELS[bare]) {

81+

return MODELS[bare];

7682

}

77-

const parts = modelId.split(":");

83+

const parts = bare.split(":");

7884

for (let i = parts.length - 1; i >= 1; i--) {

7985

const spec = MODELS[parts.slice(0, i).join(":")];

8086

if (spec) {

@@ -86,7 +92,7 @@ function resolveSpec(modelId: string): ModelSpec | undefined {

8692
8793

/** Infer family from model ID prefix when not in catalog. */

8894

function inferFamily(modelId: string): Family {

89-

const id = normalizeLowercaseStringOrEmpty(modelId);

95+

const id = normalizeLowercaseStringOrEmpty(stripInferenceProfilePrefix(modelId));

9096

if (id.startsWith("amazon.titan-embed-text-v2")) {

9197

return "titan-v2";

9298

}

@@ -312,6 +318,7 @@ function parseCohereBatch(family: Family, raw: string): number[][] {

312318

export const testing = {

313319

parseCohereBatch,

314320

parseSingle,

321+

stripInferenceProfilePrefix,

315322

};

316323
317324

// ---------------------------------------------------------------------------