mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 11:21:00 +00:00
Docs: Update benchmark for openrouter/hunter-alpha
This commit is contained in:
20
tests/8_json_validator/outputs/openrouter_hunter-alpha.js
Normal file
20
tests/8_json_validator/outputs/openrouter_hunter-alpha.js
Normal file
@@ -0,0 +1,20 @@
|
||||
async function validateJSON(data, schema) {
|
||||
try {
|
||||
const { default: Ajv } = await import('https://cdn.jsdelivr.net/npm/ajv@8/+esm');
|
||||
const ajv = new Ajv({ allErrors: true });
|
||||
const validate = ajv.compile(schema);
|
||||
const valid = validate(data);
|
||||
|
||||
return {
|
||||
valid,
|
||||
errors: valid ? [] : validate.errors.map(e =>
|
||||
`${e.instancePath || '/'} ${e.message}`
|
||||
)
|
||||
};
|
||||
} catch (error) {
|
||||
return { valid: false, errors: [`Validation error: ${error.message}`] };
|
||||
}
|
||||
}
|
||||
export default validateJSON;
|
||||
// Generation time: 20.147s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user