Skip to content

Commit 67c562a

Browse files
committed
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 <[email protected]>
1 parent c2a40c1 commit 67c562a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,12 @@ public void loadExtensions(ExtensionLoader loader) {
10621062
@Override
10631063
public Map<String, org.opensearch.ingest.Processor.Factory> getProcessors(org.opensearch.ingest.Processor.Parameters parameters) {
10641064
Map<String, org.opensearch.ingest.Processor.Factory> processors = new HashMap<>();
1065+
NamedXContentRegistry contentRegistry = new NamedXContentRegistry(getNamedXContent());
1066+
10651067
processors
10661068
.put(
10671069
MLInferenceIngestProcessor.TYPE,
1068-
new MLInferenceIngestProcessor.Factory(parameters.scriptService, parameters.client, xContentRegistry)
1070+
new MLInferenceIngestProcessor.Factory(parameters.scriptService, parameters.client, contentRegistry)
10691071
);
10701072
return Collections.unmodifiableMap(processors);
10711073
}

0 commit comments

Comments
 (0)