Skip to content

Commit

Permalink
add preset xContentRegistry to ingestProcessors for custom parametize…
Browse files Browse the repository at this point in the history
…d local models

Curently local models that use the parameters map within the payload to create a request can not create objects to be used for local model prediction. This requires a opensearch core change because it needs the contentRegistry,however given there is not much dependency on the registry (currently) we can give it the preset registry given in the MachineLearningPlugin class vai the getNamedXContent() class

Signed-off-by: Brian Flores <iflorbri@amazon.com>
  • Loading branch information
brianf-aws committed Dec 16, 2024
1 parent c2a40c1 commit 67c562a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1062,10 +1062,12 @@ public void loadExtensions(ExtensionLoader loader) {
@Override
public Map<String, org.opensearch.ingest.Processor.Factory> getProcessors(org.opensearch.ingest.Processor.Parameters parameters) {
Map<String, org.opensearch.ingest.Processor.Factory> processors = new HashMap<>();
NamedXContentRegistry contentRegistry = new NamedXContentRegistry(getNamedXContent());

processors
.put(
MLInferenceIngestProcessor.TYPE,
new MLInferenceIngestProcessor.Factory(parameters.scriptService, parameters.client, xContentRegistry)
new MLInferenceIngestProcessor.Factory(parameters.scriptService, parameters.client, contentRegistry)
);
return Collections.unmodifiableMap(processors);
}
Expand Down

0 comments on commit 67c562a

Please sign in to comment.