|
1 | 1 | #!/usr/bin/env zx |
| 2 | +import moment from "moment"; |
2 | 3 | import { exitWithError } from "./utils.mjs"; |
3 | | -import { where, max } from "underscore"; |
| 4 | +import { where, max, sortBy } from "underscore"; |
4 | 5 |
|
5 | 6 | export async function getRegions(profile = "DEFAULT", tenancyId) { |
6 | 7 | try { |
@@ -376,9 +377,29 @@ export async function getLatestGenAIModels( |
376 | 377 | const activeCohereModels = where(data.items, { |
377 | 378 | "lifecycle-state": "ACTIVE", |
378 | 379 | vendor: vendor, |
| 380 | + "is-long-term-supported": true, |
379 | 381 | }); |
380 | 382 |
|
381 | | - const filteredByCapatility = activeCohereModels.filter((model) => { |
| 383 | + const modelsCleaned = activeCohereModels.map((e) => { |
| 384 | + const creationTimeInMillis = moment(e["time-created"]).valueOf(); |
| 385 | + return { |
| 386 | + id: e.id, |
| 387 | + "display-name": e["display-name"], |
| 388 | + capabilities: e.capabilities, |
| 389 | + vendor: e.vendor, |
| 390 | + version: e.version, |
| 391 | + type: e.type, |
| 392 | + "is-long-term-supported": e["is-long-term-supported"], |
| 393 | + "lifecycle-state": e["lifecycle-state"], |
| 394 | + "time-created": e["time-created"], |
| 395 | + creationTimeInMillis, |
| 396 | + }; |
| 397 | + }); |
| 398 | + const sortedByCreationTime = sortBy(modelsCleaned, [ |
| 399 | + "creationTimeInMillis", |
| 400 | + ]); |
| 401 | + |
| 402 | + const filteredByCapatility = sortedByCreationTime.filter((model) => { |
382 | 403 | const { capabilities } = model; |
383 | 404 | if (capabilities.length !== 1) return false; |
384 | 405 | if (capabilities[0] !== capability) return false; |
|
0 commit comments