Skip to content

Commit 60660c3

Browse files
authored
Merge pull request #166 from remo-lab/fix/model-capabilities-schema-validation
fix: sync ModelCapabilities schema with Go struct and docs
2 parents f049c05 + 5f0b3e4 commit 60660c3

2 files changed

Lines changed: 115 additions & 1 deletion

File tree

schema/config-schema.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,19 @@
146146
},
147147
"toolUsage": {
148148
"type": "boolean"
149+
},
150+
"reward": {
151+
"type": "boolean"
152+
},
153+
"languages": {
154+
"type": "array",
155+
"items": {
156+
"type": "string",
157+
"pattern": "^[a-z]{2}$"
158+
}
149159
}
150-
}
160+
},
161+
"additionalProperties": false
151162
},
152163
"Modality": {
153164
"type": "string",

schema/config_test.go

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,109 @@ func TestConfig(t *testing.T) {
474474
]
475475
}
476476
}
477+
`,
478+
fail: true,
479+
},
480+
// expected failure: reward is not boolean
481+
{
482+
config: `
483+
{
484+
"descriptor": {
485+
"name": "xyz-3-8B-Instruct",
486+
"version": "3.1"
487+
},
488+
"config": {
489+
"paramSize": "8b",
490+
"capabilities": {
491+
"inputTypes": ["text"],
492+
"outputTypes": ["text"],
493+
"reward": "true"
494+
}
495+
},
496+
"modelfs": {
497+
"type": "layers",
498+
"diffIds": [
499+
"sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
500+
]
501+
}
502+
}
503+
`,
504+
fail: true,
505+
},
506+
// expected failure: languages is not an array
507+
{
508+
config: `
509+
{
510+
"descriptor": {
511+
"name": "xyz-3-8B-Instruct",
512+
"version": "3.1"
513+
},
514+
"config": {
515+
"paramSize": "8b",
516+
"capabilities": {
517+
"inputTypes": ["text"],
518+
"outputTypes": ["text"],
519+
"languages": "en"
520+
}
521+
},
522+
"modelfs": {
523+
"type": "layers",
524+
"diffIds": [
525+
"sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
526+
]
527+
}
528+
}
529+
`,
530+
fail: true,
531+
},
532+
// expected failure: language code is not a two-letter ISO 639 code
533+
{
534+
config: `
535+
{
536+
"descriptor": {
537+
"name": "xyz-3-8B-Instruct",
538+
"version": "3.1"
539+
},
540+
"config": {
541+
"paramSize": "8b",
542+
"capabilities": {
543+
"inputTypes": ["text"],
544+
"outputTypes": ["text"],
545+
"languages": ["fra"]
546+
}
547+
},
548+
"modelfs": {
549+
"type": "layers",
550+
"diffIds": [
551+
"sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
552+
]
553+
}
554+
}
555+
`,
556+
fail: true,
557+
},
558+
// expected failure: unknown field in capabilities
559+
{
560+
config: `
561+
{
562+
"descriptor": {
563+
"name": "xyz-3-8B-Instruct",
564+
"version": "3.1"
565+
},
566+
"config": {
567+
"paramSize": "8b",
568+
"capabilities": {
569+
"inputTypes": ["text"],
570+
"unknownField": true
571+
}
572+
},
573+
"modelfs": {
574+
"type": "layers",
575+
"diffIds": [
576+
"sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
577+
]
578+
}
579+
}
477580
`,
478581
fail: true,
479582
},

0 commit comments

Comments
 (0)