mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-06 23:32:12 +03:00
- providerModels: supportsXHighEffort returns true for unknown providers (passthrough) so PR #2162 sanitizeReasoningEffortForProvider no longer downgrades xhigh for non-registry custom providers - providerRegistry(openai): add gpt-4o + gpt-4o-2024-11-20 with explicit contextLength so catalog tests can resolve them without synced DB data - context-manager.test: update GPT-5.5 Codex expected context 1050000→400000 (PR #2163 capped codex OAuth context at 400K) - provider-models-config.test: update kiro claude-opus-4.7 contextLength undefined→1000000 (PR #2163 added explicit context window) - oauth-providers-config.test: add windsurf and devin-cli to expected provider keys and config map (PR #2168) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
91 lines
3.5 KiB
TypeScript
91 lines
3.5 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import {
|
|
PROVIDER_ID_TO_ALIAS,
|
|
PROVIDER_MODELS,
|
|
findModelName,
|
|
getDefaultModel,
|
|
getModelTargetFormat,
|
|
getModelsByProviderId,
|
|
getProviderModels,
|
|
isValidModel,
|
|
} from "../../open-sse/config/providerModels.ts";
|
|
|
|
test("provider models helpers expose model lists and defaults", () => {
|
|
const openaiModels = getProviderModels("openai");
|
|
|
|
assert.ok(Array.isArray(openaiModels));
|
|
assert.ok(openaiModels.length > 0);
|
|
assert.equal(getProviderModels("provider-that-does-not-exist").length, 0);
|
|
assert.equal(getDefaultModel("openai"), openaiModels[0].id);
|
|
assert.equal(getDefaultModel("provider-that-does-not-exist"), null);
|
|
});
|
|
|
|
test("provider models helpers validate and resolve model metadata", () => {
|
|
const openaiModels = PROVIDER_MODELS.openai;
|
|
const firstModel = openaiModels[0];
|
|
|
|
assert.equal(isValidModel("openai", firstModel.id), true);
|
|
assert.equal(isValidModel("openai", "missing-model"), false);
|
|
assert.equal(
|
|
isValidModel("passthrough-provider", "anything-goes", new Set(["passthrough-provider"])),
|
|
true
|
|
);
|
|
|
|
assert.equal(findModelName("openai", firstModel.id), firstModel.name);
|
|
assert.equal(findModelName("openai", "missing-model"), "missing-model");
|
|
assert.equal(findModelName("missing-provider", "missing-model"), "missing-model");
|
|
|
|
assert.equal(getModelTargetFormat("openai", firstModel.id), firstModel.targetFormat || null);
|
|
assert.equal(getModelTargetFormat("openai", "missing-model"), null);
|
|
assert.equal(getModelTargetFormat("missing-provider", "missing-model"), null);
|
|
});
|
|
|
|
test("provider models helpers resolve provider IDs through aliases", () => {
|
|
const firstProviderId = Object.keys(PROVIDER_ID_TO_ALIAS)[0];
|
|
const alias = PROVIDER_ID_TO_ALIAS[firstProviderId] || firstProviderId;
|
|
|
|
assert.deepEqual(getModelsByProviderId(firstProviderId), PROVIDER_MODELS[alias] || []);
|
|
assert.deepEqual(getModelsByProviderId("provider-that-does-not-exist"), []);
|
|
});
|
|
|
|
test("Reka registry exposes preset models", () => {
|
|
const rekaModels = getModelsByProviderId("reka");
|
|
const ids = rekaModels.map((model) => model.id);
|
|
|
|
assert.equal(PROVIDER_ID_TO_ALIAS.reka, "reka");
|
|
assert.equal(getDefaultModel("reka"), "reka-flash-3");
|
|
assert.deepEqual(ids, ["reka-flash-3", "reka-edge-2603"]);
|
|
assert.equal(isValidModel("reka", "reka-edge-2603"), true);
|
|
});
|
|
|
|
test("GitHub Copilot registry reflects the current supported model lineup", () => {
|
|
const githubModels = getProviderModels("gh");
|
|
const ids = new Set(githubModels.map((model) => model.id));
|
|
|
|
assert.ok(ids.has("gpt-5.3-codex"));
|
|
assert.ok(ids.has("gpt-5.4"));
|
|
assert.ok(ids.has("gpt-5.4-mini"));
|
|
assert.ok(ids.has("claude-opus-4.7"));
|
|
assert.ok(ids.has("claude-sonnet-4.6"));
|
|
assert.ok(ids.has("gemini-3-flash-preview"));
|
|
assert.equal(getModelTargetFormat("gh", "gpt-5.3-codex"), "openai-responses");
|
|
assert.equal(ids.has("gpt-5.1"), false);
|
|
assert.equal(ids.has("gpt-5.1-codex"), false);
|
|
assert.equal(ids.has("claude-opus-4.1"), false);
|
|
});
|
|
|
|
test("Kiro registry exposes the current CLI model lineup with context windows", () => {
|
|
const kiroModels = getProviderModels("kr");
|
|
const byId = new Map(kiroModels.map((model) => [model.id, model]));
|
|
|
|
assert.ok(byId.has("claude-opus-4.7"));
|
|
assert.equal(byId.get("claude-opus-4.7")?.contextLength, 1000000);
|
|
assert.ok(byId.has("claude-sonnet-4.6"));
|
|
assert.ok(byId.has("claude-haiku-4.5"));
|
|
assert.equal(byId.has("claude-opus-4-7"), false);
|
|
assert.equal(byId.has("claude-sonnet-4-6"), false);
|
|
assert.equal(byId.has("claude-haiku-4-5"), false);
|
|
});
|