mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-25 17:02:46 +00:00
test: stabilize moonshot and minimax live probes
This commit is contained in:
@@ -13,6 +13,20 @@ const LIVE = isLiveTestEnabled(["MINIMAX_LIVE_TEST"]);
|
||||
|
||||
const describeLive = LIVE && MINIMAX_KEY ? describe : describe.skip;
|
||||
|
||||
async function runMinimaxTextProbe(model: Model<"anthropic-messages">, maxTokens: number) {
|
||||
const res = await completeSimple(
|
||||
model,
|
||||
{
|
||||
messages: createSingleUserPromptMessage(),
|
||||
},
|
||||
{ apiKey: MINIMAX_KEY, maxTokens },
|
||||
);
|
||||
return {
|
||||
res,
|
||||
text: extractNonEmptyAssistantText(res.content),
|
||||
};
|
||||
}
|
||||
|
||||
describeLive("minimax live", () => {
|
||||
it("returns assistant text", async () => {
|
||||
const model: Model<"anthropic-messages"> = {
|
||||
@@ -28,14 +42,12 @@ describeLive("minimax live", () => {
|
||||
contextWindow: 200000,
|
||||
maxTokens: 8192,
|
||||
};
|
||||
const res = await completeSimple(
|
||||
model,
|
||||
{
|
||||
messages: createSingleUserPromptMessage(),
|
||||
},
|
||||
{ apiKey: MINIMAX_KEY, maxTokens: 64 },
|
||||
);
|
||||
const text = extractNonEmptyAssistantText(res.content);
|
||||
let { res, text } = await runMinimaxTextProbe(model, 128);
|
||||
// MiniMax can spend a small token budget in hidden thinking before it emits
|
||||
// the visible answer. Give this smoke probe one larger retry.
|
||||
if (text.length === 0 && res.stopReason === "length") {
|
||||
({ text } = await runMinimaxTextProbe(model, 256));
|
||||
}
|
||||
expect(text.length).toBeGreaterThan(0);
|
||||
}, 20000);
|
||||
});
|
||||
|
||||
@@ -13,6 +13,16 @@ const LIVE = isLiveTestEnabled(["MOONSHOT_LIVE_TEST"]);
|
||||
|
||||
const describeLive = LIVE && MOONSHOT_KEY ? describe : describe.skip;
|
||||
|
||||
function forceMoonshotInstantMode(payload: unknown): void {
|
||||
if (!payload || typeof payload !== "object") {
|
||||
return;
|
||||
}
|
||||
// Moonshot's official API exposes instant mode via thinking.type=disabled.
|
||||
// Without this, tiny smoke probes can spend the full token budget in hidden
|
||||
// reasoning_content and never emit visible assistant text.
|
||||
(payload as Record<string, unknown>).thinking = { type: "disabled" };
|
||||
}
|
||||
|
||||
describeLive("moonshot live", () => {
|
||||
it("returns assistant text", async () => {
|
||||
const model: Model<"openai-completions"> = {
|
||||
@@ -33,7 +43,13 @@ describeLive("moonshot live", () => {
|
||||
{
|
||||
messages: createSingleUserPromptMessage(),
|
||||
},
|
||||
{ apiKey: MOONSHOT_KEY, maxTokens: 64 },
|
||||
{
|
||||
apiKey: MOONSHOT_KEY,
|
||||
maxTokens: 64,
|
||||
onPayload: (payload) => {
|
||||
forceMoonshotInstantMode(payload);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const text = extractNonEmptyAssistantText(res.content);
|
||||
|
||||
Reference in New Issue
Block a user