Skip to content

Commit

Permalink
Use FieldInferenceMetadata structure in dependencies
Browse files Browse the repository at this point in the history
carlosdelest committed Mar 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 588e67f commit f8d443b
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -77,8 +77,8 @@ public static void getInstance(
) {
Set<String> inferenceIds = new HashSet<>();
shardIds.stream().map(ShardId::getIndex).collect(Collectors.toSet()).stream().forEach(index -> {
var fieldsForModels = clusterState.metadata().index(index).getFieldsForModels();
inferenceIds.addAll(fieldsForModels.keySet());
var fieldsForInferenceIds = clusterState.metadata().index(index).getFieldInferenceMetadata().getFieldsForInferenceIds();
inferenceIds.addAll(fieldsForInferenceIds.keySet());
});
final Map<String, InferenceProvider> inferenceProviderMap = new ConcurrentHashMap<>();
Runnable onModelLoadingComplete = () -> listener.onResponse(
@@ -135,11 +135,11 @@ public void processBulkShardRequest(
BiConsumer<BulkItemRequest, Exception> onBulkItemFailure
) {

Map<String, Set<String>> fieldsForModels = clusterState.metadata()
Map<String, Set<String>> fieldsForInferenceIds = clusterState.metadata()
.index(bulkShardRequest.shardId().getIndex())
.getFieldsForModels();
.getFieldInferenceMetadata().getFieldsForInferenceIds();
// No inference fields? Terminate early
if (fieldsForModels.isEmpty()) {
if (fieldsForInferenceIds.isEmpty()) {
listener.onResponse(bulkShardRequest);
return;
}
@@ -177,7 +177,7 @@ public void processBulkShardRequest(
if (bulkItemRequest != null) {
performInferenceOnBulkItemRequest(
bulkItemRequest,
fieldsForModels,
fieldsForInferenceIds,
i,
onBulkItemFailureWithIndex,
bulkItemReqRef.acquire()

0 comments on commit f8d443b

Please sign in to comment.