(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3425],{85278:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/evals/[id]",function(){return l(80294)}])},80294:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>P});var r=l(77528),a=l(55456),i=l(74848),c=l(96540),t=l(86715),n=l(8640),d=l(81924),h=l(97916),x=l(72748),o=l(29080),u=l(98536),m=l(14516),j=l(69231),v=l(23825),_=l(22424),p=l(33016),f=l(15445),w=l(88344),N=l(83785),g=l(60550),b=l(53171),y=l(59639),E=l(37399);let P=()=>{let{id:e}=(0,t.useRouter)().query,[s,l]=(0,c.useState)(null),[P,k]=(0,c.useState)(!0),[R,S]=(0,c.useState)(null),{isOpen:C,onOpen:I,onOpenChange:O}=(0,h.j)(),[T,z]=(0,c.useState)({message:"",color:"default",isVisible:!1}),A=(e,s)=>{z({message:e,color:s,isVisible:!0}),setTimeout(()=>z(e=>(0,a._)((0,r._)({},e),{isVisible:!1})),3e3)};(0,c.useEffect)(()=>{(async()=>{if(e)try{var s,r;let a=await (0,d.eW)(e),i={run_id:a.run_id,eval_name:a.eval_name,accuracy:a.results.accuracy,per_example_results:(null===(r=a.results.subset_metrics)||void 0===r?void 0:null===(s=r.default)||void 0===s?void 0:s.per_example_results)||[]};l(i)}catch(e){console.error("Error fetching eval results:",e),A("Failed to fetch eval results","danger")}finally{k(!1)}})()},[e]);let V=e=>(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"text-sm max-h-32 overflow-y-auto flex-grow",children:(0,i.jsx)("p",{children:e})}),(0,i.jsx)(x.T,{isIconOnly:!0,size:"sm",variant:"light",onClick:s=>{s.stopPropagation(),S(e),I()},children:(0,i.jsx)(E.In,{icon:"solar:full-screen-linear",className:"w-4 h-4"})})]});return P?(0,i.jsxs)("div",{className:"min-h-screen",children:[(0,i.jsx)(n.A,{activePage:"evals"}),(0,i.jsx)("div",{className:"flex justify-center items-center h-[calc(100vh-64px)]",children:(0,i.jsx)(o.o,{size:"lg"})})]}):s&&s.per_example_results?(0,i.jsxs)("div",{className:"min-h-screen",children:[(0,i.jsx)(n.A,{activePage:"evals"}),(0,i.jsxs)("div",{className:"p-6",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"text-2xl font-bold",children:"Eval Run Results"}),(0,i.jsxs)("div",{className:"text-gray-600 mt-2",children:["Run ID: ",s.run_id," • Eval: ",s.eval_name]})]}),(0,i.jsxs)(u.R,{color:"success",variant:"flat",size:"lg",children:["Accuracy: ",(100*s.accuracy).toFixed(1),"%"]})]}),(0,i.jsxs)(m.j,{"aria-label":"Eval results table",isHeaderSticky:!0,isStriped:!0,fullWidth:!0,children:[(0,i.jsxs)(j.X,{children:[(0,i.jsx)(v.e,{children:"Example ID"}),(0,i.jsx)(v.e,{width:"40%",children:"Prompt"}),(0,i.jsx)(v.e,{children:"Predicted"}),(0,i.jsx)(v.e,{children:"Ground Truth"}),(0,i.jsx)(v.e,{children:"Status"})]}),(0,i.jsx)(_.E,{items:s.per_example_results,children:e=>(0,i.jsxs)(p.s,{children:[(0,i.jsx)(f.w,{children:e.example_id||e.task_id}),(0,i.jsx)(f.w,{children:(0,i.jsx)("div",{className:"max-h-32 overflow-y-auto",children:V(e.prompt)})}),(0,i.jsx)(f.w,{children:e.predicted_answer}),(0,i.jsx)(f.w,{children:e.ground_truth_answer}),(0,i.jsx)(f.w,{children:(0,i.jsx)(u.R,{color:e.is_correct?"success":"danger",variant:"flat",children:e.is_correct?"Correct":"Incorrect"})})]},e.example_id||e.task_id||"result-".concat(e.predicted_answer,"-").concat(e.ground_truth_answer))})]})]}),(0,i.jsx)(w.Y,{isOpen:C,onOpenChange:O,classNames:{base:"max-w-[90%] h-[75vh] m-auto",wrapper:"w-[90%]",body:"p-5"},scrollBehavior:"inside",placement:"center",children:(0,i.jsx)(N.g,{children:e=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(g.c,{className:"flex flex-col gap-1",children:"Prompt"}),(0,i.jsx)(b.h,{className:"whitespace-pre-wrap overflow-y-auto",children:R})]})})}),T.isVisible&&(0,i.jsx)("div",{className:"fixed bottom-4 right-4 z-50",children:(0,i.jsx)(y.B,{color:T.color,children:T.message})})]}):(0,i.jsxs)("div",{className:"min-h-screen",children:[(0,i.jsx)(n.A,{activePage:"evals"}),(0,i.jsxs)("div",{className:"p-6",children:[(0,i.jsx)("h1",{className:"text-2xl font-bold mb-4",children:"Eval Run Results"}),(0,i.jsx)("p",{children:"No results available"})]})]})}}},e=>{var s=s=>e(e.s=s);e.O(0,[7998,8872,8660,7354,453,3427,8640,636,6593,8792],()=>s(85278)),_N_E=e.O()}]);