mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 14:30:28 -05:00
refactor(bedrock): share model profile reachability checks (#9046)
* refactor(bedrock): share model profile reachability checks
This commit is contained in:
1 parent
875794c538
commit
61be3048e7
2 files changed
+7
-5
No files matched your search
@@ -349,8 +349,7 @@ public class BedrockController {
|
||||
if (model.servedInRegion(region)) {
|
||||
inferenceTypes.add("ON_DEMAND");
|
||||
}
|
||||
if (BedrockModelCatalog.profilesFrom(region).stream()
|
||||
.anyMatch(profile -> profile.modelId().equals(model.modelId()))) {
|
||||
if (model.servedThroughProfileFrom(region)) {
|
||||
inferenceTypes.add("INFERENCE_PROFILE");
|
||||
}
|
||||
node.putObject("modelLifecycle").put("status", model.lifecycleStatus());
|
||||
|
||||
@@ -31,6 +31,11 @@ final class BedrockModelCatalog {
|
||||
boolean servedInRegion(String region) {
|
||||
return inRegion.contains(region);
|
||||
}
|
||||
|
||||
boolean servedThroughProfileFrom(String region) {
|
||||
return PROFILES.stream().anyMatch(profile -> profile.modelId().equals(modelId)
|
||||
&& profile.routes().containsKey(region));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,9 +68,7 @@ final class BedrockModelCatalog {
|
||||
/** The models callable from a Region, in their own Region or through one of their profiles. */
|
||||
static List<FoundationModel> modelsIn(String region) {
|
||||
return MODELS.stream()
|
||||
.filter(model -> model.servedInRegion(region) || PROFILES.stream()
|
||||
.anyMatch(profile -> profile.modelId().equals(model.modelId())
|
||||
&& profile.routes().containsKey(region)))
|
||||
.filter(model -> model.servedInRegion(region) || model.servedThroughProfileFrom(region))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user