
























@@ -6,12 +6,16 @@ import {
66extractNonEmptyAssistantText,
77isLiveTestEnabled,
88} from "./live-test-helpers.js";
9-import { isBillingErrorMessage } from "./pi-embedded-helpers/failover-matches.js";
9+import {
10+isBillingErrorMessage,
11+isOverloadedErrorMessage,
12+} from "./pi-embedded-helpers/failover-matches.js";
1013import { applyExtraParamsToAgent } from "./pi-embedded-runner.js";
1114import { createWebSearchTool } from "./tools/web-search.js";
12151316const XAI_KEY = process.env.XAI_API_KEY ?? "";
1417const LIVE = isLiveTestEnabled(["XAI_LIVE_TEST"]);
18+const XAI_COMPLETE_LIVE_TIMEOUT_MS = 90_000;
1519const XAI_WEB_SEARCH_LIVE_TIMEOUT_SECONDS = 60;
16201721const describeLive = LIVE && XAI_KEY ? describe : describe.skip;
@@ -47,6 +51,10 @@ async function runXaiLiveCase(label: string, run: () => Promise<void>): Promise<
4751console.warn(`[xai:live] skip ${label}: billing drift: ${message}`);
4852return;
4953}
54+if (isOverloadedErrorMessage(message)) {
55+console.warn(`[xai:live] skip ${label}: temporary provider capacity: ${message}`);
56+return;
57+}
5058if (message.includes("web_search is disabled or no provider is available")) {
5159console.warn(`[xai:live] skip ${label}: web_search unavailable in this environment`);
5260return;
@@ -68,23 +76,27 @@ async function collectDoneMessage(
6876}
69777078describeLive("xai live", () => {
71-it("returns assistant text for Grok 4.3", async () => {
72-await runXaiLiveCase("complete", async () => {
73-const model = requireLiveValue(resolveLiveXaiModel(), "xAI model");
74-const res = await completeSimple(
75-model,
76-{
77-messages: createSingleUserPromptMessage(),
78-},
79-{
80-apiKey: XAI_KEY,
81-maxTokens: 64,
82-},
83-);
79+it(
80+"returns assistant text for Grok 4.3",
81+async () => {
82+await runXaiLiveCase("complete", async () => {
83+const model = requireLiveValue(resolveLiveXaiModel(), "xAI model");
84+const res = await completeSimple(
85+model,
86+{
87+messages: createSingleUserPromptMessage(),
88+},
89+{
90+apiKey: XAI_KEY,
91+maxTokens: 64,
92+},
93+);
849485-expect(extractNonEmptyAssistantText(res.content).length).toBeGreaterThan(0);
86-});
87-}, 30_000);
95+expect(extractNonEmptyAssistantText(res.content).length).toBeGreaterThan(0);
96+});
97+},
98+XAI_COMPLETE_LIVE_TIMEOUT_MS,
99+);
8810089101it("sends wrapped xAI tool payloads live", async () => {
90102await runXaiLiveCase("tool-call", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。