{
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "$id" : "https://voltdb.com/voltsp/schemas/resource/onnx-genai",
  "title" : "Onnx-genai Resource Configuration",
  "description" : "This `onnx-genai` resource loads and initializes an ONNX GenAI model that processors can reference.\nIt handles downloading and caching of model files, as well as loading the necessary native libraries.\n\nSee the official ONNX GenAI [github repo](https://github.com/microsoft/onnxruntime-genai) for more information.\n\n## Models\n\nSupported model architectures as of onnx-genai-0.8.3 release are: AMD OLMo, ChatGLM, DeepSeek, ERNIE 4.5,\nGemma, Granite, Llama (and derivatives), Mistral (and derivatives), Nemotron, Phi (language + vision), Qwen\n\n## Downloads\n\nThe `modelUri` can point to a location on local disk (using `file://` scheme) or on a remote storage.\nRemote storage support depends on available plugins, e.g., S3 plugin allows downloads from an S3-compatible bucket.\n\n## Files\n\nThe `modelUri` should point to a location containing the following files:\n— genai_config.json\n— model.onnx\n— model.onnx.data\n— tokenizer.json\n— tokenizer_config.json\n",
  "type" : "object",
  "properties" : {
    "onnx-genai" : {
      "type" : "object",
      "properties" : {
        "modelUri" : {
          "type" : "string",
          "format" : "uri",
          "description" : "URI to the directory containing the model files. Required if modelResource is not specified."
        },
        "printDownloadProgress" : {
          "type" : "boolean",
          "description" : "Whether to display progress information during model file downloads.",
          "default" : "false"
        },
        "cache" : {
          "type" : "object",
          "description" : "This configuration controls how model files are cached locally, including the cache location,\nsize limits, expiration policy, and cleanup behavior. If not provided files will be cached in the /tmp directory.\n",
          "properties" : {
            "directory" : {
              "type" : "string",
              "description" : "Directory where files will be cached. If not specified, a temporary directory will be created."
            },
            "maxCacheSize" : {
              "type" : "integer",
              "description" : "Maximum size of the cache in bytes. Files will be evicted when the cache exceeds this size. Use 0 for unlimited.",
              "default" : "0",
              "minimum" : -9223372036854775808,
              "maximum" : 9223372036854775807
            },
            "expirationTime" : {
              "type" : "string",
              "pattern" : "^(\\d+[smhd]|P(T|\\d+[YMD]).*)",
              "description" : "Duration after which cached files are considered stale and will not be used by the system."
            },
            "cleanupOnStart" : {
              "type" : "boolean",
              "description" : "Whether to clean up expired or invalid cache entries when the cache is initialized.",
              "default" : "false"
            }
          },
          "additionalProperties" : false
        }
      },
      "required" : [ "modelUri" ],
      "additionalProperties" : false
    }
  },
  "required" : [ "onnx-genai" ],
  "additionalProperties" : false
}
