From 166068dfbe3b9be2fd74ee312a5109386313e026 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 21 Feb 2026 15:42:36 +0100 Subject: [PATCH] test: add byteplus coding-plan live test --- docs/help/testing.md | 6 ++++ src/agents/byteplus.live.test.ts | 47 ++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/agents/byteplus.live.test.ts diff --git a/docs/help/testing.md b/docs/help/testing.md index 3c4fdeb7de7..62cfda47a22 100644 --- a/docs/help/testing.md +++ b/docs/help/testing.md @@ -320,6 +320,12 @@ If you want to rely on env keys (e.g. exported in your `~/.profile`), run local - Test: `src/media-understanding/providers/deepgram/audio.live.test.ts` - Enable: `DEEPGRAM_API_KEY=... DEEPGRAM_LIVE_TEST=1 pnpm test:live src/media-understanding/providers/deepgram/audio.live.test.ts` +## BytePlus coding plan live + +- Test: `src/agents/byteplus.live.test.ts` +- Enable: `BYTEPLUS_API_KEY=... BYTEPLUS_LIVE_TEST=1 pnpm test:live src/agents/byteplus.live.test.ts` +- Optional model override: `BYTEPLUS_CODING_MODEL=ark-code-latest` + ## Docker runners (optional “works in Linux” checks) These run `pnpm test:live` inside the repo Docker image, mounting your local config dir and workspace (and sourcing `~/.profile` if mounted): diff --git a/src/agents/byteplus.live.test.ts b/src/agents/byteplus.live.test.ts new file mode 100644 index 00000000000..1c1b730a387 --- /dev/null +++ b/src/agents/byteplus.live.test.ts @@ -0,0 +1,47 @@ +import { completeSimple, type Model } from "@mariozechner/pi-ai"; +import { describe, expect, it } from "vitest"; +import { isTruthyEnvValue } from "../infra/env.js"; +import { BYTEPLUS_CODING_BASE_URL, BYTEPLUS_DEFAULT_COST } from "./byteplus-models.js"; + +const BYTEPLUS_KEY = process.env.BYTEPLUS_API_KEY ?? ""; +const BYTEPLUS_CODING_MODEL = process.env.BYTEPLUS_CODING_MODEL?.trim() || "ark-code-latest"; +const LIVE = isTruthyEnvValue(process.env.BYTEPLUS_LIVE_TEST) || isTruthyEnvValue(process.env.LIVE); + +const describeLive = LIVE && BYTEPLUS_KEY ? describe : describe.skip; + +describeLive("byteplus coding plan live", () => { + it("returns assistant text", async () => { + const model: Model<"openai-completions"> = { + id: BYTEPLUS_CODING_MODEL, + name: `BytePlus Coding ${BYTEPLUS_CODING_MODEL}`, + api: "openai-completions", + provider: "byteplus-plan", + baseUrl: BYTEPLUS_CODING_BASE_URL, + reasoning: false, + input: ["text"], + cost: BYTEPLUS_DEFAULT_COST, + contextWindow: 256000, + maxTokens: 4096, + }; + + const res = await completeSimple( + model, + { + messages: [ + { + role: "user", + content: "Reply with the word ok.", + timestamp: Date.now(), + }, + ], + }, + { apiKey: BYTEPLUS_KEY, maxTokens: 64 }, + ); + + const text = res.content + .filter((block) => block.type === "text") + .map((block) => block.text.trim()) + .join(" "); + expect(text.length).toBeGreaterThan(0); + }, 30000); +});