Files
2026-02-25 01:41:28 +01:00

34 lines
1.1 KiB
TypeScript

import { strict as assert } from "node:assert";
import { detectProvider, getAllAdapters } from "@/server/adapters";
import { completionSchema } from "@/lib/validations/completion";
import { embeddingsSchema } from "@/lib/validations/embeddings";
function runSmokeChecks() {
const adapters = getAllAdapters();
const ids = adapters.map((a) => a.id).sort();
assert(ids.includes("openai"));
assert(ids.includes("anthropic"));
assert(ids.includes("grok"));
assert(ids.includes("deepseek"));
assert(ids.includes("perplexity"));
assert.equal(detectProvider("sk-ant-abc123")?.id, "anthropic");
assert.equal(detectProvider("xai-abc123")?.id, "grok");
assert.equal(detectProvider("pplx-abc123")?.id, "perplexity");
const completion = completionSchema.safeParse({
model: "gpt-4.1-mini",
prompt: "hello",
});
assert.equal(completion.success, true);
const embeddings = embeddingsSchema.safeParse({
model: "text-embedding-3-small",
input: "hello",
});
assert.equal(embeddings.success, true);
}
runSmokeChecks();
console.log("Smoke checks passed");