(modelName: string, model: OllamaModel)
| 87 | type OllamaModelDetails = z.infer<typeof OllamaModelDetails>; |
| 88 | |
| 89 | function 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 | |
| 118 | const tagsResponse = await fetch("https://ollama.com/api/tags"); |
| 119 | if (!tagsResponse.ok) { |
no outgoing calls
no test coverage detected