Skip to content

Commit 35abae5

Browse files
committed
add script changes for CHAT models
1 parent fa32525 commit 35abae5

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

scripts/lib/oci.mjs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env zx
2+
import moment from "moment";
23
import { exitWithError } from "./utils.mjs";
3-
import { where, max } from "underscore";
4+
import { where, max, sortBy } from "underscore";
45

56
export async function getRegions(profile = "DEFAULT", tenancyId) {
67
try {
@@ -376,9 +377,29 @@ export async function getLatestGenAIModels(
376377
const activeCohereModels = where(data.items, {
377378
"lifecycle-state": "ACTIVE",
378379
vendor: vendor,
380+
"is-long-term-supported": true,
379381
});
380382

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) => {
382403
const { capabilities } = model;
383404
if (capabilities.length !== 1) return false;
384405
if (capabilities[0] !== capability) return false;

scripts/setenv.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ async function setLatestGenAIModelChat() {
150150
compartmentId,
151151
regionName,
152152
"cohere",
153-
"TEXT_GENERATION"
153+
"CHAT"
154154
);
155155

156156
const { id, vendor: vendorName, version, capabilities } = latestVersionModel;
@@ -161,7 +161,7 @@ async function setLatestGenAIModelChat() {
161161
version
162162
)} (${chalk.green(displayName)}) with ${chalk.green(
163163
capabilities.join(",")
164-
)} created ${timeCreated}`
164+
)} created ${timeCreated} (${id})`
165165
);
166166

167167
config.set("genAiModelChat", id);
@@ -173,7 +173,7 @@ async function setLatestGenAIModelSummarization() {
173173
compartmentId,
174174
regionName,
175175
"cohere",
176-
"TEXT_SUMMARIZATION"
176+
"CHAT"
177177
);
178178

179179
const { id, vendor: vendorName, version, capabilities } = latestVersionModel;
@@ -184,7 +184,7 @@ async function setLatestGenAIModelSummarization() {
184184
version
185185
)} (${chalk.green(displayName)}) with ${chalk.green(
186186
capabilities.join(",")
187-
)} created ${timeCreated}`
187+
)} created ${timeCreated} (${id})`
188188
);
189189

190190
config.set("genAiModelSummarization", id);

0 commit comments

Comments
 (0)