{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Document", "description": "The top level Runefile type.", "anyOf": [ { "$ref": "#/definitions/DocumentV1" } ], "definitions": { "Argument": { "description": "Something that could be either a reference to a resource (`$resource`) or a plain string (`./path`).", "anyOf": [ { "$ref": "#/definitions/ResourceName" }, { "type": "string" }, { "type": "number" } ] }, "CapabilityStage": { "description": "A stage which reads inputs from the runtime.", "type": "object", "required": [ "capability" ], "properties": { "args": { "type": "object", "additionalProperties": { "$ref": "#/definitions/Argument" } }, "capability": { "description": "What type of capability to use (\"IMAGE\", \"SOUND\", etc.).", "type": "string" }, "outputs": { "type": "array", "items": { "$ref": "#/definitions/Type" } } } }, "DocumentV1": { "description": "Version 1 of the `Runefile.yml` format.", "type": "object", "required": [ "image", "pipeline", "version" ], "properties": { "image": { "description": "The base image that defines the interface between a Rune and its runtime.\n\nThis should always be `\"runicos/base\"`.", "allOf": [ { "$ref": "#/definitions/Path" } ] }, "pipeline": { "description": "The various stages in the Runefile's pipeline.", "type": "object", "additionalProperties": { "$ref": "#/definitions/Stage" } }, "resources": { "description": "Any resources that can be accessed by pipeline stages.", "default": {}, "type": "object", "additionalProperties": { "$ref": "#/definitions/ResourceDeclaration" } }, "version": { "description": "The version number. Must always be `\"1\"`.", "type": "integer", "format": "uint", "maximum": 1.0, "minimum": 1.0 } } }, "Input": { "description": "\nThe name of a tensor.\n\nTypically something like \"stage\", or \"stage.2\" if the stage has multiple outputs.\n", "type": "string", "format": "string", "pattern": "^(?P[a-zA-Z_][\\w-]*)(?:\\.(?P\\d+))?$" }, "ModelStage": { "description": "A ML model which will be executed by the runtime.", "type": "object", "required": [ "model" ], "properties": { "args": { "type": "object", "additionalProperties": { "$ref": "#/definitions/Argument" } }, "inputs": { "description": "Tensors to use as input to this model.", "type": "array", "items": { "$ref": "#/definitions/Input" } }, "model": { "description": "The model to use, or a resource which specifies the model to use.", "anyOf": [ { "$ref": "#/definitions/ResourceName" }, { "type": "string" } ] }, "outputs": { "description": "The tensors that this model outputs.", "type": "array", "items": { "$ref": "#/definitions/Type" } } } }, "OutStage": { "description": "A stage which passes outputs back to the runtime.", "type": "object", "required": [ "out" ], "properties": { "args": { "type": "object", "additionalProperties": { "$ref": "#/definitions/Argument" } }, "inputs": { "type": "array", "items": { "$ref": "#/definitions/Input" } }, "out": { "description": "The type of output (e.g. \"SERIAL\").", "type": "string" } } }, "Path": { "description": "\nA specification for finding a dependency.\n\nThe full syntax is `base@version#sub_path` where\n\n- `base` is a URL or the name of a repository on GitHub (e.g. `hotg-ai/rune`\n or `https://github.com/hotg-ai/rune`)\n- `version` is an optional field specifying the version (e.g. as a git tag)\n- `sub_path` is an optional field which is useful when pointing to\n repositories with multiple relevant items because it lets you specify\n which directory the specified item is in.\n", "type": "string", "format": "string", "pattern": "(?x)\n (?P[\\w\\d:/_.-]+)\n (?:@(?P[\\w\\d./-]+))?\n (?:\\#(?P[\\w\\d._/-]+))?\n " }, "ProcBlockStage": { "description": "A stage which executes a procedural block.", "type": "object", "required": [ "proc-block" ], "properties": { "args": { "type": "object", "additionalProperties": { "$ref": "#/definitions/Argument" } }, "inputs": { "type": "array", "items": { "$ref": "#/definitions/Input" } }, "outputs": { "type": "array", "items": { "$ref": "#/definitions/Type" } }, "proc-block": { "description": "A [`Path`] that Rune can use to locate the proc block.", "type": "string", "format": "string", "pattern": "(?x)\n (?P[\\w\\d:/_.-]+)\n (?:@(?P[\\w\\d./-]+))?\n (?:\\#(?P[\\w\\d._/-]+))?\n " } } }, "ResourceDeclaration": { "description": "The declaration for a resource, typically something like a wordlist or environment variable.", "type": "object", "properties": { "inline": { "description": "A resource who's default value is specified inline.", "type": [ "string", "null" ] }, "path": { "description": "A resource who's default value is meant to be loaded from a file.", "type": [ "string", "null" ] }, "type": { "default": "string", "allOf": [ { "$ref": "#/definitions/ResourceType" } ] } }, "additionalProperties": false }, "ResourceName": { "description": "\nA reference to some [`ResourceDeclaration`]. It typically looks like\n`$RESOURCE_NAME`.\n", "type": "string", "format": "string", "pattern": "^\\$[_a-zA-Z][_a-zA-Z0-9]*$" }, "ResourceType": { "description": "How the resource should be treated inside the Rune.", "type": "string", "enum": [ "string", "binary" ] }, "Stage": { "description": "A stage in the Rune's pipeline.", "anyOf": [ { "$ref": "#/definitions/ModelStage" }, { "$ref": "#/definitions/ProcBlockStage" }, { "$ref": "#/definitions/CapabilityStage" }, { "$ref": "#/definitions/OutStage" } ] }, "Type": { "description": "The element type and dimensions for a particular tensor.", "type": "object", "required": [ "type" ], "properties": { "dimensions": { "type": "array", "items": { "type": "integer", "format": "uint", "minimum": 0.0 } }, "type": { "type": "string" } } } } }