Class ModelConfig


  • public class ModelConfig
    extends Object
    Configuration for ML models in Otter Stream inference framework.

    Defines how to locate, load, and identify a model. Supports both local models (file system, HDFS, S3) and remote models (REST endpoints, cloud services).

    Model Sources:

    • Local: file://, hdfs://, s3://
    • Remote: HTTP/HTTPS endpoints
    • Cloud: AWS SageMaker, Google Vertex AI, Azure ML

    Usage Examples:

    Local TensorFlow Model:

    
     ModelConfig config = ModelConfig.builder()
         .modelId("fraud-detector")
         .modelPath("file:///models/fraud_detection")
         .format(ModelFormat.TENSORFLOW_SAVEDMODEL)
         .modelVersion("2.0")
         .build();
     

    Remote SageMaker Endpoint:

    
     AuthConfig auth = AuthConfig.builder()
         .apiKey("AWS_ACCESS_KEY")
         .build();
    
     ModelConfig config = ModelConfig.builder()
         .modelId("recommendation-engine")
         .format(ModelFormat.SAGEMAKER)
         .endpointUrl("https://runtime.sagemaker.us-east-1.amazonaws.com/...")
         .authConfig(auth)
         .build();
     

    ONNX Model with Options:

    
     ModelConfig config = ModelConfig.builder()
         .modelId("image-classifier")
         .modelPath("s3://my-bucket/models/resnet50.onnx")
         .format(ModelFormat.ONNX)
         .modelOptions(Map.of(
             "providers", List.of("CUDAExecutionProvider"),  // Use GPU
             "intra_op_num_threads", 4
         ))
         .build();
     
    Since:
    1.0.0
    Author:
    Nestor Martourez, Sr Software and Data Streaming Engineer @ CodedStreams
    See Also:
    ModelFormat, AuthConfig
    • Constructor Detail

      • ModelConfig

        public ModelConfig​(String modelId,
                           String modelPath,
                           ModelFormat format,
                           String modelName,
                           String modelVersion,
                           Map<String,​Object> modelOptions,
                           String endpointUrl,
                           AuthConfig authConfig)
        Constructs model configuration.
        Parameters:
        modelId - unique identifier for this model
        modelPath - file system or URL path to model
        format - model format (TensorFlow, ONNX, PyTorch, etc.)
        modelName - human-readable model name
        modelVersion - version string
        modelOptions - engine-specific model options
        endpointUrl - remote endpoint URL (for remote models)
        authConfig - authentication configuration (for remote models)
    • Method Detail

      • builder

        public static ModelConfig.Builder builder()
        Creates a new builder for ModelConfig.
        Returns:
        a new builder instance
      • getModelId

        public String getModelId()
      • getModelPath

        public String getModelPath()
      • getModelName

        public String getModelName()
      • getModelVersion

        public String getModelVersion()
      • getEndpointUrl

        public String getEndpointUrl()
      • getAuthConfig

        public AuthConfig getAuthConfig()
      • isRemote

        public boolean isRemote()
        Checks if this is a remote model configuration.
        Returns:
        true if model is accessed via remote endpoint