From 9450b6f93613c867939c08b7b20dde38518ba091 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 16 Nov 2025 00:31:00 +0000 Subject: [PATCH] Docs: Update benchmark for openrouter/sherlock-think-alpha --- results.json | 11 +++ .../openrouter_sherlock-think-alpha.js | 22 ++++++ .../openrouter_sherlock-think-alpha.js | 19 +++++ .../openrouter_sherlock-think-alpha.js | 14 ++++ .../openrouter_sherlock-think-alpha.js | 5 ++ .../openrouter_sherlock-think-alpha.js | 5 ++ .../openrouter_sherlock-think-alpha.js | 19 +++++ .../openrouter_sherlock-think-alpha.js | 77 +++++++++++++++++++ .../openrouter_sherlock-think-alpha.js | 20 +++++ .../openrouter_sherlock-think-alpha.js | 16 ++++ 10 files changed, 208 insertions(+) create mode 100644 tests/1_dijkstra/outputs/openrouter_sherlock-think-alpha.js create mode 100644 tests/2_convex_hull/outputs/openrouter_sherlock-think-alpha.js create mode 100644 tests/3_lis/outputs/openrouter_sherlock-think-alpha.js create mode 100644 tests/4_determinant/outputs/openrouter_sherlock-think-alpha.js create mode 100644 tests/5_markdown_parser/outputs/openrouter_sherlock-think-alpha.js create mode 100644 tests/6_csv_processor/outputs/openrouter_sherlock-think-alpha.js create mode 100644 tests/7_scheduler/outputs/openrouter_sherlock-think-alpha.js create mode 100644 tests/8_json_validator/outputs/openrouter_sherlock-think-alpha.js create mode 100644 tests/9_stream_visualizer/outputs/openrouter_sherlock-think-alpha.js diff --git a/results.json b/results.json index 23183cb..caff7cf 100644 --- a/results.json +++ b/results.json @@ -53,5 +53,16 @@ "7_scheduler": 184.65146969499997, "8_json_validator": 81.96185510699998, "9_stream_visualizer": 31.27018206100003 + }, + "openrouter/sherlock-think-alpha": { + "1_dijkstra": 34.012272204, + "2_convex_hull": 47.377176928, + "3_lis": 18.49963934400001, + "4_determinant": 20.327296623999995, + "5_markdown_parser": 34.069916891999995, + "6_csv_processor": 19.902450771000005, + "7_scheduler": 82.133111714, + "8_json_validator": 31.42142794699996, + "9_stream_visualizer": 35.74114956699999 } } \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/openrouter_sherlock-think-alpha.js b/tests/1_dijkstra/outputs/openrouter_sherlock-think-alpha.js new file mode 100644 index 0000000..e029a30 --- /dev/null +++ b/tests/1_dijkstra/outputs/openrouter_sherlock-think-alpha.js @@ -0,0 +1,22 @@ +async function findShortestPath(graph,start,end){ + const{PriorityQueue}=await import('https://cdn.skypack.dev/js-priority-queue'); + const dist={}; + for(let n in graph)dist[n]=Infinity; + dist[start]=0; + const pq=new PriorityQueue({comparator:(a,b)=>a.d-b.d}); + pq.queue({node:start,d:0}); + while(!pq.isEmpty()){ + const{node,d}=pq.dequeue(); + if(d>dist[node])continue; + if(node===end)return d; + for(let nei in graph[node]){ + const alt=d+graph[node][nei]; + if(alt[q.x,q.y]); +if(p.length<=2)return p; +const cross=(o,a,b)=>(a.x-o.x)*(b.y-o.y)-(a.y-o.y)*(b.x-o.x); +let lower=[]; +for(let q of p){ +while(lower.length>=2&&cross(lower[lower.length-2],lower[lower.length-1],q)<=0)lower.pop(); +lower.push(q); +} +let upper=[]; +let rp=[...p].reverse(); +for(let q of rp){ +while(upper.length>=2&&cross(upper[upper.length-2],upper[upper.length-1],q)<=0)upper.pop(); +upper.push(q); +} +return lower.slice(0,-1).concat(upper.slice(0,-1)); +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/3_lis/outputs/openrouter_sherlock-think-alpha.js b/tests/3_lis/outputs/openrouter_sherlock-think-alpha.js new file mode 100644 index 0000000..7dd7dbe --- /dev/null +++ b/tests/3_lis/outputs/openrouter_sherlock-think-alpha.js @@ -0,0 +1,14 @@ +async function findLISLength(arr) { + const {bisectLeft} = await import('https://cdn.skypack.dev/d3-array'); + let tails = []; + for (let num of arr) { + let i = bisectLeft(tails, num); + if (i === tails.length) { + tails.push(num); + } else { + tails[i] = num; + } + } + return tails.length; +} +export default findLISLength; \ No newline at end of file diff --git a/tests/4_determinant/outputs/openrouter_sherlock-think-alpha.js b/tests/4_determinant/outputs/openrouter_sherlock-think-alpha.js new file mode 100644 index 0000000..f1a7ebf --- /dev/null +++ b/tests/4_determinant/outputs/openrouter_sherlock-think-alpha.js @@ -0,0 +1,5 @@ +async function calculateDeterminant(matrix) { + const { det } = await import('https://esm.sh/mathjs'); + return det(matrix); +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs/openrouter_sherlock-think-alpha.js b/tests/5_markdown_parser/outputs/openrouter_sherlock-think-alpha.js new file mode 100644 index 0000000..0bc2d8f --- /dev/null +++ b/tests/5_markdown_parser/outputs/openrouter_sherlock-think-alpha.js @@ -0,0 +1,5 @@ +async function parseMarkdown(text) { + const {marked} = await import('https://unpkg.com/marked@14.1.2?module'); + return marked(text); +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs/openrouter_sherlock-think-alpha.js b/tests/6_csv_processor/outputs/openrouter_sherlock-think-alpha.js new file mode 100644 index 0000000..532bb6b --- /dev/null +++ b/tests/6_csv_processor/outputs/openrouter_sherlock-think-alpha.js @@ -0,0 +1,19 @@ +async function processCSV(csvString,config){ + const{default:Papa}=await import('https://esm.sh/papaparse'); + const{filterColumn:fc,filterValue:fv,groupBy:gb,aggregateColumn:ac,operation:op}=config; + const parsed=Papa.parse(csvString,{header:true}).data; + const filtered=parsed.filter(r=>r[fc]==fv); + const groups=filtered.reduce((acc,r)=>{ + const k=r[gb]; + const v=Number(r[ac])||0; + if(!acc[k])acc[k]={s:0,c:0}; + acc[k].s+=v; + acc[k].c++; + return acc; + },{}); + return Object.entries(groups).map(([k,g])=>{ + const res=op==='count'?g.c:op==='sum'?g.s:g.s/g.c; + return{[gb]:k,result:res}; + }); +} +export default processCSV; \ No newline at end of file diff --git a/tests/7_scheduler/outputs/openrouter_sherlock-think-alpha.js b/tests/7_scheduler/outputs/openrouter_sherlock-think-alpha.js new file mode 100644 index 0000000..b07ed8b --- /dev/null +++ b/tests/7_scheduler/outputs/openrouter_sherlock-think-alpha.js @@ -0,0 +1,77 @@ +async function findAvailableSlots(cal1, cal2, constraints) { + const { DateTime, Interval } = await import('https://cdn.skypack.dev/luxon'); + const { durationMinutes, searchRange, workHours } = constraints; + const searchStart = DateTime.fromISO(searchRange.start); + const searchEnd = DateTime.fromISO(searchRange.end); + const searchInterval = Interval.fromDateTimes(searchStart, searchEnd); + const zone = searchStart.zone; + const workStart = DateTime.fromFormat(workHours.start, 'HH:mm', { zone }); + const workEnd = DateTime.fromFormat(workHours.end, 'HH:mm', { zone }); + let busies = []; + for (const slot of [...cal1, ...cal2]) { + const iv = Interval.fromISO(`${slot.start}/${slot.end}`); + const i = iv.intersection(searchInterval); + if (i?.isValid) busies.push(i); + } + let nonWork = []; + let currentDay = searchStart.startOf('day'); + const endDay = searchEnd.endOf('day'); + while (currentDay <= endDay) { + const dayStart = currentDay; + const dayEnd = currentDay.plus({ days: 1 }); + const wStart = dayStart.set({ hour: workStart.hour, minute: workStart.minute, second: 0, millisecond: 0 }); + const wEnd = dayStart.set({ hour: workEnd.hour, minute: workEnd.minute, second: 0, millisecond: 0 }); + const blocks = []; + if (dayStart < wStart) blocks.push(Interval.fromDateTimes(dayStart, wStart)); + if (wEnd < dayEnd) blocks.push(Interval.fromDateTimes(wEnd, dayEnd)); + for (const b of blocks) { + const i = b.intersection(searchInterval); + if (i?.isValid) nonWork.push(i); + } + currentDay = currentDay.plus({ days: 1 }); + } + let allBlocked = [...busies, ...nonWork].sort((a, b) => a.start.valueOf() - b.start.valueOf()); + const mergedBlocked = []; + for (const iv of allBlocked) { + const last = mergedBlocked.at(-1); + if (!last || !last.overlaps(iv)) { + mergedBlocked.push(iv); + } else { + mergedBlocked[mergedBlocked.length - 1] = last.union(iv); + } + } + const freePeriods = []; + if (mergedBlocked.length === 0) { + freePeriods.push(searchInterval); + } else { + if (searchStart < mergedBlocked[0].start) { + freePeriods.push(Interval.fromDateTimes(searchStart, mergedBlocked[0].start)); + } + for (let i = 0; i < mergedBlocked.length - 1; i++) { + const gapStart = mergedBlocked[i].end; + const gapEnd = mergedBlocked[i + 1].start; + if (gapStart < gapEnd) { + freePeriods.push(Interval.fromDateTimes(gapStart, gapEnd)); + } + } + if (mergedBlocked.at(-1).end < searchEnd) { + freePeriods.push(Interval.fromDateTimes(mergedBlocked.at(-1).end, searchEnd)); + } + } + const availableSlots = []; + for (const freeIv of freePeriods) { + if (freeIv.length('milliseconds') < durationMinutes * 60 * 1000) continue; + let current = freeIv.start; + while (true) { + const slotEnd = current.plus({ minutes: durationMinutes }); + if (slotEnd > freeIv.end) break; + availableSlots.push({ + start: current.toISO(), + end: slotEnd.toISO() + }); + current = slotEnd; + } + } + return availableSlots; +} +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/8_json_validator/outputs/openrouter_sherlock-think-alpha.js b/tests/8_json_validator/outputs/openrouter_sherlock-think-alpha.js new file mode 100644 index 0000000..4dea5cb --- /dev/null +++ b/tests/8_json_validator/outputs/openrouter_sherlock-think-alpha.js @@ -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; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs/openrouter_sherlock-think-alpha.js b/tests/9_stream_visualizer/outputs/openrouter_sherlock-think-alpha.js new file mode 100644 index 0000000..0865c03 --- /dev/null +++ b/tests/9_stream_visualizer/outputs/openrouter_sherlock-think-alpha.js @@ -0,0 +1,16 @@ +async function createStreamVisualizer(iter,opts){ + const{maxPoints:max,alpha,width,height,yDomain}=opts; + let data=[],prev=null; + for await(const i of iter){ + const ts=i.timestamp,v=i.value,e=prev==null?v:alpha*v+(1-alpha)*prev; + prev=e; + data.push({timestamp:ts,value:v,ema:e}); + if(data.length>max)data.shift(); + } + const{scaleLinear,line}=await import('https://cdn.skypack.dev/d3'); + if(!data.length)return{data,path:''}; + const x=scaleLinear().domain([data[0].timestamp,data.at(-1).timestamp]).range([0,width]); + const y=scaleLinear().domain(yDomain).range([height,0]); + return{data,line().x(d=>x(d.timestamp)).y(d=>y(d.ema))(data)}; +} +export default createStreamVisualizer; \ No newline at end of file