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

Function generateToml

packages/core/script/generate-ollama-cloud.ts:89–116  ·  view source on GitHub ↗
(modelName: string, model: OllamaModel)

Source from the content-addressed store, hash-verified

87type OllamaModelDetails = z.infer<typeof OllamaModelDetails>;
88
89function generateToml(modelName: string, model: OllamaModel): string {
90 const lines: string[] = [];
91
92 lines.push(`name = "${modelName}"`);
93 lines.push(`family = "${model.family}"`);
94 lines.push(`attachment = ${model.attachment}`);
95 lines.push(`reasoning = ${model.reasoning}`);
96 lines.push(`tool_call = ${model.tool_call}`);
97 if (model.release_date) {
98 lines.push(`release_date = "${model.release_date}"`);
99 }
100 if (model.knowledge) {
101 lines.push(`knowledge = "${model.knowledge}"`);
102 }
103 lines.push(`last_updated = "${model.last_updated}"`);
104 lines.push(`open_weights = ${model.open_weights}`);
105 lines.push("");
106 lines.push("[limit]");
107 lines.push(`context = ${model.limit.context}`);
108 if (model.limit.output !== undefined) {
109 lines.push(`output = ${model.limit.output}`);
110 }
111 lines.push("");
112 lines.push("[modalities]");
113 lines.push(`input = ${JSON.stringify(model.modalities.input)}`);
114 lines.push(`output = ${JSON.stringify(model.modalities.output)}`);
115 return lines.join("\n") + "\n";
116}
117
118const tagsResponse = await fetch("https://ollama.com/api/tags");
119if (!tagsResponse.ok) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected