Class ModelConfig
- java.lang.Object
-
- com.codedstream.otterstream.inference.config.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classModelConfig.BuilderBuilder for creating ModelConfig instances.
-
Constructor Summary
Constructors Constructor Description ModelConfig(String modelId, String modelPath, ModelFormat format, String modelName, String modelVersion, Map<String,Object> modelOptions, String endpointUrl, AuthConfig authConfig)Constructs model configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ModelConfig.Builderbuilder()Creates a new builder for ModelConfig.AuthConfiggetAuthConfig()StringgetEndpointUrl()ModelFormatgetFormat()StringgetModelId()StringgetModelName()Map<String,Object>getModelOptions()StringgetModelPath()StringgetModelVersion()booleanisRemote()Checks if this is a remote model configuration.
-
-
-
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 modelmodelPath- file system or URL path to modelformat- model format (TensorFlow, ONNX, PyTorch, etc.)modelName- human-readable model namemodelVersion- version stringmodelOptions- engine-specific model optionsendpointUrl- 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()
-
getFormat
public ModelFormat getFormat()
-
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
-
-