llm-switcher 1.6.9 → 1.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/windows.mjs CHANGED
@@ -21,7 +21,8 @@ const FETCH_TIMEOUT_MS = 15000;
21
21
 
22
22
  const n = v => (Number.isFinite(v) && v > 0 ? Math.round(v) : 0);
23
23
 
24
- // One entry of a provider's list -> the two windows, or null when it names none.
24
+ // One entry of a provider's list -> the two windows, plus `output` (the most the model writes)
25
+ // when the list names it; null when it names none.
25
26
  export function parseModelWindows(m) {
26
27
  if (!m || typeof m !== 'object') return null;
27
28
  const top = m.top_provider && typeof m.top_provider === 'object' ? m.top_provider : {};
@@ -30,8 +31,9 @@ export function parseModelWindows(m) {
30
31
  // smaller of the two windows it publishes.
31
32
  const compact = n(m.compact_window) || n(m.compaction_threshold)
32
33
  || (context && n(m.context_window) && n(m.context_window) < context ? n(m.context_window) : 0);
33
- if (!context && !compact) return null;
34
- return { context, compact };
34
+ const output = n(m.max_output_tokens) || n(top.max_completion_tokens);
35
+ if (!context && !compact && !output) return null;
36
+ return output ? { context, compact, output } : { context, compact };
35
37
  }
36
38
 
37
39
  // The list as it names the models, so a caller can look one up by the id a profile maps.