Skip to content

Class: CachedRegistryFetcher

Makaio Framework


Makaio Framework / services-core / CachedRegistryFetcher

Defined in: ../../../packages/services/core/src/model-registry/cached-registry-fetcher.ts:18

Decorator that adds disk/persistent caching around a fetcher.

On success: caches the result for future use. On failure: returns cached data if available, otherwise rethrows so the next fetcher in a fallback chain can be tried.

const cached = new CachedRegistryFetcher(
new CdnRegistryFetcher('https://example.com/model-registry.yaml'),
new FileRegistryCache(path.join(makaioHome, 'cache', 'model-registry.json')),
);

new CachedRegistryFetcher(inner, cache): CachedRegistryFetcher

Defined in: ../../../packages/services/core/src/model-registry/cached-registry-fetcher.ts:27

Creates a new CachedRegistryFetcher.

IModelRegistryFetcher

The fetcher to wrap with caching

IModelRegistryCache

The cache implementation for persistence

CachedRegistryFetcher

fetch(): Promise<{ $schema: "makaio/model-registry/v2"; labs: Record<string, { models: object[]; name: string; }>; providers: Record<string, { models: Record<string, { canonicalModel?: string; contextWindowSize?: number; family?: string; friendlyName?: string; labId?: undefined; metadata?: { capabilities?: { parallelToolCalls?: … | … | …; pdfUpload?: … | … | …; speechToText?: … | …; structuredOutput?: … | … | …; textToSpeech?: … | …; toolCalling?: … | … | …; vision?: … | … | …; }; description?: string; includedInSubscription?: boolean; maxOutputTokens?: number; pricing?: { request?: … | …; token?: … | …; }; }; name?: undefined; supportedReasoningLevels?: { extra-high?: string | number; high?: string | number; low?: string | number; medium?: string | number; none?: string | number; }; }>; name: string; }>; updatedAt: string; }>

Defined in: ../../../packages/services/core/src/model-registry/cached-registry-fetcher.ts:37

Fetch from the inner fetcher with cache fallback.

Promise<{ $schema: "makaio/model-registry/v2"; labs: Record<string, { models: object[]; name: string; }>; providers: Record<string, { models: Record<string, { canonicalModel?: string; contextWindowSize?: number; family?: string; friendlyName?: string; labId?: undefined; metadata?: { capabilities?: { parallelToolCalls?: … | … | …; pdfUpload?: … | … | …; speechToText?: … | …; structuredOutput?: … | … | …; textToSpeech?: … | …; toolCalling?: … | … | …; vision?: … | … | …; }; description?: string; includedInSubscription?: boolean; maxOutputTokens?: number; pricing?: { request?: … | …; token?: … | …; }; }; name?: undefined; supportedReasoningLevels?: { extra-high?: string | number; high?: string | number; low?: string | number; medium?: string | number; none?: string | number; }; }>; name: string; }>; updatedAt: string; }>

Registry from inner fetcher (fresh) or cache (stale fallback)

Error if inner fetch fails and no cached data exists

IModelRegistryFetcher.fetch