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

claudeModelOptions.test.ts

57 lines1.8 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 expect(
38 compileClaudeModelSelection(selection("claude-opus-4-6", [{ id: "fastMode", value: false }]))
39 .settings,
40 ).toEqual({ fastMode: false });
41 });
42​
43 it("uses the model default SDK effort alongside prompt-injected effort", () => {
44 expect(
45 compileClaudeModelSelection(
46 selection("claude-sonnet-4-6", [{ id: "effort", value: "ultrathink" }]),
47 ),
48 ).toMatchObject({ effort: "high", promptEffort: "ultrathink" });
49 });
50​
51 it("compiles the thinking toggle for models that expose it", () => {
52 expect(
53 compileClaudeModelSelection(selection("claude-haiku-4-5", [{ id: "thinking", value: false }]))
54 .settings,
55 ).toEqual({ alwaysThinkingEnabled: false });
56 });
57});