From 67c562a76f8a010dfd9be7359022ab0070aba1dc Mon Sep 17 00:00:00 2001 From: Brian Flores Date: Mon, 16 Dec 2024 10:27:49 -0800 Subject: [PATCH] add preset xContentRegistry to ingestProcessors for custom parametized 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 --- .../java/org/opensearch/ml/plugin/MachineLearningPlugin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java b/plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java index 065e0ec371..e3097e25db 100644 --- a/plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java +++ b/plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java @@ -1062,10 +1062,12 @@ public void loadExtensions(ExtensionLoader loader) { @Override public Map getProcessors(org.opensearch.ingest.Processor.Parameters parameters) { Map 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); }