Files
oh-my-pi/packages/catalog/test/discovery-null-limits.test.ts
T
can1357 f0c6a54f51 fix: handled unknown model limits as null to avoid artificial token caps
- Replaced unknown model contextWindow/maxTokens sentinels with nullable values across types and catalog data.
- Mapped request token calculations to treat null maxTokens as unlimited output caps.
- Updated remote compaction and context checks to ignore unknown limits by using Infinity/0 fallbacks.
- Adjusted CLI/model registry flows to skip cap enforcement for null limits and render unknown values as '-'.
2026-06-13 15:35:40 +02:00

33 lines
862 B
TypeScript

import { describe, expect, it } from "bun:test";
import { fetchOpenAICompatibleModels } from "../src/discovery/openai-compatible";
describe("discovery null limits", () => {
it("emits null for contextWindow and maxTokens when limits are unknown", async () => {
const mockFetch = async () => {
return new Response(
JSON.stringify({
data: [
{
id: "some-model",
name: "Some Model",
},
],
}),
{ status: 200, headers: { "Content-Type": "application/json" } },
);
};
const models = await fetchOpenAICompatibleModels({
provider: "custom",
api: "openai-completions",
baseUrl: "https://api.example.com/v1",
fetch: mockFetch,
});
expect(models).toBeDefined();
expect(models!.length).toBe(1);
expect(models![0].contextWindow).toBeNull();
expect(models![0].maxTokens).toBeNull();
});
});