| 1 | import type { ProviderView } from "./types"; |
| 2 | |
| 3 | /** Prefer the exact model's resolved contract, including an empty option list. */ |
| 4 | export function providerModelReasoningLevels(provider: ProviderView | undefined, model: string): string[] { |
| 5 | if (!provider) return []; |
| 6 | const reasoning = provider.modelCapabilities?.find(item => item.model === model)?.reasoning; |
| 7 | if (reasoning) return reasoning.options.map(option => option.id); |
| 8 | |
| 9 | // Older hosts may omit resolved metadata. Keep their explicit declarations |
| 10 | // usable without overriding a newer host's unsupported/unknown capability. |
| 11 | const override = provider.modelOverrides?.find(item => item.model === model); |
| 12 | if ((override?.reasoningProtocol || provider.reasoningProtocol) === "none") return []; |
| 13 | return override?.supportedEfforts?.length ? override.supportedEfforts : provider.supportedEfforts ?? []; |
| 14 | } |
| 15 |