Skip to content

Interface: IModelRegistryFetcher

Makaio Framework


Makaio Framework / services-core / IModelRegistryFetcher

Defined in: ../../../packages/services/core/src/model-registry/types.ts:82

Interface for fetching the model registry from a source.

Allows for different fetch implementations:

  • CDN/HTTP fetch (browser/Node)
  • Local YAML files
  • Bundled seed
  • Testing: Mock fetch
class CdnRegistryFetcher implements IModelRegistryFetcher {
constructor(private readonly registryUrl: string) {}
async fetch(): Promise<ModelRegistry> {
const response = await fetch(this.registryUrl);
if (!response.ok) {
throw new Error(`Failed to fetch registry: ${response.statusText}`);
}
return parseYaml(await response.text()) as ModelRegistry;
}
}

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/types.ts:94

Fetch the model registry from a source.

Implementations MUST return the result of ModelRegistrySchema.parse() — i.e., a fully validated ModelRegistry. The service layer trusts the returned value directly and does not re-validate it, so schema validation (including the superRefine cross-validation) is the responsibility of the fetcher implementation.

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; }>

The validated model registry

Error if fetch fails or schema validation fails