Ask a question to receive an answer from the chatbot. If the response is
+ satisfactory, click on the 👍
+ button. If the repsonse is not satisfactory, click on the
+ 👎 button.
Ask a question and click on the better of the two responses. The better
+ response will be outlined in green, the worse
+ response outlined in red. This data will be
+ automatically fed to RLHF.
Ask a question to receive an answer from the chatbot. If the response is
+ satisfactory, click on the 👍
+ button. If the response is not satisfactory, click on the
+ 👎 button.
Ask a question and rank the answers across the models. Drag each answer to
+ rank it, in ascending order, from left-to-right. Optionally, select the
+ rank for each via the corresponding dropdown.
+
+ `,l=P(),r=A("div"),o=A("section"),s=A("div");for(let E=0;E{e.scrollIntoView({behavior:"smooth"})},0)}async function So(e){console.log("run update",e);const n=await fetch("/chat/comparator/db/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})});if(n.ok)console.log("ok",n);else{const l=await n.text();alert(l)}}function Jg(e,t,n){let l,r,o;le(e,El,k=>n(7,o=k));let{numModels:s=1}=t,{models:u=[0]}=t,a="",f="",c=!1;st(async()=>{if(await new Promise(k=>setTimeout(k,200)),p){const k=new X(p,{animation:150,onUpdate(E){k.toArray()}});k.toArray()}});const d=async k=>{k.preventDefault(),a=f,n(3,f=""),n(4,c=!0);let E={question:a};for(let R of u)E[R]="Loading...";Ne(El,o=[...o,E],o);const S=await fetch(`/chat/comparator/${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(S.ok){const R=await S.json();n(1,u=Object.keys(R.answer)),n(0,s=u.length);for(let C of u)E[C]=R.answer[C];E.qid=R.qid,El.update(C=>(C[C.length-1]=E,C))}else{const R=await S.text();alert(R)}n(4,c=!1)};let g=0;setInterval(()=>{n(11,g=(g+1)%4)},200);let p,m;function v(k,E){const S=E,C=dt(k.currentTarget.parentNode).selectAll("div.answer").nodes().map(z=>z.id);C.forEach((z,O)=>{dt(`#${z}`).select(".answer-rank").property("value",O+1)});let F=[];for(let[z,O]of C.entries()){const U=parseInt(O.split("-")[1]),G=u[U],$e={rank:z,model:G};F.push($e)}let I=o.filter(z=>z.qid===S),D=[];for(let z of F){const O={model:z.model,qid:parseInt(S),rank:parseInt(z.rank)+1,answer:I[0][z.model]};D.push(O)}So(D)}function _(k,E,S){const R=E,C=parseInt(k.target.value),F=u[S],I={qid:R,rank:parseInt(C),model:F};let D=[],O=o.filter(G=>G.qid===I.qid)[0][I.model];const U={model:I.model,qid:parseInt(I.qid),rank:parseInt(I.rank),answer:O};D.push(U),So(D)}const w=(k,E,S)=>_(S,k.qid,E),y=(k,E)=>v(E,k.qid);function $(k){yn[k?"unshift":"push"](()=>{p=k,n(2,p)})}function M(){f=this.value,n(3,f)}return e.$$set=k=>{"numModels"in k&&n(0,s=k.numModels),"models"in k&&n(1,u=k.models)},e.$$.update=()=>{e.$$.dirty&1&&n(6,l="1fr ".repeat(s).trim()),e.$$.dirty&2048&&n(5,r=".".repeat(g).padEnd(3)),e.$$.dirty&4100&&p&&(n(12,m=new X(p,{animation:150,dataIdAttr:"id",onUpdate(k){m.toArray()}})),m.toArray())},[s,u,p,f,c,r,l,o,d,v,_,g,m,w,y,$,M]}class Zg extends ie{constructor(t){super(),oe(this,t,Jg,Qg,re,{numModels:0,models:1})}}const tn=Ae([{model:"llama",qid:1,rank:1,answer:"Llama's first unique answer."},{model:"gpt3.5",qid:1,rank:2,answer:"GPT-3.5's first unique answer."},{model:"gpt4",qid:1,rank:3,answer:"GPT-4's first unique answer."},{model:"claude",qid:1,rank:4,answer:"Claude's first unique answer."},{model:"llama",qid:2,rank:4,answer:"Llama's second unique answer."},{model:"gpt3.5",qid:2,rank:2,answer:"GPT-3.5's second unique answer."},{model:"gpt4",qid:2,rank:4,answer:"GPT-4's second unique answer."},{model:"claude",qid:2,rank:3,answer:"'s second unique answer."}]);function Co(e,t,n){const l=e.slice();return l[20]=t[n],l}function $o(e,t,n){const l=e.slice();return l[20]=t[n],l[24]=n,l}function Ro(e,t,n){const l=e.slice();return l[25]=t[n],l}function Ao(e){let t,n,l,r,o=`Q.${e[25]}`,s,u;return{c(){t=j("g"),n=j("line"),r=j("text"),s=L(o),h(n,"class","axis-tick svelte-1nna9rx"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[5]+e[12].bottom+e[12].top),h(n,"stroke","black"),h(n,"stroke-dasharray","4"),h(r,"class","axis-text svelte-1nna9rx"),h(r,"y","15"),h(r,"text-anchor","middle"),h(t,"transform",u=`translate(${e[3](e[25])+0} ${e[5]-e[12].bottom})`),h(t,"class","svelte-1nna9rx")},m(a,f){T(a,t,f),b(t,n),b(t,r),b(r,s)},p(a,f){f&32&&l!==(l=-a[5]+a[12].bottom+a[12].top)&&h(n,"y2",l),f&256&&o!==(o=`Q.${a[25]}`)&&W(s,o),f&296&&u!==(u=`translate(${a[3](a[25])+0} ${a[5]-a[12].bottom})`)&&h(t,"transform",u)},d(a){a&&N(t)}}}function Mo(e){let t=Number.isInteger(e[25]),n,l=t&&Ao(e);return{c(){l&&l.c(),n=_e()},m(r,o){l&&l.m(r,o),T(r,n,o)},p(r,o){o&256&&(t=Number.isInteger(r[25])),t?l?l.p(r,o):(l=Ao(r),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(r){l&&l.d(r),r&&N(n)}}}function Eo(e,t){let n,l,r,o,s,u,a,f,c;function d(){return t[15](t[24])}function g(){return t[16](t[24])}return{key:e,first:null,c(){n=j("path"),o=j("path"),h(n,"class","model-path-outer svelte-1nna9rx"),h(n,"d",l=t[10](t[20])),h(n,"stroke","white"),h(n,"data-model",r=t[2][t[24]]),h(o,"class","model-path svelte-1nna9rx"),h(o,"d",s=t[10](t[20])),h(o,"role","img"),h(o,"stroke",u=t[11](t[2][t[24]])),h(o,"data-model",a=t[2][t[24]]),this.first=n},m(p,m){T(p,n,m),T(p,o,m),f||(c=[B(o,"mouseover",d),B(o,"focus",g),B(o,"mouseout",pl),B(o,"blur",pl)],f=!0)},p(p,m){t=p,m&1536&&l!==(l=t[10](t[20]))&&h(n,"d",l),m&516&&r!==(r=t[2][t[24]])&&h(n,"data-model",r),m&1536&&s!==(s=t[10](t[20]))&&h(o,"d",s),m&2564&&u!==(u=t[11](t[2][t[24]]))&&h(o,"stroke",u),m&516&&a!==(a=t[2][t[24]])&&h(o,"data-model",a)},d(p){p&&N(n),p&&N(o),f=!1,ge(c)}}}function Fo(e,t){let n,l,r,o,s,u,a=t[20].rank+"",f,c,d,g;return{key:e,first:null,c(){n=j("g"),l=j("circle"),u=j("text"),f=L(a),h(l,"r",r=t[20].answer.length/2*0+12),h(l,"fill",o=t[11](t[20].model)),h(l,"stroke","white"),h(l,"class","model-circle svelte-1nna9rx"),h(l,"role","img"),h(l,"data-model",s=t[20].model),h(u,"class","bump-text svelte-1nna9rx"),h(u,"text-anchor","middle"),h(u,"alignment-baseline","middle"),h(u,"color","white"),h(u,"fill","white"),h(n,"transform",c=`translate(${t[3](t[20].qid)}, ${t[4](t[20].rank)})`),h(n,"class","svelte-1nna9rx"),this.first=n},m(p,m){T(p,n,m),b(n,l),b(n,u),b(u,f),d||(g=[B(l,"mouseover",t[17]),B(l,"focus",t[18]),B(l,"mouseout",pl),B(l,"blur",pl)],d=!0)},p(p,m){t=p,m&128&&r!==(r=t[20].answer.length/2*0+12)&&h(l,"r",r),m&2176&&o!==(o=t[11](t[20].model))&&h(l,"fill",o),m&128&&s!==(s=t[20].model)&&h(l,"data-model",s),m&128&&a!==(a=t[20].rank+"")&&W(f,a),m&152&&c!==(c=`translate(${t[3](t[20].qid)}, ${t[4](t[20].rank)})`)&&h(n,"transform",c)},d(p){p&&N(n),d=!1,ge(g)}}}function ep(e){let t,n,l,r,o,s,u,a,f,c,d,g,p,m=[],v=new Map,_,w=[],y=new Map,$,M,k,E,S,R=e[8],C=[];for(let O=0;OO[24];for(let O=0;OO[20].model+O[20].qid;for(let O=0;Oe[19].call(t))},m(O,U){T(O,t,U),b(t,n),b(n,l);for(let G=0;G{e.style.opacity=1})}function tp(e,t,n){let l,r,o,s,u,a,f,c,d,g,p;le(e,tn,S=>n(7,p=S));let m,v,_={top:35,bottom:15,left:10,right:0};function w(S){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(R=>{R.style.opacity=.12}),document.querySelectorAll(`.model-path[data-model="${l[S]}"], .model-circle[data-model="${l[S]}"]`).forEach(R=>{R.style.opacity=1})}const y=S=>w(S),$=S=>w(S),M=()=>w(i),k=()=>w(i);function E(){v=this.offsetWidth,m=this.offsetHeight,n(1,v),n(0,m)}return e.$$.update=()=>{e.$$.dirty&128&&n(2,l=Array.from(new Set(p.map(S=>S.model)))),e.$$.dirty&2&&n(6,r=v-_.left-_.right),e.$$.dirty&1&&n(5,o=m-_.top-_.bottom),e.$$.dirty&192&&n(3,s=Mi().domain(p.map(S=>S.qid)).padding(.3).range([_.left,r-_.right])),e.$$.dirty&128&&n(14,u=p.map(S=>S.rank).sort((S,R)=>S-R)),e.$$.dirty&16416&&n(4,a=Mi().domain(u).padding(1).range([_.top,o-_.bottom])),e.$$.dirty&128&&n(11,f=$t().domain(p.map(S=>S.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F","red"])),e.$$.dirty&24&&n(10,c=Zh().x(S=>s(S.qid)).y(S=>a(S.rank))),e.$$.dirty&132&&n(9,d=l.map(S=>p.filter(R=>R.model===S))),e.$$.dirty&8&&n(8,g=s.domain().length>10?s.domain().filter((S,R)=>R%2===0):s.domain())},[m,v,l,s,a,o,r,p,g,d,c,f,_,w,u,y,$,M,k,E]}class np extends ie{constructor(t){super(),oe(this,t,tp,ep,re,{})}}function Do(e,t,n){const l=e.slice();return l[13]=t[n],l[15]=n,l}function Io(e,t,n){const l=e.slice();return l[16]=t[n],l}function No(e,t,n){const l=e.slice();return l[16]=t[n],l}function Po(e){let t,n,l=e[16]+"",r,o;return{c(){t=j("g"),n=j("text"),r=L(l),h(n,"class","axis-text svelte-1y9gffu"),h(n,"x","-5"),h(n,"y","0"),h(n,"text-anchor","end"),h(t,"transform",o=`translate(${e[9].left} ${e[8](e[16])+e[8].bandwidth()/2})`)},m(s,u){T(s,t,u),b(t,n),b(n,r)},p(s,u){u&4&&l!==(l=s[16]+"")&&W(r,l),u&260&&o!==(o=`translate(${s[9].left} ${s[8](s[16])+s[8].bandwidth()/2})`)&&h(t,"transform",o)},d(s){s&&N(t)}}}function To(e){let t,n,l=e[16]+"",r,o;return{c(){t=j("g"),n=j("text"),r=L(l),h(n,"class","axis-text svelte-1y9gffu"),h(n,"y","15"),h(n,"text-anchor","middle"),h(t,"transform",o=`translate(${e[7](e[16])}, ${e[4]-e[9].bottom})`)},m(s,u){T(s,t,u),b(t,n),b(n,r)},p(s,u){u&128&&l!==(l=s[16]+"")&&W(r,l),u&144&&o!==(o=`translate(${s[7](s[16])}, ${s[4]-s[9].bottom})`)&&h(t,"transform",o)},d(s){s&&N(t)}}}function Oo(e){let t,n=e[16]%2==0&&To(e);return{c(){n&&n.c(),t=_e()},m(l,r){n&&n.m(l,r),T(l,t,r)},p(l,r){l[16]%2==0?n?n.p(l,r):(n=To(l),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},d(l){n&&n.d(l),l&&N(t)}}}function Vo(e){let t,n,l,r,o,s,u,a=e[13].avgRank.toFixed(2)+"",f,c,d;return{c(){t=j("rect"),u=j("text"),f=L(a),h(t,"y",n=e[8](e[13].model)),h(t,"x",e[9].left),h(t,"width",l=e[7](e[13].avgRank)-e[9].left),h(t,"height",r=e[8].bandwidth()),h(t,"fill",o=e[6](e[13].model)),h(t,"class","model-path"),h(t,"data-model",s=e[5][e[15]]),h(u,"class","label-text svelte-1y9gffu"),h(u,"y",c=e[8](e[13].model)+e[8].bandwidth()/2),h(u,"x",d=e[7](e[13].avgRank)+5),h(u,"text-anchor","start"),h(u,"dominant-baseline","middle")},m(g,p){T(g,t,p),T(g,u,p),b(u,f)},p(g,p){p&260&&n!==(n=g[8](g[13].model))&&h(t,"y",n),p&132&&l!==(l=g[7](g[13].avgRank)-g[9].left)&&h(t,"width",l),p&256&&r!==(r=g[8].bandwidth())&&h(t,"height",r),p&68&&o!==(o=g[6](g[13].model))&&h(t,"fill",o),p&32&&s!==(s=g[5][g[15]])&&h(t,"data-model",s),p&4&&a!==(a=g[13].avgRank.toFixed(2)+"")&&W(f,a),p&260&&c!==(c=g[8](g[13].model)+g[8].bandwidth()/2)&&h(u,"y",c),p&132&&d!==(d=g[7](g[13].avgRank)+5)&&h(u,"x",d)},d(g){g&&N(t),g&&N(u)}}}function lp(e){let t,n,l,r,o,s,u,a,f,c,d,g,p=e[2].map(zo),m=[];for(let $=0;$e[12].call(t))},m($,M){T($,t,M),b(t,n);for(let k=0;ke.model;function rp(e,t,n){let l,r,o,s,u,a,f,c,d;le(e,tn,_=>n(11,d=_));let g=300,p=500,m={top:50,bottom:0,left:100,right:0};function v(){p=this.offsetWidth,g=this.offsetHeight,n(1,p),n(0,g)}return e.$$.update=()=>{e.$$.dirty&2048&&n(10,l=d.reduce((_,w)=>(_[w.model]?(_[w.model].sum+=w.rank,_[w.model].count++):_[w.model]={sum:w.rank,count:1},_),{})),e.$$.dirty&1024&&n(2,r=Object.keys(l).map(_=>({model:_,avgRank:l[_].sum/l[_].count}))),e.$$.dirty&2&&n(3,o=p-m.left-m.right),e.$$.dirty&1&&n(4,s=g-m.top-m.bottom),e.$$.dirty&20&&n(8,u=Vt().rangeRound([m.top,s-m.bottom]).padding(.05).domain(r.map(_=>_.model))),e.$$.dirty&12&&n(7,a=Ge().rangeRound([m.left,o-m.right]).domain([0,ht(r,_=>_.avgRank)])),e.$$.dirty&4&&n(6,f=$t().domain(r.map(_=>_.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F"])),e.$$.dirty&2048&&n(5,c=Array.from(new Set(d.map(_=>_.model))))},[g,p,r,o,s,c,f,a,u,m,l,d,v]}class ip extends ie{constructor(t){super(),oe(this,t,rp,lp,re,{})}}function Ho(e,t,n){const l=e.slice();return l[20]=t[n],l[22]=n,l}function qo(e,t,n){const l=e.slice();return l[23]=t[n],l[25]=n,l}function Lo(e,t,n){const l=e.slice();return l[23]=t[n],l}function jo(e){let t,n=e[23].key+"",l,r,o;function s(){return e[10](e[23])}return{c(){t=A("th"),l=L(n),h(t,"class","svelte-owgjbp")},m(u,a){T(u,t,a),b(t,l),r||(o=B(t,"click",s),r=!0)},p(u,a){e=u,a&64&&n!==(n=e[23].key+"")&&W(l,n)},d(u){u&&N(t),r=!1,o()}}}function xo(e,t){let n,l=(t[20][t[23].key].length>Bo&&t[4]!==`${t[22]}-${t[25]}`?`${t[20][t[23].key].substring(0,40)}...`:t[20][t[23].key])+"",r,o,s,u;function a(){return t[11](t[22],t[25])}return{key:e,first:null,c(){n=A("td"),r=L(l),h(n,"class",o="cell-type-"+t[23].type+" svelte-owgjbp"),ye(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),It(n,"active",t[4]===`${t[22]}-${t[25]}`),this.first=n},m(f,c){T(f,n,c),b(n,r),s||(u=B(n,"click",a),s=!0)},p(f,c){t=f,c&112&&l!==(l=(t[20][t[23].key].length>Bo&&t[4]!==`${t[22]}-${t[25]}`?`${t[20][t[23].key].substring(0,40)}...`:t[20][t[23].key])+"")&&W(r,l),c&64&&o!==(o="cell-type-"+t[23].type+" svelte-owgjbp")&&h(n,"class",o),c&96&&ye(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),c&80&&It(n,"active",t[4]===`${t[22]}-${t[25]}`)},d(f){f&&N(n),s=!1,u()}}}function Go(e){let t,n=[],l=new Map,r,o=e[6];const s=u=>u[23].key;for(let u=0;un(9,s=M));let u={};const a=pt(".2f");function f(M){let k=M.reduce((S,R)=>(S[R.model]||(S[R.model]=[]),S[R.model].push(R.rank),S),{});return Object.entries(k).map(([S,R])=>{let C=R.reduce((I,D)=>(I[D]=(I[D]||0)+1,I),{}),F=Object.entries(C).reduce((I,D)=>D[1]>I[1]?D:I)[0];return{model:S,overall_rank:Number(F),average_rank:a(Jd(R)),standard_deviation_rank:a(Vd(R))}})}u={...{columns:{},style:"normal",paged:25},...u};const d=Ge().domain([-1,0,1]).range(["#FF5470","#f8f8f8","#00ebc7"]);let{sortable:g,index:p,paged:m}=u,v,_=!0;if(g&&p)throw new Error("A table can either be ranked or sortable, but not both");p=1,g=1;let w=null;const y=M=>{g&&(v===M.key&&n(2,_=!_),n(1,v=M.key))},$=(M,k)=>{n(4,w=w===`${M}-${k}`?null:`${M}-${k}`)};return e.$$.update=()=>{if(e.$$.dirty&512,e.$$.dirty&512&&n(8,l=f(s)),e.$$.dirty&774){v&&n(8,l=l.slice().sort((k,E)=>{let S=k[v],R=E[v];if(S==R)return JSON.stringify(k).localeCompare(JSON.stringify(E));let C=S>R?1:S{const k=u.columns[M]||{};return{key:M,type:k.type||typeof l[0][M],options:k}}))},n(5,o=[]),[u,v,_,g,w,o,r,d,l,s,y,$]}let up=class extends ie{constructor(t){super(),oe(this,t,ap,op,re,{})}};function Uo(e,t,n){const l=e.slice();return l[19]=t[n],l}function Wo(e,t,n){const l=e.slice();return l[22]=t[n],l}function Xo(e,t,n){const l=e.slice();return l[25]=t[n],l[27]=n,l}function Yo(e){let t,n=e[25]+"",l,r,o,s=e[25]+"",u,a;return{c(){t=j("text"),l=L(n),o=j("text"),u=L(s),h(t,"class","axis-text svelte-t6wv8i"),h(t,"x",r=e[7].left+e[5](e[25])+e[5].bandwidth()/2),h(t,"y",e[7].top-10),h(t,"text-anchor","middle"),h(o,"class","axis-text svelte-t6wv8i"),h(o,"x",e[7].left-10),h(o,"y",a=e[7].top+e[4](e[25])+e[4].bandwidth()/2),h(o,"text-anchor","end"),h(o,"dominant-baseline","middle")},m(f,c){T(f,t,c),b(t,l),T(f,o,c),b(o,u)},p(f,c){c&8&&n!==(n=f[25]+"")&&W(l,n),c&40&&r!==(r=f[7].left+f[5](f[25])+f[5].bandwidth()/2)&&h(t,"x",r),c&8&&s!==(s=f[25]+"")&&W(u,s),c&24&&a!==(a=f[7].top+f[4](f[25])+f[4].bandwidth()/2)&&h(o,"y",a)},d(f){f&&N(t),f&&N(o)}}}function Qo(e){let t,n,l,r,o,s,u,a,f=e[6](e[2][e[19]][e[22]])+"",c,d,g,p;return{c(){t=j("rect"),a=j("text"),c=L(f),h(t,"x",n=e[7].left+e[5](e[22])),h(t,"y",l=e[7].top+e[4](e[19])),h(t,"width",r=e[5].bandwidth()),h(t,"height",o=e[4].bandwidth()),h(t,"fill",s=e[8](e[19],e[22])),h(t,"rx","4"),h(t,"ry","4"),h(t,"class","model-path"),h(t,"data-model",u=e[19]),h(a,"x",d=e[7].left+e[5](e[22])+e[5].bandwidth()/2),h(a,"y",g=e[7].top+e[4](e[19])+e[4].bandwidth()/2),h(a,"text-anchor","middle"),h(a,"dominant-baseline","middle"),h(a,"class","model-path"),h(a,"data-model",p=e[19])},m(m,v){T(m,t,v),T(m,a,v),b(a,c)},p(m,v){v&40&&n!==(n=m[7].left+m[5](m[22]))&&h(t,"x",n),v&24&&l!==(l=m[7].top+m[4](m[19]))&&h(t,"y",l),v&32&&r!==(r=m[5].bandwidth())&&h(t,"width",r),v&16&&o!==(o=m[4].bandwidth())&&h(t,"height",o),v&8&&s!==(s=m[8](m[19],m[22]))&&h(t,"fill",s),v&8&&u!==(u=m[19])&&h(t,"data-model",u),v&12&&f!==(f=m[6](m[2][m[19]][m[22]])+"")&&W(c,f),v&40&&d!==(d=m[7].left+m[5](m[22])+m[5].bandwidth()/2)&&h(a,"x",d),v&24&&g!==(g=m[7].top+m[4](m[19])+m[4].bandwidth()/2)&&h(a,"y",g),v&8&&p!==(p=m[19])&&h(a,"data-model",p)},d(m){m&&N(t),m&&N(a)}}}function Ko(e){let t,n=e[3],l=[];for(let r=0;re[16].call(t))},m(g,p){T(g,t,p),b(t,n);for(let m=0;mn(15,p=k));const m=pt(".1f");function v(k){let E=k.reduce((C,F)=>(C[F.qid]||(C[F.qid]=[]),C[F.qid].push(F),C),{}),S=Array.from(new Set(k.map(C=>C.model))),R=S.reduce((C,F)=>(C[F]=S.reduce((I,D)=>(I[D]={sum:0,count:0},I),{}),C),{});for(let C in E){let F=E[C];for(let I of S)for(let D of S){let z=F.find(U=>U.model===I),O=F.find(U=>U.model===D);z&&O&&(R[I][D].sum+=O.rank-z.rank,R[I][D].count++)}}for(let C in R)for(let F in R[C])R[C][F].count>0?R[C][F]=R[C][F].sum/R[C][F].count:R[C][F]=0;return R}let _=500,w=500,y={top:50,bottom:0,left:65,right:25};function $(k,E){let S=l[k][E];return S===0?"white":S>=0?g(k):g(E)}function M(){w=this.offsetWidth,_=this.offsetHeight,n(1,w),n(0,_)}return e.$$.update=()=>{e.$$.dirty&32768&&n(2,l=v(p)),e.$$.dirty&32768&&n(3,r=Array.from(new Set(p.map(k=>k.model)))),e.$$.dirty&2&&n(14,o=w-y.left-y.right),e.$$.dirty&1&&n(13,s=_-y.top-y.bottom),e.$$.dirty&16392&&n(5,u=Vt().range([0,o]).domain(r).padding(.05)),e.$$.dirty&8200&&n(4,a=Vt().range([0,s]).domain(r).padding(.05)),e.$$.dirty&4&&n(12,f=Object.values(l).flatMap(k=>Object.values(k))),e.$$.dirty&4096&&n(11,c=lr(f)),e.$$.dirty&4096&&n(10,d=ht(f)),e.$$.dirty&8&&n(9,g=$t().domain(r).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F"])),e.$$.dirty&3592&&r.reduce((k,E)=>(k[E]=Ra().domain([c,d]).interpolator(ir("white",g(E))),k),{})},[_,w,l,r,a,u,m,y,$,g,d,c,f,s,o,p,M]}class dp extends ie{constructor(t){super(),oe(this,t,cp,fp,re,{})}}function Jo(e,t,n){const l=e.slice();return l[7]=t[n],l[9]=n,l}function hp(e){let t;return{c(){t=A("div"),t.innerHTML="
To view the comparison dashboard, you must first rank some comparisons!
Ask a question to receive an answer from the chatbot. If the response is
- satisfactory, click on the 👍
- button. If the repsonse is not satisfactory, click on the
- 👎 button.
Ask a question and click on the better of the two responses. The better
- response will be outlined in green, the worse
- response outlined in red. This data will be
- automatically fed to RLHF.
Ask a question to receive an answer from the chatbot. If the response is
- satisfactory, click on the 👍
- button. If the response is not satisfactory, click on the
- 👎 button.
Ask a question and rank the answers across the models. Drag each answer to
- rank it, in ascending order, from left-to-right. Optionally, select the
- rank for each via the corresponding dropdown.
-
- `,r=D(),i=R("div"),o=R("section"),l=R("div");for(let E=0;E{e.scrollIntoView({behavior:"smooth"})},0)}async function ml(e){console.log("run update",e);const n=await fetch("/chat/comparator/db/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})});if(n.ok)console.log("ok",n);else{const r=await n.text();alert(r)}}function Qg(e,t,n){let r,i,o;ee(e,kr,$=>n(7,o=$));let{numModels:l=1}=t,{models:a=[0]}=t,s="",u="",c=!1;ut(async()=>{if(await new Promise($=>setTimeout($,200)),g){const $=new L(g,{animation:150,onUpdate(E){$.toArray()}});$.toArray()}});const f=async $=>{$.preventDefault(),s=u,n(3,u=""),n(4,c=!0);let E={question:s};for(let k of a)E[k]="Loading...";Oe(kr,o=[...o,E],o);const S=await fetch(`/chat/comparator/${s}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:s})});if(S.ok){const k=await S.json();n(1,a=Object.keys(k.answer)),n(0,l=a.length);for(let y of a)E[y]=k.answer[y];E.qid=k.qid,kr.update(y=>(y[y.length-1]=E,y))}else{const k=await S.text();alert(k)}n(4,c=!1)};let d=0;setInterval(()=>{n(11,d=(d+1)%4)},200);let g,p;function m($,E){const S=E,y=st($.currentTarget.parentNode).selectAll("div.answer").nodes().map(P=>P.id);y.forEach((P,B)=>{st(`#${P}`).select(".answer-rank").property("value",B+1)});let M=[];for(let[P,B]of y.entries()){const ge=parseInt(B.split("-")[1]),oe=a[ge],Ee={rank:P,model:oe};M.push(Ee)}let I=o.filter(P=>P.qid===S),F=[];for(let P of M){const B={model:P.model,qid:parseInt(S),rank:parseInt(P.rank)+1,answer:I[0][P.model]};F.push(B)}ml(F)}function _($,E,S){const k=E,y=parseInt($.target.value),M=a[S],I={qid:k,rank:parseInt(y),model:M};let F=[],B=o.filter(oe=>oe.qid===I.qid)[0][I.model];const ge={model:I.model,qid:parseInt(I.qid),rank:parseInt(I.rank),answer:B};F.push(ge),ml(F)}const b=($,E,S)=>_(S,$.qid,E),w=($,E)=>m(E,$.qid);function C($){hn[$?"unshift":"push"](()=>{g=$,n(2,g)})}function A(){u=this.value,n(3,u)}return e.$$set=$=>{"numModels"in $&&n(0,l=$.numModels),"models"in $&&n(1,a=$.models)},e.$$.update=()=>{e.$$.dirty&1&&n(6,r="1fr ".repeat(l).trim()),e.$$.dirty&2048&&n(5,i=".".repeat(d).padEnd(3)),e.$$.dirty&4100&&g&&(n(12,p=new L(g,{animation:150,dataIdAttr:"id",onUpdate($){p.toArray()}})),p.toArray())},[l,a,g,u,c,i,r,o,f,m,_,d,p,b,w,C,A]}class Kg extends ie{constructor(t){super(),se(this,t,Qg,Xg,re,{numModels:0,models:1})}}function Jg(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return la(this.cover(t,n),t,n,e)}function la(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o=e._root,l={data:r},a=e._x0,s=e._y0,u=e._x1,c=e._y1,f,d,g,p,m,_,b,w;if(!o)return e._root=l,e;for(;o.length;)if((m=t>=(f=(a+u)/2))?a=f:u=f,(_=n>=(d=(s+c)/2))?s=d:c=d,i=o,!(o=o[b=_<<1|m]))return i[b]=l,e;if(g=+e._x.call(null,o.data),p=+e._y.call(null,o.data),t===g&&n===p)return l.next=o,i?i[b]=l:e._root=l,e;do i=i?i[b]=new Array(4):e._root=new Array(4),(m=t>=(f=(a+u)/2))?a=f:u=f,(_=n>=(d=(s+c)/2))?s=d:c=d;while((b=_<<1|m)===(w=(p>=d)<<1|g>=f));return i[w]=o,i[b]=l,e}function Zg(e){var t,n,r=e.length,i,o,l=new Array(r),a=new Array(r),s=1/0,u=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=i),of&&(f=o));if(s>c||u>f)return this;for(this.cover(s,u).cover(c,f),n=0;ne||e>=i||r>t||t>=o;)switch(u=(tc||(a=p.y0)>f||(s=p.x1)=b)<<1|e>=_)&&(p=d[d.length-1],d[d.length-1]=d[d.length-1-m],d[d.length-1-m]=p)}else{var w=e-+this._x.call(null,g.data),C=t-+this._y.call(null,g.data),A=w*w+C*C;if(A=(d=(l+s)/2))?l=d:s=d,(m=f>=(g=(a+u)/2))?a=g:u=g,t=n,!(n=n[_=m<<1|p]))return this;if(!n.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(r=t,b=_)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[_]=o:delete t[_],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[b]=n:this._root=n),this):(this._root=o,this)}function oh(e){for(var t=0,n=e.length;td.index){var I=g-k.x-k.vx,F=p-k.y-k.vy,P=I*I+F*F;Pg+M||Ep+M||Su.r&&(u.r=u[c].r)}function s(){if(t){var u,c=t.length,f;for(n=new Array(c),u=0;u{}};function aa(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}jn.prototype=aa.prototype={constructor:jn,on:function(e,t){var n=this._,r=vh(e+"",n),i,o=-1,l=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&e._call.call(void 0,t),e=e._next;--Wt}function wl(){At=(ur=wn.now())+br,Wt=on=0;try{yh()}finally{Wt=0,Ch(),At=0}}function Sh(){var e=wn.now(),t=e-ur;t>ua&&(br-=t,ur=e)}function Ch(){for(var e,t=ar,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ar=n);ln=e,ai(r)}function ai(e){if(!Wt){on&&(on=clearTimeout(on));var t=e-At;t>24?(e<1/0&&(on=setTimeout(wl,e-wn.now()-br)),Jt&&(Jt=clearInterval(Jt))):(Jt||(ur=wn.now(),Jt=setInterval(Sh,ua)),Wt=1,ca(wl))}}const kh=1664525,$h=1013904223,yl=4294967296;function Rh(){let e=1;return()=>(e=(kh*e+$h)%yl)/yl}var Ah=10,Eh=Math.PI*(3-Math.sqrt(5));function Mh(e){var t,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,l=.6,a=new Map,s=da(f),u=aa("tick","end"),c=Rh();e==null&&(e=[]);function f(){d(),u.call("tick",t),n1?(_==null?a.delete(m):a.set(m,p(_)),t):a.get(m)},find:function(m,_,b){var w=0,C=e.length,A,$,E,S,k;for(b==null?b=1/0:b*=b,w=0;w1?(u.on(m,_),t):u.on(m)}}}function Fh(e){var t=Je(.1),n,r,i;typeof e!="function"&&(e=Je(e==null?0:+e));function o(a){for(var s=0,u=n.length,c;se[4]?1:0),h(t,"class",g="file-circle-g "+(e[20].size>e[4]?"large":"")+" svelte-h2ab3o"),h(t,"style",p=e[5](e[20].x,e[20].y)),h(t,"role","img")},m(w,C){T(w,t,C),v(t,n),v(t,o),v(o,a),v(o,s),v(s,c),m=!0,_||(b=[j(t,"mouseover",e[6]),j(t,"mouseout",e[7]),j(t,"focus",e[6]),j(t,"blur",e[7])],_=!0)},p(w,C){(!m||C&12&&r!==(r=w[3](w[20].size)))&&h(n,"r",r),(!m||C&4)&&l!==(l=w[20].file+"")&&Q(a,l),(!m||C&4)&&u!==(u=Kr(w[20].size)+"")&&Q(c,u),(!m||C&20&&f!==(f=w[20].size>w[4]?1:0))&&h(o,"opacity",f),(!m||C&20&&g!==(g="file-circle-g "+(w[20].size>w[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",g),(!m||C&4&&p!==(p=w[5](w[20].x,w[20].y)))&&h(t,"style",p)},i(w){m||(w&&Se(()=>{m&&(i||(i=Ke(n,Rn,{duration:1e3},!0)),i.run(1))}),w&&Se(()=>{m&&(d||(d=Ke(o,Rn,{duration:1e3},!0)),d.run(1))}),m=!0)},o(w){w&&(i||(i=Ke(n,Rn,{duration:1e3},!1)),i.run(0)),w&&(d||(d=Ke(o,Rn,{duration:1e3},!1)),d.run(0)),m=!1},d(w){w&&x(t),w&&i&&i.end(),w&&d&&d.end(),_=!1,_e(b)}}}function Ih(e){let t,n,r,i,o=e[2],l=[];for(let s=0;sV(l[s],1,1,()=>{l[s]=null});return{c(){t=R("div"),n=U("svg");for(let s=0;se[15].call(t))},m(s,u){T(s,t,u),v(t,n);for(let c=0;cn(14,c=$));let f=600,d=350,g=!0,p=!1;const m=($,E)=>`transform: translate(${$}px, ${E}px)`,_=[-4,4],b=[-1,1];function w(){n(8,g=!0),n(9,p=!0);const $=st(this);$r(".file-circle-g").select("text").style("opacity",0),$.raise(),$.select("circle").attr("fill","var(--red)"),$.select("text").style("opacity",1)}const C=()=>{const $=$r(".file-circle-g");$.select("circle").attr("fill","var(--yellow)"),$.select("text").style("opacity",0),n(9,p=!1),setTimeout(()=>{n(8,g=!1)},1e3)};function A(){f=this.offsetWidth,d=this.offsetHeight,n(0,f),n(1,d)}return e.$$.update=()=>{e.$$.dirty&16387&&n(2,r=c.map($=>({...$,x:f/2,y:d/2,tickCount:0}))),e.$$.dirty&16384&&console.log(c.map($=>$.size).sort(($,E)=>$-E)),e.$$.dirty&1&&n(13,i=Fh().x(f/2)),e.$$.dirty&2&&n(12,o=Dh().y(d/2)),e.$$.dirty&16384&&n(3,s=We().domain(sn(c,$=>$.size)).range([12,60])),e.$$.dirty&8&&n(10,l=mh().radius($=>s($.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,a=id(c.map($=>$.size).sort(($,E)=>$-E),.85)),e.$$.dirty&1&&We().domain(_).range([5,f]),e.$$.dirty&2&&We().domain(b).range([d,5]),e.$$.dirty&4&&n(11,u=Mh().nodes(r).on("tick",()=>{n(2,r=[...r])})),e.$$.dirty&15360&&(u.force("x",i),u.force("y",o),u.force("collide",l),u.alpha(.02),u.restart()),e.$$.dirty&19468&&(s.domain(sn(c,$=>$.size)),r.forEach($=>$.radius=s($.size)),u.nodes(r),l.radius($=>$.radius+.5)),e.$$.dirty&768&&g===!1&&(p||$r(".large").select("text").style("opacity",1))},[f,d,r,s,a,m,w,C,g,p,l,u,o,i,c,A]}class Ph extends ie{constructor(t){super(),se(this,t,Nh,Ih,re,{})}}/**
- * table-core
- *
- * Copyright (c) TanStack
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE.md file in the root directory of this source tree.
- *
- * @license MIT
- */function pt(e,t){return typeof e=="function"?e(t):e}function je(e,t){return n=>{t.setState(r=>({...r,[e]:pt(n,r[e])}))}}function fr(e){return e instanceof Function}function xh(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Th(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const l=t(o);l!=null&&l.length&&r(l)})};return r(e),n}function G(e,t,n){let r=[],i;return()=>{let o;n.key&&n.debug&&(o=Date.now());const l=e();if(!(l.length!==r.length||l.some((u,c)=>r[c]!==u)))return i;r=l;let s;if(n.key&&n.debug&&(s=Date.now()),i=t(...l),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-o)*100)/100,c=Math.round((Date.now()-s)*100)/100,f=c/16,d=(g,p)=>{for(g=String(g);g.length