File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -63,9 +63,7 @@ export const OpenAIModels: Record<string, OpenAIModel> = {
6363
6464const 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
7169export const maxInputTokensForModel = ( modelId : string ) => {
Original file line number Diff line number Diff line change 1717 */
1818
1919export 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 }
You can’t perform that action at this time.
0 commit comments