(model: MergedModel)
| 313 | } |
| 314 | |
| 315 | function formatToml(model: MergedModel): string { |
| 316 | const lines: string[] = []; |
| 317 | |
| 318 | if (model.base_model !== undefined) { |
| 319 | lines.push(`base_model = "${model.base_model}"`); |
| 320 | } |
| 321 | if (model.base_model_omit !== undefined) { |
| 322 | lines.push( |
| 323 | `base_model_omit = [${model.base_model_omit.map((item) => `"${item}"`).join(", ")}]`, |
| 324 | ); |
| 325 | } |
| 326 | lines.push(`name = "${model.name.replace(/"/g, '\\"')}"`); |
| 327 | if (model.family) { |
| 328 | lines.push(`family = "${model.family}"`); |
| 329 | } |
| 330 | lines.push(`release_date = "${model.release_date}"`); |
| 331 | lines.push(`last_updated = "${model.last_updated}"`); |
| 332 | lines.push(`attachment = ${model.attachment}`); |
| 333 | lines.push(`reasoning = ${model.reasoning}`); |
| 334 | if (model.structured_output !== undefined) { |
| 335 | lines.push(`structured_output = ${model.structured_output}`); |
| 336 | } |
| 337 | lines.push(`temperature = ${model.temperature}`); |
| 338 | lines.push(`tool_call = ${model.tool_call}`); |
| 339 | if (model.knowledge) { |
| 340 | lines.push(`knowledge = "${model.knowledge}"`); |
| 341 | } |
| 342 | lines.push(`open_weights = ${model.open_weights}`); |
| 343 | if (model.status) { |
| 344 | lines.push(`status = "${model.status}"`); |
| 345 | } |
| 346 | |
| 347 | if (model.interleaved !== undefined) { |
| 348 | lines.push(""); |
| 349 | if (model.interleaved === true) { |
| 350 | lines.push("interleaved = true"); |
| 351 | } else if (model.interleaved !== false) { |
| 352 | lines.push("[interleaved]"); |
| 353 | lines.push(`field = "${model.interleaved.field}"`); |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | if (model.cost) { |
| 358 | lines.push(""); |
| 359 | lines.push("[cost]"); |
| 360 | lines.push(`input = ${formatDecimal(model.cost.input)}`); |
| 361 | lines.push(`output = ${formatDecimal(model.cost.output)}`); |
| 362 | if (model.cost.cache_read !== undefined) { |
| 363 | lines.push(`cache_read = ${formatDecimal(model.cost.cache_read)}`); |
| 364 | } |
| 365 | if (model.cost.cache_write !== undefined) { |
| 366 | lines.push(`cache_write = ${formatDecimal(model.cost.cache_write)}`); |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | lines.push(""); |
| 371 | lines.push("[limit]"); |
| 372 | lines.push(`context = ${formatNumber(model.limit.context)}`); |
no test coverage detected