MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / shouldUseReasoningEffort

Function shouldUseReasoningEffort

src/shared/api.ts:52–97  ·  view source on GitHub ↗
({
	model,
	settings,
}: {
	model: ModelInfo
	settings?: ProviderSettings
})

Source from the content-addressed store, hash-verified

50}): boolean => !!model.requiredReasoningBudget || (!!model.supportsReasoningBudget && !!settings?.enableReasoningEffort)
51
52export const shouldUseReasoningEffort = ({
53 model,
54 settings,
55}: {
56 model: ModelInfo
57 settings?: ProviderSettings
58}): boolean => {
59 // Explicit off switch
60 if (settings?.enableReasoningEffort === false) return false
61
62 // Selected effort from settings or model default
63 const selectedEffort = (settings?.reasoningEffort ?? (model as any).reasoningEffort) as
64 | "disable"
65 | "none"
66 | "minimal"
67 | "low"
68 | "medium"
69 | "high"
70 | undefined
71
72 // "disable" explicitly omits reasoning
73 if (selectedEffort === "disable") return false
74
75 const cap = model.supportsReasoningEffort as unknown
76
77 // Capability array: use only if selected is included (treat "none"/"minimal" as valid)
78 if (Array.isArray(cap)) {
79 return !!selectedEffort && (cap as ReadonlyArray<string>).includes(selectedEffort as string)
80 }
81
82 // Boolean capability: true → require a selected effort
83 if (model.supportsReasoningEffort === true) {
84 return !!selectedEffort
85 }
86
87 // Not explicitly supported: only allow when the model itself defines a default effort
88 // Ignore settings-only selections when capability is absent/false
89 const modelDefaultEffort = (model as any).reasoningEffort as
90 | "none"
91 | "minimal"
92 | "low"
93 | "medium"
94 | "high"
95 | undefined
96 return !!modelDefaultEffort
97}
98
99export const DEFAULT_HYBRID_REASONING_MODEL_MAX_TOKENS = 16_384
100export const DEFAULT_HYBRID_REASONING_MODEL_THINKING_TOKENS = 8_192

Callers 5

api.spec.tsFile · 0.90
createMessageMethod · 0.90
getOpenRouterReasoningFunction · 0.90
getOpenAiReasoningFunction · 0.90
getModelParamsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected