(model: z.infer<typeof ModelMetadata>)
| 831 | } |
| 832 | |
| 833 | function 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 | |
| 846 | export async function main(args = process.argv.slice(2)) { |
| 847 | if (args.includes("--list-providers")) { |
no test coverage detected