MCPcopy
hub / github.com/anomalyco/models.dev / formatMetadataToml

Function formatMetadataToml

packages/core/src/sync/index.ts:833–844  ·  view source on GitHub ↗
(model: z.infer<typeof ModelMetadata>)

Source from the content-addressed store, hash-verified

831}
832
833function formatMetadataToml(model: z.infer<typeof ModelMetadata>) {
834 const content = formatToml(model as unknown as z.infer<typeof SyncedAuthoredModel>).trimEnd();
835 const lines = [content];
836 for (const weight of model.weights ?? []) {
837 lines.push("", "[[weights]]");
838 if (weight.label !== undefined) lines.push(`label = ${quote(weight.label)}`);
839 lines.push(`url = ${quote(weight.url)}`);
840 if (weight.format !== undefined) lines.push(`format = ${quote(weight.format)}`);
841 if (weight.quantization !== undefined) lines.push(`quantization = ${quote(weight.quantization)}`);
842 }
843 return `${lines.join("\n")}\n`;
844}
845
846export async function main(args = process.argv.slice(2)) {
847 if (args.includes("--list-providers")) {

Callers 1

syncProviderFunction · 0.85

Calls 2

quoteFunction · 0.85
formatTomlFunction · 0.70

Tested by

no test coverage detected