Map the app-server service tier catalog to a select capability and forward selected tier IDs without translating them through fast mode. Preserve legacy persisted fast-mode selections. Co-authored-by: codex <[email protected]>
105 lines
2.5 KiB
TypeScript
105 lines
2.5 KiB
TypeScript
import { assert, it } from "@effect/vitest";
|
|
|
|
import { mapCodexModelCapabilities } from "./CodexProvider.ts";
|
|
|
|
it("maps current Codex model capability fields", () => {
|
|
const capabilities = mapCodexModelCapabilities({
|
|
additionalSpeedTiers: [],
|
|
defaultReasoningEffort: "super-high",
|
|
description: "Test model",
|
|
displayName: "GPT Test",
|
|
hidden: false,
|
|
id: "gpt-test",
|
|
isDefault: true,
|
|
model: "gpt-test",
|
|
defaultServiceTier: "flex",
|
|
serviceTiers: [
|
|
{
|
|
id: "priority",
|
|
name: "Fast",
|
|
description: "Lower latency responses.",
|
|
},
|
|
{
|
|
id: "flex",
|
|
name: "Flex",
|
|
description: "Lower-cost asynchronous routing.",
|
|
},
|
|
],
|
|
supportedReasoningEfforts: [
|
|
{
|
|
description: "Maximum reasoning",
|
|
reasoningEffort: "super-high",
|
|
},
|
|
],
|
|
});
|
|
|
|
assert.deepStrictEqual(capabilities.optionDescriptors, [
|
|
{
|
|
id: "reasoningEffort",
|
|
label: "Reasoning",
|
|
type: "select",
|
|
options: [{ id: "super-high", label: "super-high", isDefault: true }],
|
|
currentValue: "super-high",
|
|
},
|
|
{
|
|
id: "serviceTier",
|
|
label: "Service Tier",
|
|
type: "select",
|
|
options: [
|
|
{ id: "default", label: "Standard" },
|
|
{
|
|
id: "priority",
|
|
label: "Fast",
|
|
description: "Lower latency responses.",
|
|
},
|
|
{
|
|
id: "flex",
|
|
label: "Flex",
|
|
description: "Lower-cost asynchronous routing.",
|
|
isDefault: true,
|
|
},
|
|
],
|
|
currentValue: "flex",
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("uses standard routing when the catalog has no default service tier", () => {
|
|
const capabilities = mapCodexModelCapabilities({
|
|
additionalSpeedTiers: ["fast"],
|
|
defaultReasoningEffort: "medium",
|
|
defaultServiceTier: null,
|
|
description: "Test model",
|
|
displayName: "GPT Test",
|
|
hidden: false,
|
|
id: "gpt-test",
|
|
isDefault: true,
|
|
model: "gpt-test",
|
|
serviceTiers: [
|
|
{
|
|
id: "priority",
|
|
name: "Fast",
|
|
description: "1.5x speed, increased usage",
|
|
},
|
|
],
|
|
supportedReasoningEfforts: [],
|
|
});
|
|
|
|
assert.deepStrictEqual(capabilities.optionDescriptors, [
|
|
{
|
|
id: "serviceTier",
|
|
label: "Service Tier",
|
|
type: "select",
|
|
options: [
|
|
{ id: "default", label: "Standard", isDefault: true },
|
|
{
|
|
id: "priority",
|
|
label: "Fast",
|
|
description: "1.5x speed, increased usage",
|
|
},
|
|
],
|
|
currentValue: "default",
|
|
},
|
|
]);
|
|
});
|