Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

claudeModelOptions.test.ts

53 lines1.6 KB

1import { describe, expect, it } from "@effect/vitest";
2​
3import { ProviderInstanceId, type ModelSelection } from "@t3tools/contracts";
4​
5import { compileClaudeModelSelection } from "./claudeModelOptions.ts";
6​
7const selection = (
8 model: string,
9 options: NonNullable<ModelSelection["options"]>,
10): ModelSelection => ({
11 instanceId: ProviderInstanceId.make("claude_test"),
12 model,
13 options,
14});
15​
16describe("compileClaudeModelSelection", () => {
17 it("compiles context, effort, and settings together", () => {
18 expect(
19 compileClaudeModelSelection(
20 selection("claude-fable-5", [
21 { id: "contextWindow", value: "1m" },
22 { id: "effort", value: "ultracode" },
23 ]),
24 ),
25 ).toMatchObject({
26 apiModelId: "claude-fable-5[1m]",
27 effort: "xhigh",
28 settings: { ultracode: true },
29 });
30 });
31​
32 it("compiles fast mode only for models that expose it", () => {
33 expect(
34 compileClaudeModelSelection(selection("claude-opus-4-6", [{ id: "fastMode", value: true }]))
35 .settings,
36 ).toEqual({ fastMode: true });
37 });
38​
39 it("uses the model default SDK effort alongside prompt-injected effort", () => {
40 expect(
41 compileClaudeModelSelection(
42 selection("claude-sonnet-4-6", [{ id: "effort", value: "ultrathink" }]),
43 ),
44 ).toMatchObject({ effort: "high", promptEffort: "ultrathink" });
45 });
46​
47 it("compiles the thinking toggle for models that expose it", () => {
48 expect(
49 compileClaudeModelSelection(selection("claude-haiku-4-5", [{ id: "thinking", value: false }]))
50 .settings,
51 ).toEqual({ alwaysThinkingEnabled: false });
52 });
53});