(modelId: string)
| 1056 | |
| 1057 | //This strips any region prefix that used on cross-region model inference ARNs |
| 1058 | private parseBaseModelId(modelId: string): string { |
| 1059 | if (!modelId) { |
| 1060 | return modelId |
| 1061 | } |
| 1062 | |
| 1063 | // Remove AWS cross-region inference profile prefixes |
| 1064 | // as defined in AWS_INFERENCE_PROFILE_MAPPING |
| 1065 | for (const [_, inferenceProfile] of AWS_INFERENCE_PROFILE_MAPPING) { |
| 1066 | if (modelId.startsWith(inferenceProfile)) { |
| 1067 | // Remove the inference profile prefix from the model ID |
| 1068 | return modelId.substring(inferenceProfile.length) |
| 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | // Also strip Global Inference profile prefix if present |
| 1073 | if (modelId.startsWith("global.")) { |
| 1074 | return modelId.substring("global.".length) |
| 1075 | } |
| 1076 | |
| 1077 | // Return the model ID as-is for all other cases |
| 1078 | return modelId |
| 1079 | } |
| 1080 | |
| 1081 | //Prompt Router responses come back in a different sequence and the model used is in the response and must be fetched by name |
| 1082 | getModelById(modelId: string, modelType?: string): { id: BedrockModelId | string; info: ModelInfo } { |
no outgoing calls
no test coverage detected