mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-22 07:02:16 +03:00
Obrigado — feature substancial e bem estruturada: separa qualidade operacional (comportamento de wire: 4xx/5xx, 429, respostas malformadas, stream interrompido) de qualidade semântica (só setada por avaliadores externos, nunca inferida do sucesso HTTP), com confidence/sample-awareness para não deixar poucos sucessos de sorte dominarem o ranking. Instrumentação de streaming (TTFT/ITL) threaded até RoutingEvent, endpoint de explicabilidade, e teste E2E determinístico cobrindo degradação→recuperação→blip. Validação (worktree própria a partir de origin/release/v3.8.50, merge limpo, 0 conflitos): - typecheck:core limpo, complexity/cognitive-complexity dentro do baseline - 59/59 testes passando (mlx-provider, routing-adaptive-e2e, routing-events(-concurrency), routing-otel, routing-quality, routing-scoring-quality, stream-timing, auto-combo-scoring-clamp)
58 lines
2.4 KiB
TypeScript
58 lines
2.4 KiB
TypeScript
import { describe, it, beforeEach, afterEach } from "node:test";
|
|
import assert from "node:assert";
|
|
import { getRegistryEntry } from "../../open-sse/config/providerRegistry.ts";
|
|
|
|
// Mock fetch for health checks
|
|
const originalFetch = global.fetch;
|
|
|
|
describe("MLX Provider Registry Entries", () => {
|
|
beforeEach(() => {
|
|
global.fetch = async () => ({ ok: false, status: 500 });
|
|
});
|
|
|
|
afterEach(() => {
|
|
global.fetch = originalFetch;
|
|
});
|
|
|
|
it("should have mlx-gemma registry entry with correct configuration", async () => {
|
|
const entry = getRegistryEntry("mlx-gemma");
|
|
|
|
assert.ok(entry, "mlx-gemma should be registered");
|
|
assert.equal(entry?.id, "mlx-gemma");
|
|
assert.equal(entry?.alias, "mlx-gemma");
|
|
assert.equal(entry?.format, "openai");
|
|
assert.equal(entry?.executor, "default"); // Uses default executor for OpenAI-compatible
|
|
assert.equal(entry?.baseUrl, "http://localhost:11435/v1");
|
|
assert.equal(entry?.modelsUrl, "http://localhost:11435/v1/models");
|
|
assert.equal(entry?.passthroughModels, false);
|
|
assert.ok(entry?.models?.length === 1);
|
|
assert.equal(entry?.models?.[0]?.id, "mlx-community/gemma-4-26B-A4B-it-qat-q4_0-mlx-aligned");
|
|
assert.equal(entry?.models?.[0]?.toolCalling, true);
|
|
assert.equal(entry?.models?.[0]?.contextLength, 8192);
|
|
});
|
|
|
|
it("should have mlx-qwen registry entry with correct configuration", async () => {
|
|
const entry = getRegistryEntry("mlx-qwen");
|
|
|
|
assert.ok(entry, "mlx-qwen should be registered");
|
|
assert.equal(entry?.id, "mlx-qwen");
|
|
assert.equal(entry?.alias, "mlx-qwen");
|
|
assert.equal(entry?.format, "openai");
|
|
assert.equal(entry?.executor, "default");
|
|
assert.equal(entry?.baseUrl, "http://localhost:11436/v1");
|
|
assert.equal(entry?.modelsUrl, "http://localhost:11436/v1/models");
|
|
assert.equal(entry?.passthroughModels, false);
|
|
assert.ok(entry?.models?.length === 1);
|
|
assert.equal(entry?.models?.[0]?.id, "maglun/Qwen3.8-27B-MLX-Mixed-3.80bpw");
|
|
assert.equal(entry?.models?.[0]?.toolCalling, true);
|
|
assert.equal(entry?.models?.[0]?.contextLength, 8192);
|
|
});
|
|
|
|
it("should have both MLX providers in registered providers list", async () => {
|
|
const { getRegisteredProviders } = await import("../../open-sse/config/providerRegistry.ts");
|
|
const providers = getRegisteredProviders();
|
|
assert.ok(providers.includes("mlx-gemma"));
|
|
assert.ok(providers.includes("mlx-qwen"));
|
|
});
|
|
});
|