Skip to content

Commit 64e225e

Browse files
committed
Use dated models as well
1 parent 0b3d827 commit 64e225e

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

types/openai.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ export const OpenAIModels: Record<string, OpenAIModel> = {
6363

6464
const normalizeModelId = (modelId: string): string => {
6565
// Strip a trailing date suffix like -YYYY-MM-DD (e.g., gpt-5-nano-2025-02-02 -> gpt-5-nano).
66-
// For now, we won't do this, because it seems dated models are not always well supported.
67-
// Code to nowmalize: return modelId.replace(/-\d{4}-\d{2}-\d{2}$/i, "")
68-
return modelId
66+
return modelId.replace(/-\d{4}-\d{2}-\d{2}$/i, "")
6967
}
7068

7169
export const maxInputTokensForModel = (modelId: string) => {

utils/app/azure.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,26 @@
1717
*/
1818

1919
export const getAzureDeploymentIdForModelId = (deploymentId: string, modelId: string) => {
20+
// Drop "-YYYY-MM-DD" from model name.
21+
const cleanModelId = modelId.replace(/-\d{4}-\d{2}-\d{2}$/, "")
22+
2023
// Use a ';'-separated list of IDs.
2124
const ids = deploymentId.split(";")
2225

23-
// If there are no IDs, return the modelId.
26+
// If there are no IDs, return the cleanModelId.
2427
if (ids.length === 0) {
25-
return modelId
28+
return cleanModelId
2629
}
2730

28-
// Find an exact match for an ID ending in modelId.
29-
const found = ids.filter((id) => id.endsWith(modelId))
31+
// Find an exact match for an ID ending in cleanModelId.
32+
const found = ids.filter((id) => id.endsWith(cleanModelId))
3033
if (found.length > 0) {
3134
return found[0]
3235
}
3336

34-
// Otherwise, replace the prefix if there's a "-" in modelId.
37+
// Otherwise, replace the prefix if there's a "-" in cleanModelId.
3538
if (ids[0].includes("-")) {
36-
return deploymentId.split("-")[0] + "-" + modelId
39+
return deploymentId.split("-")[0] + "-" + cleanModelId
3740
} else {
3841
return ids[0]
3942
}

0 commit comments

Comments
 (0)