fix(ai): avoid stale Cerebras test model
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
import type { ChildProcess } from "child_process";
|
import type { ChildProcess } from "child_process";
|
||||||
import { execSync, spawn } from "child_process";
|
import { execSync, spawn } from "child_process";
|
||||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||||
import { getModel } from "../src/models.ts";
|
import { getModel, getModels } from "../src/models.ts";
|
||||||
import { complete } from "../src/stream.ts";
|
import { complete } from "../src/stream.ts";
|
||||||
import type { AssistantMessage, Context, Model, Usage } from "../src/types.ts";
|
import type { AssistantMessage, Context, Model, Usage } from "../src/types.ts";
|
||||||
import { isContextOverflow } from "../src/utils/overflow.ts";
|
import { isContextOverflow } from "../src/utils/overflow.ts";
|
||||||
@@ -297,8 +297,15 @@ describe("Context overflow error handling", () => {
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
describe.skipIf(!process.env.CEREBRAS_API_KEY)("Cerebras", () => {
|
describe.skipIf(!process.env.CEREBRAS_API_KEY)("Cerebras", () => {
|
||||||
it("qwen-3-235b - should detect overflow via isContextOverflow", async () => {
|
it("available model - should detect overflow via isContextOverflow", async () => {
|
||||||
const model = getModel("cerebras", "qwen-3-235b-a22b-instruct-2507");
|
const preferredCerebrasModelIds: string[] = ["gpt-oss-120b", "zai-glm-4.7", "llama3.1-8b"];
|
||||||
|
const cerebrasModels = getModels("cerebras");
|
||||||
|
const model =
|
||||||
|
cerebrasModels.find((candidate) => preferredCerebrasModelIds.includes(candidate.id)) ?? cerebrasModels[0];
|
||||||
|
if (!model) {
|
||||||
|
throw new Error("No Cerebras models available");
|
||||||
|
}
|
||||||
|
|
||||||
const result = await testContextOverflow(model, process.env.CEREBRAS_API_KEY!);
|
const result = await testContextOverflow(model, process.env.CEREBRAS_API_KEY!);
|
||||||
logResult(result);
|
logResult(result);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { getModel } from "../src/models.ts";
|
import { getModel, getModels } from "../src/models.ts";
|
||||||
import { stream } from "../src/stream.ts";
|
import { stream } from "../src/stream.ts";
|
||||||
import type { Api, Context, Model, StreamOptions } from "../src/types.ts";
|
import type { Api, Context, Model, StreamOptions } from "../src/types.ts";
|
||||||
|
|
||||||
@@ -149,9 +149,15 @@ describe("Token Statistics on Abort", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe.skipIf(!process.env.CEREBRAS_API_KEY)("Cerebras Provider", () => {
|
describe.skipIf(!process.env.CEREBRAS_API_KEY)("Cerebras Provider", () => {
|
||||||
const llm = getModel("cerebras", "qwen-3-235b-a22b-instruct-2507");
|
const preferredCerebrasModelIds: string[] = ["gpt-oss-120b", "zai-glm-4.7", "llama3.1-8b"];
|
||||||
|
const cerebrasModels = getModels("cerebras");
|
||||||
|
const llm = cerebrasModels.find((model) => preferredCerebrasModelIds.includes(model.id)) ?? cerebrasModels[0];
|
||||||
|
|
||||||
it("should include token stats when aborted mid-stream", { retry: 3, timeout: 30000 }, async () => {
|
it("should include token stats when aborted mid-stream", { retry: 3, timeout: 30000 }, async () => {
|
||||||
|
if (!llm) {
|
||||||
|
throw new Error("No Cerebras models available");
|
||||||
|
}
|
||||||
|
|
||||||
await testTokensOnAbort(llm);
|
await testTokensOnAbort(llm);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user