diff --git a/schema/config-schema.json b/schema/config-schema.json index 94e88f3..ce13fcc 100644 --- a/schema/config-schema.json +++ b/schema/config-schema.json @@ -146,8 +146,19 @@ }, "toolUsage": { "type": "boolean" + }, + "reward": { + "type": "boolean" + }, + "languages": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-z]{2}$" + } } - } + }, + "additionalProperties": false }, "Modality": { "type": "string", diff --git a/schema/config_test.go b/schema/config_test.go index fd6b644..391727a 100644 --- a/schema/config_test.go +++ b/schema/config_test.go @@ -474,6 +474,109 @@ func TestConfig(t *testing.T) { ] } } +`, + fail: true, + }, + // expected failure: reward is not boolean + { + config: ` +{ + "descriptor": { + "name": "xyz-3-8B-Instruct", + "version": "3.1" + }, + "config": { + "paramSize": "8b", + "capabilities": { + "inputTypes": ["text"], + "outputTypes": ["text"], + "reward": "true" + } + }, + "modelfs": { + "type": "layers", + "diffIds": [ + "sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ] + } +} +`, + fail: true, + }, + // expected failure: languages is not an array + { + config: ` +{ + "descriptor": { + "name": "xyz-3-8B-Instruct", + "version": "3.1" + }, + "config": { + "paramSize": "8b", + "capabilities": { + "inputTypes": ["text"], + "outputTypes": ["text"], + "languages": "en" + } + }, + "modelfs": { + "type": "layers", + "diffIds": [ + "sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ] + } +} +`, + fail: true, + }, + // expected failure: language code is not a two-letter ISO 639 code + { + config: ` +{ + "descriptor": { + "name": "xyz-3-8B-Instruct", + "version": "3.1" + }, + "config": { + "paramSize": "8b", + "capabilities": { + "inputTypes": ["text"], + "outputTypes": ["text"], + "languages": ["fra"] + } + }, + "modelfs": { + "type": "layers", + "diffIds": [ + "sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ] + } +} +`, + fail: true, + }, + // expected failure: unknown field in capabilities + { + config: ` +{ + "descriptor": { + "name": "xyz-3-8B-Instruct", + "version": "3.1" + }, + "config": { + "paramSize": "8b", + "capabilities": { + "inputTypes": ["text"], + "unknownField": true + } + }, + "modelfs": { + "type": "layers", + "diffIds": [ + "sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ] + } +} `, fail: true, },