(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[794],{38486:function(e,t,n){Promise.resolve().then(n.bind(n,73730))},49532:function(e,t,n){"use strict";let i,s;async function l(){if(i||(s||(s=fetch("/api/config").then(e=>e.json()).then(e=>i=e.apiBaseUrl)),await s),void 0===i)throw Error("API base URL is undefined");return i}n.d(t,{b:function(){return l}})},73730:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return I}});var i=n(24004),s=n(14978),l=n(49532),r=n(49567),c=n(30469),d=n(65068),a=n(70417),o=n(21303),h=n(26485),u=n(30021),x=n(19708),j=n(65969),Z=n(38640),v=n.n(Z),p=n(28891),f=n(40982),m=n(29794),w=n(22701),y=n(51956),C=n(82669),g=n(613),E=n(63147),k=e=>{var t;let{openDialog:n,handleClose:s,selectedPrompt:l}=e;return(0,i.jsxs)(m.Z,{open:n,onClose:s,fullWidth:!0,maxWidth:"lg",children:[(0,i.jsxs)(C.Z,{children:["Prompt ",l.id.slice(0,6)]}),(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(E.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Prompt"}),(0,i.jsx)(g.u,{readOnly:!0,value:null==l?void 0:null===(t=l.prompt)||void 0===t?void 0:t.raw,style:{width:"100%",padding:"0.75rem"},maxRows:50}),(0,i.jsx)(E.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,i.jsxs)(d.Z,{children:[(0,i.jsx)(h.Z,{children:(0,i.jsxs)(u.Z,{children:[(0,i.jsx)(o.Z,{children:"Eval ID"}),(0,i.jsx)(o.Z,{children:"Dataset ID"}),(0,i.jsx)(o.Z,{children:"Raw score"}),(0,i.jsx)(o.Z,{children:"Pass rate"}),(0,i.jsx)(o.Z,{children:"Pass count"}),(0,i.jsx)(o.Z,{children:"Fail count"})]})}),(0,i.jsx)(a.Z,{children:null==l?void 0:l.evals.sort((e,t)=>t.id.localeCompare(e.id)).map(e=>{var t,n,s,l,r,c;let d=null!==(l=null===(t=e.metrics)||void 0===t?void 0:t.testPassCount)&&void 0!==l?l:0,a=null!==(r=null===(n=e.metrics)||void 0===n?void 0:n.testFailCount)&&void 0!==r?r:0,h=d+a>0?(d/(d+a)*100).toFixed(2)+"%":"-";return(0,i.jsxs)(u.Z,{children:[(0,i.jsx)(o.Z,{children:(0,i.jsx)(v(),{href:"/eval/?evalId=".concat(e.id),children:e.id})}),(0,i.jsx)(o.Z,{children:(0,i.jsx)(v(),{href:"/datasets/?id=".concat(e.datasetId),children:e.datasetId.slice(0,6)})}),(0,i.jsx)(o.Z,{children:null!==(c=null===(s=e.metrics)||void 0===s?void 0:s.score.toFixed(2))&&void 0!==c?c:"-"}),(0,i.jsx)(o.Z,{children:h}),(0,i.jsx)(o.Z,{children:d}),(0,i.jsx)(o.Z,{children:a})]},"eval-".concat(e.id))})})]})]}),(0,i.jsx)(w.Z,{children:(0,i.jsx)(f.Z,{onClick:s,children:"Close"})})]})};function I(){let e=(0,p.useSearchParams)(),[t,n]=(0,s.useState)([]),[Z,f]=(0,s.useState)("date"),[m,w]=(0,s.useState)("desc"),[y,C]=(0,s.useState)(1),[g,E]=(0,s.useState)(10),[I,P]=(0,s.useState)(!1),[S,D]=(0,s.useState)(0),b=e=>{let t=Z===e&&"asc"===m?"desc":"asc";f(e),w(t)};(0,s.useEffect)(()=>{(async()=>{fetch("".concat(await (0,l.b)(),"/api/prompts")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===Z?0:"asc"===m?e[Z]>t[Z]?1:-1:e[Z]<t[Z]?1:-1);n(t)})})()},[Z,m]),(0,s.useEffect)(()=>{let n=null==e?void 0:e.get("id");if(n){let e=t.findIndex(e=>e.id.startsWith(n));-1!==e&&_(e)}},[t,e]);let _=e=>{P(!0),D(e)};return(0,i.jsxs)(r.Z,{paddingX:2,children:[(0,i.jsxs)(d.Z,{children:[(0,i.jsx)(h.Z,{children:(0,i.jsxs)(u.Z,{children:[(0,i.jsx)(o.Z,{style:{width:"10%"},children:"ID"}),(0,i.jsx)(o.Z,{style:{width:"60%"},children:(0,i.jsx)(x.Z,{active:"raw"===Z,direction:"raw"===Z?m:"asc",onClick:()=>b("raw"),children:"Prompt"})}),(0,i.jsx)(o.Z,{style:{width:"20%"},children:(0,i.jsx)(j.Z,{title:"The date of the most recent eval for this prompt",children:(0,i.jsx)(x.Z,{active:"date"===Z,direction:"date"===Z?m:"asc",onClick:()=>b("date"),children:"Most recent eval"})})}),(0,i.jsx)(o.Z,{style:{width:"10%"},children:(0,i.jsx)(x.Z,{active:"count"===Z,direction:"count"===Z?m:"asc",onClick:()=>b("count"),children:"# Evals"})})]})}),(0,i.jsx)(a.Z,{children:t.slice((y-1)*g,y*g).map((e,t)=>(0,i.jsxs)(u.Z,{hover:!0,children:[(0,i.jsx)(o.Z,{style:{width:"10%"},children:e.id.slice(0,6)}),(0,i.jsx)(o.Z,{style:{width:"60%",whiteSpace:"pre-wrap",cursor:"pointer"},onClick:()=>_(t),children:e.prompt.raw.length>500?e.prompt.raw.slice(0,500)+"...":e.prompt.raw}),(0,i.jsx)(o.Z,{style:{width:"20%"},children:e.recentEvalDate?(0,i.jsx)(v(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalDate}):"Unknown"}),(0,i.jsx)(o.Z,{style:{width:"10%"},children:e.count})]},t))})]}),Math.ceil(t.length/g)>1&&(0,i.jsx)(c.Z,{count:Math.ceil(t.length/g),page:y,onChange:(e,t)=>C(t)}),t[S]&&(0,i.jsx)(k,{openDialog:I,handleClose:()=>{P(!1)},selectedPrompt:t[S]})]})}}},function(e){e.O(0,[540,640,215,770,995,374,322,470,730,744],function(){return e(e.s=38486)}),_N_E=e.O()}]);