mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08:00
fix(ai): omit disabled thinking for Claude Fable 5
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Claude Fable 5 thinking-off requests to omit Anthropic's unsupported `thinking.type: "disabled"` payload ([#5567](https://github.com/earendil-works/pi/pull/5567) by [@tmustier](https://github.com/tmustier)).
|
||||
|
||||
## [0.79.1] - 2026-06-09
|
||||
|
||||
### Added
|
||||
|
||||
@@ -299,7 +299,7 @@ function applyThinkingLevelMetadata(model: Model<any>): void {
|
||||
(model.api === "anthropic-messages" || model.api === "bedrock-converse-stream") &&
|
||||
model.id.includes("fable-5")
|
||||
) {
|
||||
mergeThinkingLevelMap(model, { xhigh: "xhigh" });
|
||||
mergeThinkingLevelMap(model, { off: null, xhigh: "xhigh" });
|
||||
}
|
||||
if (model.api === "anthropic-messages" && isAnthropicAdaptiveThinkingModel(model.id)) {
|
||||
mergeAnthropicMessagesCompat(model, { forceAdaptiveThinking: true });
|
||||
|
||||
@@ -972,7 +972,7 @@ function buildParams(
|
||||
display,
|
||||
};
|
||||
}
|
||||
} else if (options?.thinkingEnabled === false) {
|
||||
} else if (options?.thinkingEnabled === false && model.thinkingLevelMap?.off !== null) {
|
||||
params.thinking = { type: "disabled" };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,13 @@ describe("Anthropic thinking disable payload", () => {
|
||||
expect(payload.output_config).toBeUndefined();
|
||||
});
|
||||
|
||||
it("omits thinking.type=disabled for Claude Fable 5 when thinking is off", async () => {
|
||||
const payload = await capturePayload(getModel("anthropic", "claude-fable-5"));
|
||||
|
||||
expect(payload.thinking).toBeUndefined();
|
||||
expect(payload.output_config).toBeUndefined();
|
||||
});
|
||||
|
||||
it("uses adaptive thinking for Claude Opus 4.8 when reasoning is enabled", async () => {
|
||||
const payload = await capturePayload(getModel("anthropic", "claude-opus-4-8"), { reasoning: "high" });
|
||||
|
||||
|
||||
@@ -20,10 +20,11 @@ describe("getSupportedThinkingLevels", () => {
|
||||
expect(getSupportedThinkingLevels(model!)).toContain("xhigh");
|
||||
});
|
||||
|
||||
it("includes xhigh for Anthropic Claude Fable 5 on anthropic-messages API", () => {
|
||||
it("includes xhigh but not off for Anthropic Claude Fable 5 on anthropic-messages API", () => {
|
||||
const model = getModel("anthropic", "claude-fable-5");
|
||||
expect(model).toBeDefined();
|
||||
expect(getSupportedThinkingLevels(model!)).toContain("xhigh");
|
||||
expect(getSupportedThinkingLevels(model!)).not.toContain("off");
|
||||
});
|
||||
|
||||
it("does not include xhigh for Claude Sonnet 4.5", () => {
|
||||
@@ -86,9 +87,10 @@ describe("getSupportedThinkingLevels", () => {
|
||||
expect(getSupportedThinkingLevels(model!)).toContain("xhigh");
|
||||
});
|
||||
|
||||
it("includes xhigh for Bedrock Claude Fable 5", () => {
|
||||
it("includes xhigh but not off for Bedrock Claude Fable 5", () => {
|
||||
const model = getModel("amazon-bedrock", "global.anthropic.claude-fable-5");
|
||||
expect(model).toBeDefined();
|
||||
expect(getSupportedThinkingLevels(model!)).toContain("xhigh");
|
||||
expect(getSupportedThinkingLevels(model!)).not.toContain("off");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user