Skip to content

Processors

Processors are VoltStreamFunction implementations that encapsulate a dedicated, specific logic. They are ready-made components that ease implementation of common features. Examples include the VoltDB procedure cache processor, AI inference processors (based on ONNX), and the JavaScript execution processor.

They transform, filter, enrich, or route events that flow through your pipeline just like a typical VoltStreamFunction would. They come packaged with configuration DSLs for both Java and YAML.

They can be used in place you would normally use VoltStreamFunction.

public class JavaScriptExamplePipeline implements VoltPipeline {
    @Override
    public void define(VoltStreamBuilder stream) {
        stream
                .consumeFromSource(Sources.collection("Tell me a short joke."))
                .processWith(OnnxGenaiProcessorConfigBuilder.builder()
                    .withModelUri(value)
                ) // <<-- processor
                .terminateWithSink(Sinks.stdout());
    }
}
version: 1
name: OnnxGenaiDirectModel

source:
    collection:
        elements:
            - "Tell me a short joke."

processors:
    -   onnx-genai:
            modelUri: "file:///path/to/model"
            chatTemplate: "<|user|>\n{input} <|end|>\n<|assistant|>"
            streamResponse: true
            properties:
                max_length: "2048"
                temperature: "0.7"

sink:
    stdout: {}