Download packages/ai/scripts/models-dev-reasoning-options.ts from SaylorTwift/pi: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/SaylorTwift/pi/resolve/main/packages/ai/scripts/models-dev-reasoning-options.ts
- Command line
-
hf download hf://SaylorTwift/pi/packages/ai/scripts/models-dev-reasoning-options.ts
-
curl -L -o models-dev-reasoning-options.ts https://huggingface.co/SaylorTwift/pi/resolve/main/packages/ai/scripts/models-dev-reasoning-options.ts
1.22 kB
| import type { ThinkingLevel, ThinkingLevelMap } from "../src/types.ts"; | |
| export type ModelsDevReasoningOption = | |
| | { type: "toggle" } | |
| | { | |
| type: "effort"; | |
| values: Array<"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "default" | null>; | |
| } | |
| | { type: "budget_tokens"; min?: number; max?: number }; | |
| const THINKING_LEVELS: readonly ThinkingLevel[] = ["minimal", "low", "medium", "high", "xhigh", "max"]; | |
| /** | |
| * Converts models.dev verified effort values into Pi's selectable thinking levels. | |
| * Values without a Pi equivalent (`default` and JSON `null`) are intentionally | |
| * omitted. | |
| */ | |
| export function getEffortThinkingLevelMap(options: readonly ModelsDevReasoningOption[]): ThinkingLevelMap | undefined { | |
| const effortValues = options.flatMap((option) => (option.type === "effort" ? option.values : [])); | |
| if (effortValues.length === 0) return undefined; | |
| const supported = new Set(effortValues); | |
| if (!THINKING_LEVELS.some((level) => supported.has(level)) && !supported.has("none")) return undefined; | |
| const map: ThinkingLevelMap = { off: supported.has("none") ? "none" : null }; | |
| for (const level of THINKING_LEVELS) { | |
| map[level] = supported.has(level) ? level : null; | |
| } | |
| return map; | |
| } | |