UNPKG

@mastra/core

Version:
29 lines • 1.37 kB
import type { GatewayManager, GatewayModel, MastraModelGatewayInterface } from '../llm/model/gateways/index.js'; /** * Model catalog cache with two refresh speeds. * * Remote gateways download public catalogs (models.dev's is ~6 MB). Once a * downloaded catalog is older than {@link REMOTE_CATALOG_REFRESH_MS}, the next * call refreshes it in the background and keeps serving the last good result, * including when the refresh fails. A call waits for a remote gateway only * while it has nothing to serve: before its first successful download. * * Everything else (configured gateways and per-provider auth) is rebuilt at * most every {@link MODEL_CATALOG_TTL_MS}, or on the next call after * {@link invalidate}, on top of the latest remote snapshot. * * Concurrent callers share one build. Each remote gateway downloads on its * own, so a slow or stalled one never holds back the others. */ export declare class ModelCatalogCache { #private; constructor(manager: GatewayManager, isRemote: (gateway: MastraModelGatewayInterface) => boolean); list(): Promise<GatewayModel[]>; /** * Rebuild configured gateways and auth on the next call (for example after a * credential change), and download the remote catalogs again in the * background. */ invalidate(): void; } //# sourceMappingURL=model-catalog-cache.d.ts.map