File size: 7,296 Bytes
747e7be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Inference Configuration",
  "description": "Configuration schema for model inference entrypoint",
  "type": "object",
  "required": ["schema_version", "inference_type", "load_time_parameters"],
  "definitions": {
    "ggufFile": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "^(?!/)(?:[^/\\n]+/)*[^/\\n]+\\.gguf$",
          "description": "Relative path to .gguf file (no leading slash, subdirectories allowed)"
        },
        {
          "type": "string",
          "pattern": "^/(?:[^/\\n]+/)*[^/\\n]+\\.gguf$",
          "description": "Absolute path to .gguf file (leading slash required)"
        },
        {
          "type": "string",
          "pattern": "^https?://[^\\s]+\\.gguf(\\?[^\\s]*)?$",
          "description": "HTTPS/HTTP URL to .gguf file (query parameters allowed)"
        }
      ]
    },
    "safetensorsFile": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "^(?!/)(?:[^/\\n]+/)*[^/\\n]+\\.safetensors$",
          "description": "Relative path to .safetensors file (no leading slash, subdirectories allowed)"
        },
        {
          "type": "string",
          "pattern": "^/(?:[^/\\n]+/)*[^/\\n]+\\.safetensors$",
          "description": "Absolute path to .safetensors file (leading slash required)"
        },
        {
          "type": "string",
          "pattern": "^https?://[^\\s]+\\.safetensors(\\?[^\\s]*)?$",
          "description": "HTTPS/HTTP URL to .safetensors file (query parameters allowed)"
        }
      ]
    },
    "samplingParameters": {
      "type": "object",
      "description": "Sampling configuration for text generation",
      "properties": {
        "temperature": {
          "type": "number",
          "minimum": 0.0,
          "maximum": 2.0,
          "description": "Sampling temperature (0.0 = deterministic, higher = more random)"
        },
        "top_p": {
          "type": "number",
          "minimum": 0.0,
          "maximum": 1.0,
          "description": "Nucleus sampling probability (cumulative probability threshold)"
        },
        "min_p": {
          "type": "number",
          "minimum": 0.0,
          "maximum": 1.0,
          "description": "Minimum probability threshold for token consideration"
        },
        "repetition_penalty": {
          "type": "number",
          "minimum": 0.0,
          "maximum": 2.0,
          "description": "Penalty for token repetition (1.0 = no penalty, higher = more penalty)"
        }
      },
      "additionalProperties": false
    }
  },
  "properties": {
    "schema_version": {
      "type": "string",
      "enum": ["1.0.0"],
      "description": "Schema version for compatibility checking and migration"
    },
    "inference_type": {"type": "string", "description": "Combined inference backend and type in format: backend/type"},
    "load_time_parameters": {"type": "object", "description": "Parameters required at model load time"},
    "generation_time_parameters": {"type": "object", "description": "Optional parameters used during generation"}
  },
  "allOf": [
    {
      "if": {"properties": {"schema_version": {"const": "1.0.0"}}},
      "then": {
        "properties": {
          "inference_type": {"enum": ["llama.cpp/text-to-text", "llama.cpp/image-to-text", "llama.cpp/lfm2-audio-v1"]}
        },
        "allOf": [
          {
            "if": {"properties": {"inference_type": {"const": "llama.cpp/text-to-text"}}},
            "then": {
              "properties": {
                "load_time_parameters": {
                  "required": ["model"],
                  "properties": {
                    "chat_template": {"type": "string", "description": "Optional chat template override"},
                    "model": {"$ref": "#/definitions/ggufFile", "description": "Text model file (local path or URL)"}
                  },
                  "additionalProperties": false
                },
                "generation_time_parameters": {
                  "properties": {"sampling_parameters": {"$ref": "#/definitions/samplingParameters"}},
                  "additionalProperties": false
                }
              }
            }
          },
          {
            "if": {"properties": {"inference_type": {"const": "llama.cpp/image-to-text"}}},
            "then": {
              "properties": {
                "load_time_parameters": {
                  "required": ["model", "multimodal_projector"],
                  "properties": {
                    "chat_template": {"type": "string", "description": "Optional chat template override"},
                    "model": {
                      "$ref": "#/definitions/ggufFile",
                      "description": "Backbone model file (local path or URL)"
                    },
                    "multimodal_projector": {
                      "$ref": "#/definitions/ggufFile",
                      "description": "Multimodal projector file (local path or URL)"
                    }
                  },
                  "additionalProperties": false
                },
                "generation_time_parameters": {
                  "properties": {"sampling_parameters": {"$ref": "#/definitions/samplingParameters"}},
                  "additionalProperties": false
                }
              }
            }
          },
          {
            "if": {"properties": {"inference_type": {"const": "llama.cpp/lfm2-audio-v1"}}},
            "then": {
              "properties": {
                "load_time_parameters": {
                  "required": ["model", "multimodal_projector", "audio_decoder", "audio_tokenizer"],
                  "properties": {
                    "chat_template": {"type": "string", "description": "Optional chat template override"},
                    "model": {
                      "$ref": "#/definitions/ggufFile",
                      "description": "Backbone model file (local path or URL)"
                    },
                    "multimodal_projector": {
                      "$ref": "#/definitions/ggufFile",
                      "description": "Audio encoder file (local path or URL)"
                    },
                    "audio_decoder": {
                      "$ref": "#/definitions/ggufFile",
                      "description": "Audio decoder file (local path or URL)"
                    },
                    "audio_tokenizer": {
                      "$ref": "#/definitions/safetensorsFile",
                      "description": "Audio tokenizer file (local path or URL)"
                    }
                  },
                  "additionalProperties": false
                },
                "generation_time_parameters": {
                  "properties": {
                    "sampling_parameters": {"$ref": "#/definitions/samplingParameters"},
                    "number_of_decoding_threads": {
                      "type": "integer",
                      "description": "Number of threads for audio decoding",
                      "minimum": 1
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          }
        ]
      }
    }
  ]
}