(model: SDKModel)
| 259 | } |
| 260 | |
| 261 | function modelToChoices(model: SDKModel): ModelChoice[] { |
| 262 | const baseLabel = model.displayName || model.id |
| 263 | const variants = model.variants ?? [] |
| 264 | |
| 265 | if (variants.length === 0) { |
| 266 | return [ |
| 267 | { |
| 268 | label: baseLabel, |
| 269 | value: { id: model.id }, |
| 270 | description: model.description, |
| 271 | }, |
| 272 | ] |
| 273 | } |
| 274 | |
| 275 | const choices = variants.map((variant) => ({ |
| 276 | label: buildVariantLabel(model, variant.displayName), |
| 277 | value: { id: model.id, params: variant.params }, |
| 278 | description: variant.description ?? model.description, |
| 279 | })) |
| 280 | |
| 281 | return disambiguateDuplicateLabels(dedupeModelChoices(choices), model) |
| 282 | } |
| 283 | |
| 284 | function buildVariantLabel(model: SDKModel, variantDisplayName: string) { |
| 285 | const baseLabel = model.displayName || model.id |
nothing calls this directly
no test coverage detected