MCPcopy Index your code
hub / github.com/anomalyco/models.dev / readModelMetadata

Function readModelMetadata

packages/core/src/sync/index.ts:451–468  ·  view source on GitHub ↗
(modelsDir: string)

Source from the content-addressed store, hash-verified

449}
450
451async function readModelMetadata(modelsDir: string) {
452 const metadataDir = modelMetadataDir(modelsDir);
453 const result: Record<string, Record<string, unknown>> = {};
454
455 for await (const modelPath of new Bun.Glob("**/*.toml").scan({
456 cwd: metadataDir,
457 absolute: true,
458 followSymlinks: true,
459 })) {
460 const modelID = path.relative(metadataDir, modelPath).split(path.sep).join("/").slice(0, -5);
461 const toml = Bun.TOML.parse(
462 await Bun.file(modelPath).text(),
463 ) as Record<string, unknown>;
464 result[modelID] = inheritableModelMetadata(toml);
465 }
466
467 return result;
468}
469
470function modelMetadataDir(modelsDir: string) {
471 return path.join(path.dirname(path.dirname(path.dirname(modelsDir))), "models");

Callers 2

syncProviderFunction · 0.85
readExistingFunction · 0.85

Calls 2

modelMetadataDirFunction · 0.85
inheritableModelMetadataFunction · 0.70

Tested by

no test coverage detected