mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-19 02:34:45 +00:00
61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { applyXaiRuntimeModelCompat } from "./runtime-model-compat.js";
|
|
|
|
describe("xai runtime model compat", () => {
|
|
it("maps OpenClaw thinking levels to xAI efforts for reasoning-capable models", () => {
|
|
const model = applyXaiRuntimeModelCompat({
|
|
id: "grok-4.3",
|
|
provider: "xai",
|
|
reasoning: true,
|
|
});
|
|
|
|
expect(model.compat).toMatchObject({
|
|
supportsReasoningEffort: true,
|
|
supportedReasoningEfforts: ["low", "medium", "high"],
|
|
});
|
|
expect(model.thinkingLevelMap).toEqual({
|
|
off: null,
|
|
minimal: "low",
|
|
low: "low",
|
|
medium: "medium",
|
|
high: "high",
|
|
xhigh: "high",
|
|
});
|
|
});
|
|
|
|
it("suppresses reasoning efforts for non-reasoning models", () => {
|
|
const model = applyXaiRuntimeModelCompat({
|
|
id: "grok-4-fast-non-reasoning",
|
|
provider: "xai",
|
|
reasoning: false,
|
|
});
|
|
|
|
expect(model.thinkingLevelMap).toEqual({
|
|
off: null,
|
|
minimal: null,
|
|
low: null,
|
|
medium: null,
|
|
high: null,
|
|
xhigh: null,
|
|
});
|
|
});
|
|
|
|
it("does not advertise configurable reasoning effort for older xAI reasoning models", () => {
|
|
const model = applyXaiRuntimeModelCompat({
|
|
id: "grok-4.20-beta-latest-reasoning",
|
|
provider: "xai",
|
|
reasoning: true,
|
|
});
|
|
|
|
expect(model.compat).toMatchObject({ supportsReasoningEffort: false });
|
|
expect(model.thinkingLevelMap).toEqual({
|
|
off: null,
|
|
minimal: null,
|
|
low: null,
|
|
medium: null,
|
|
high: null,
|
|
xhigh: null,
|
|
});
|
|
});
|
|
});
|