Docs: Update benchmark for openrouter/sherlock-think-alpha

This commit is contained in:
github-actions[bot]
2025-11-16 00:31:00 +00:00
parent fc98f13849
commit 9450b6f936
10 changed files with 208 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
const getAjv = async () => {
if (!getAjv.instance) {
const { default: Ajv } = await import('https://cdn.skypack.dev/ajv@8');
getAjv.instance = new Ajv({ allErrors: true });
}
return getAjv.instance;
};
const validateJSON = async (data, schema) => {
try {
const ajv = await getAjv();
const validate = ajv.compile(schema);
const valid = validate(data);
const errors = valid ? [] : ajv.errorsText(ajv.errors, { separator: '\n' }).split('\n').filter(s => s.trim());
return { valid, errors };
} catch (e) {
return { valid: false, errors: [`Validation error: ${e.message}`] };
}
};
export default validateJSON;