mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 10:52:54 +00:00
* feat: add Claude Opus 4.8 support * fix: omit Vertex Opus sampling overrides * fix: preserve Opus adaptive thinking levels * fix: clamp Anthropic max effort support * fix: use sha256 for QA mock call ids * fix: type Anthropic transport test model metadata * test: update PDF model default for Opus 4.8
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import type { ProviderThinkingProfile } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
|
const BASE_CLAUDE_THINKING_LEVELS = [
|
|
{ id: "off" },
|
|
{ id: "minimal" },
|
|
{ id: "low" },
|
|
{ id: "medium" },
|
|
{ id: "high" },
|
|
] as const satisfies ProviderThinkingProfile["levels"];
|
|
|
|
function isOpus48BedrockModelRef(modelRef: string): boolean {
|
|
return /(?:^|[/.:])(?:(?:us|eu|ap|apac|au|jp|global)\.)?anthropic\.claude-opus-4[.-]8(?:$|[-.:/])/i.test(
|
|
modelRef,
|
|
);
|
|
}
|
|
|
|
export function isOpus47BedrockModelRef(modelRef: string): boolean {
|
|
return /(?:^|[/.:])(?:(?:us|eu|ap|apac|au|jp|global)\.)?anthropic\.claude-opus-4[.-]7(?:$|[-.:/])/i.test(
|
|
modelRef,
|
|
);
|
|
}
|
|
|
|
export function isOpus47OrNewerBedrockModelRef(modelRef: string): boolean {
|
|
return isOpus47BedrockModelRef(modelRef) || isOpus48BedrockModelRef(modelRef);
|
|
}
|
|
|
|
export function resolveBedrockClaudeThinkingProfile(modelId: string): ProviderThinkingProfile {
|
|
const trimmed = modelId.trim();
|
|
if (isOpus48BedrockModelRef(trimmed)) {
|
|
return {
|
|
levels: [...BASE_CLAUDE_THINKING_LEVELS, { id: "xhigh" }, { id: "adaptive" }, { id: "max" }],
|
|
defaultLevel: "off",
|
|
};
|
|
}
|
|
if (isOpus47BedrockModelRef(trimmed)) {
|
|
return {
|
|
levels: [...BASE_CLAUDE_THINKING_LEVELS, { id: "xhigh" }, { id: "adaptive" }, { id: "max" }],
|
|
defaultLevel: "off",
|
|
};
|
|
}
|
|
if (/claude-(?:opus|sonnet)-4(?:\.|-)6(?:$|[-.])/i.test(trimmed)) {
|
|
return {
|
|
levels: [...BASE_CLAUDE_THINKING_LEVELS, { id: "adaptive" }],
|
|
defaultLevel: "adaptive",
|
|
};
|
|
}
|
|
return { levels: BASE_CLAUDE_THINKING_LEVELS };
|
|
}
|