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

Function getContextWindow

apps/cli/src/lib/utils/context-window.ts:14–30  ·  view source on GitHub ↗
(routerModels: RouterModels | null, apiConfiguration: ProviderSettings | null)

Source from the content-addressed store, hash-verified

12 * @returns The context window size, or DEFAULT_CONTEXT_WINDOW (200K) if not found
13 */
14export function getContextWindow(routerModels: RouterModels | null, apiConfiguration: ProviderSettings | null): number {
15 if (!routerModels || !apiConfiguration) {
16 return DEFAULT_CONTEXT_WINDOW
17 }
18
19 const provider = apiConfiguration.apiProvider
20 const modelId = getModelIdForProvider(apiConfiguration)
21
22 if (!provider || !modelId) {
23 return DEFAULT_CONTEXT_WINDOW
24 }
25
26 const providerModels = routerModels[provider]
27 const modelInfo = providerModels?.[modelId]
28
29 return modelInfo?.contextWindow ?? DEFAULT_CONTEXT_WINDOW
30}
31
32/**
33 * Gets the model ID from the API configuration based on the provider type.

Callers 1

AppInnerFunction · 0.85

Calls 1

getModelIdForProviderFunction · 0.70

Tested by

no test coverage detected