promptfoo 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +3 -2
- package/dist/src/evaluator.d.ts.map +1 -1
- package/dist/src/evaluator.js +4 -0
- package/dist/src/evaluator.js.map +1 -1
- package/dist/src/main.js +1 -3
- package/dist/src/main.js.map +1 -1
- package/dist/src/matchers.d.ts.map +1 -1
- package/dist/src/matchers.js +54 -23
- package/dist/src/matchers.js.map +1 -1
- package/dist/src/onboarding.d.ts +1 -1
- package/dist/src/onboarding.d.ts.map +1 -1
- package/dist/src/onboarding.js +1 -1
- package/dist/src/prompts.d.ts.map +1 -1
- package/dist/src/prompts.js +2 -1
- package/dist/src/prompts.js.map +1 -1
- package/dist/src/providers/huggingface.d.ts +17 -1
- package/dist/src/providers/huggingface.d.ts.map +1 -1
- package/dist/src/providers/huggingface.js +68 -1
- package/dist/src/providers/huggingface.js.map +1 -1
- package/dist/src/providers/openai.d.ts +12 -0
- package/dist/src/providers/openai.d.ts.map +1 -1
- package/dist/src/providers/openai.js +101 -34
- package/dist/src/providers/openai.js.map +1 -1
- package/dist/src/providers/pythonCompletion.d.ts +9 -0
- package/dist/src/providers/pythonCompletion.d.ts.map +1 -0
- package/dist/src/providers/pythonCompletion.js +40 -0
- package/dist/src/providers/pythonCompletion.js.map +1 -0
- package/dist/src/providers/wrapper.py +25 -0
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +15 -1
- package/dist/src/providers.js.map +1 -1
- package/dist/src/tableOutput.html +1 -1
- package/dist/src/types.d.ts +9 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/util.d.ts +1 -0
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +19 -17
- package/dist/src/util.js.map +1 -1
- package/dist/src/web/nextui/404/index.html +1 -1
- package/dist/src/web/nextui/404.html +1 -1
- package/dist/src/web/nextui/_next/static/chunks/952-eb6b2155f5ba4e9f.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/{webpack-e7aa396ee7944e48.js → webpack-e6ac4c38096b344b.js} +1 -1
- package/dist/src/web/nextui/_next/static/css/44f8c2f691de485c.css +1 -0
- package/dist/src/web/nextui/_next/static/css/c9e17d55591e229d.css +1 -0
- package/dist/src/web/nextui/auth/login/index.html +1 -1
- package/dist/src/web/nextui/auth/login/index.txt +3 -3
- package/dist/src/web/nextui/auth/signup/index.html +1 -1
- package/dist/src/web/nextui/auth/signup/index.txt +3 -3
- package/dist/src/web/nextui/datasets/index.html +1 -1
- package/dist/src/web/nextui/datasets/index.txt +3 -3
- package/dist/src/web/nextui/eval/index.html +1 -1
- package/dist/src/web/nextui/eval/index.txt +6 -6
- package/dist/src/web/nextui/index.html +1 -1
- package/dist/src/web/nextui/index.txt +3 -3
- package/dist/src/web/nextui/prompts/index.html +1 -1
- package/dist/src/web/nextui/prompts/index.txt +3 -3
- package/dist/src/web/nextui/setup/index.html +2 -2
- package/dist/src/web/nextui/setup/index.txt +4 -4
- package/dist/src/web/server.d.ts.map +1 -1
- package/dist/src/web/server.js +1 -2
- package/dist/src/web/server.js.map +1 -1
- package/package.json +3 -2
- package/dist/src/web/nextui/_next/static/chunks/952-41ca99945f156cbf.js +0 -1
- package/dist/src/web/nextui/_next/static/css/e14a0dd8058bc3be.css +0 -1
- package/dist/src/web/nextui/_next/static/css/e6c7df5aef93b247.css +0 -1
- /package/dist/src/web/nextui/_next/static/{mxkRaSA6iUTYeSCbLQn-- → bWwyhhi_GnxeugMr1nDIX}/_buildManifest.js +0 -0
- /package/dist/src/web/nextui/_next/static/{mxkRaSA6iUTYeSCbLQn-- → bWwyhhi_GnxeugMr1nDIX}/_ssgManifest.js +0 -0
- /package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/{page-8875bf3354bef591.js → page-ddcbd905630da9ba.js} +0 -0
- /package/dist/src/web/nextui/_next/static/chunks/app/eval/{page-5a7e2b8bc8f37780.js → page-06a8580f8b1af9df.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[952],{2810:function(e,t,s){"use strict";let n;async function l(){if(!n){let e=await fetch("/api/config"),t=await e.json();n=t.apiBaseUrl}return n}s.d(t,{b:function(){return l}})},9952:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eA}});var n=s(7437),l=s(2265),r=s(2130),i=s(6882),a=s(3388),o=s(4033),c=s(3082),d=s(8440),u=s(6507),h=s(5551),p=s(7760),m=s(3391),x=s(4081),j=s(819),g=s(8212),f=s(5507),v=s(923),b=s(654),y=s(3295),Z=s(2467),C=s(3457),k=s(1975),w=s(8276),S=s(9605),R=s(9190),N=s(2053),E=s(6704),P=s(9394),F=s(1797),T=s(6337),O=s(1101),I=s(9872),L=s(2653),M=s(3533),D=s(4740),A=s(4660);let U=(0,A.Ue)(e=>({filePath:null,setFilePath:t=>e(()=>({filePath:t})),table:null,setTable:t=>e(()=>({table:t})),config:null,setConfig:t=>e(()=>({config:t})),maxTextLength:250,setMaxTextLength:t=>e(()=>({maxTextLength:t})),wordBreak:"break-word",setWordBreak:t=>e(()=>({wordBreak:t})),showInferenceDetails:!0,setShowInferenceDetails:t=>e(()=>({showInferenceDetails:t})),renderMarkdown:!1,setRenderMarkdown:t=>e(()=>({renderMarkdown:t}))})),W=["#fd7f6f","#7eb0d5","#b2e061","#bd7ebe","#ffb55a","#ffee65","#beb9db","#fdcce5","#8bd3c7"];function _(e){let{table:t}=e,s=(0,l.useRef)(null),r=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!s.current)return;r.current&&r.current.destroy();let e=t.body.flatMap(e=>e.outputs.map(e=>e.score)),n=Math.min(...e),l=(Math.ceil(Math.max(...e))-Math.floor(n))/10,i=Array.from({length:11},(e,t)=>parseFloat((Math.floor(n)+t*l).toFixed(2))),a=t.head.prompts.map((e,s)=>{let n=t.body.flatMap(e=>e.outputs[s].score),r=i.map(e=>n.filter(t=>t>=e&&t<e+l).length);return{label:"Prompt ".concat(s+1),data:r,backgroundColor:W[s%W.length]}});r.current=new E.kL(s.current,{type:"bar",data:{labels:i,datasets:a},options:{animation:!1,plugins:{title:{display:!0,text:"Score Distribution"},legend:{display:!1},tooltip:{callbacks:{title:function(e){let t=e[0].datasetIndex;return"Prompt ".concat(t+1)},label:function(e){let t=e.dataIndex,s=i[t],n=i[t+1];return n?"".concat(s," <= score < ").concat(n):"".concat(s," <= score")}}}}}})},[t]),(0,n.jsx)("canvas",{ref:s,style:{maxHeight:"300px"}})}function V(e){let{table:t}=e,s=(0,l.useRef)(null),r=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!s.current)return;r.current&&r.current.destroy();let e=t.head.prompts.map((e,s)=>{let n=t.body.flatMap(e=>e.outputs[s]),l=n.filter(e=>e.pass).length,r=l/n.length*100;return{label:"Prompt ".concat(s+1),data:[r],backgroundColor:W[s%W.length]}});r.current=new E.kL(s.current,{type:"bar",data:{labels:["Pass Rate (%)"],datasets:e},options:{animation:!1,plugins:{title:{display:!0,text:"Pass rate"},legend:{display:!0}}}})},[t]),(0,n.jsx)("canvas",{ref:s,style:{maxHeight:"300px"}})}function z(e){let{table:t}=e,s=(0,l.useRef)(null),r=(0,l.useRef)(null),[i,a]=(0,l.useState)(0),[o,c]=(0,l.useState)(1),[d,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(!s.current)return;r.current&&r.current.destroy();let e=t.body.flatMap(e=>e.outputs.map(e=>e.score)),n=Math.min(...e),l=Math.max(...e),a=t.body.map(e=>{let t=e.outputs[i].score,s=e.outputs[o].score;return{x:t,y:s,backgroundColor:s>t?"green":s<t?"red":"gray"}});r.current=new E.kL(s.current,{type:"scatter",data:{datasets:[{data:a,backgroundColor:a.map(e=>e.backgroundColor)},{type:"line",data:[{x:n,y:n},{x:l,y:l}],borderColor:"gray",borderWidth:1,borderDash:[5,5],pointRadius:0}]},options:{animation:!1,plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(e){let s=t.body[e.dataIndex],n=s.outputs[0].text,l=s.outputs[1].text;return n.length>30&&(n=n.substring(0,30)+"..."),l.length>30&&(l=l.substring(0,30)+"..."),"Output 1: ".concat(n,"\nOutput 2: ").concat(l)}}}},scales:{x:{title:{display:!0,text:"Prompt ".concat(i+1," Score")}},y:{title:{display:!0,text:"Prompt ".concat(o+1," Score")}}}}})},[t,i,o]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(P.Z,{open:d,onClose:()=>u(!1),children:[(0,n.jsx)(F.Z,{children:"Compare prompt outputs"}),(0,n.jsxs)(T.Z,{children:[(0,n.jsx)(x.Z,{sx:{m:1,minWidth:120},children:(0,n.jsx)(b.Z,{value:i,onChange:e=>a(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,n.jsxs)(f.Z,{value:t,children:["Prompt ",t+1]},t))})}),(0,n.jsx)(x.Z,{sx:{m:1,minWidth:120},children:(0,n.jsx)(b.Z,{value:o,onChange:e=>c(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,n.jsxs)(f.Z,{value:t,children:["Prompt ",t+1]},t))})})]})]}),(0,n.jsx)("canvas",{ref:s,style:{maxHeight:"300px",cursor:"pointer"},onClick:()=>u(!0)})]})}function B(e){let{columnVisibility:t}=e,s=(0,O.Z)();E.kL.defaults.color="dark"===s.palette.mode?"#aaa":"#666";let[r,i]=(0,l.useState)(!0),{table:a}=U();if(!a||!r||a.head.prompts.length<2)return null;let o=a.body.flatMap(e=>e.outputs.map(e=>e.score));return 1===new Set(o).size?null:(0,n.jsx)(D.SV,{fallback:null,children:(0,n.jsxs)(I.Z,{style:{position:"relative",padding:s.spacing(3)},children:[(0,n.jsx)(L.Z,{style:{position:"absolute",right:0,top:0},onClick:()=>i(!1),children:(0,n.jsx)(M.Z,{})}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[(0,n.jsx)("div",{style:{width:"33%"},children:(0,n.jsx)(V,{table:a})}),(0,n.jsx)("div",{style:{width:"33%"},children:(0,n.jsx)(_,{table:a})}),(0,n.jsx)("div",{style:{width:"33%"},children:(0,n.jsx)(z,{table:a})})]})]})})}E.kL.register(E.vn,E.ST,E.ho,E.uw,E.f$,E.ZL,E.jn,E.od,E.u,E.wL);var H=s(9116);s(5777);var J=s(3425),G=s(7660),q=s(3216),X=s(182),Y=s(5391),$=s(1396),K=s.n($);s(8715);var Q=e=>{let{lookup:t}=e;return t&&Object.keys(t).length?(0,n.jsx)("div",{className:"custom-metric-container",children:Object.entries(t).map(e=>{let[t,s]=e;return t&&s?(0,n.jsxs)("span",{children:[t,": ",s.toFixed(2)]},t):null})}):null},ee=s(2834),et=s(5446),es=s(9329),en=s(4719),el=s(3701),er=s(9279),ei=s(666),ea=s(5795),eo=s(6988),ec=s(4147),ed=s(3226);function eu(e){let{gradingResults:t}=e;return t?(0,n.jsxs)(u.Z,{mt:2,children:[(0,n.jsx)(ed.Z,{variant:"subtitle1",children:"Assertions"}),(0,n.jsx)(ea.Z,{children:(0,n.jsxs)(el.Z,{children:[(0,n.jsx)(eo.Z,{children:(0,n.jsxs)(ec.Z,{children:[(0,n.jsx)(ei.Z,{style:{fontWeight:"bold"},children:"Pass"}),(0,n.jsx)(ei.Z,{style:{fontWeight:"bold"},children:"Score"}),(0,n.jsx)(ei.Z,{style:{fontWeight:"bold"},children:"Type"}),(0,n.jsx)(ei.Z,{style:{fontWeight:"bold"},children:"Value"}),(0,n.jsx)(ei.Z,{style:{fontWeight:"bold"},children:"Reason"})]})}),(0,n.jsx)(er.Z,{children:t.map((e,t)=>{var s,l;return(0,n.jsxs)(ec.Z,{children:[(0,n.jsx)(ei.Z,{children:e.pass?"✅":"❌"}),(0,n.jsx)(ei.Z,{children:e.score.toFixed(2)}),(0,n.jsx)(ei.Z,{children:(null===(s=e.assertion)||void 0===s?void 0:s.type)||""}),(0,n.jsx)(ei.Z,{style:{whiteSpace:"pre-wrap"},children:(null===(l=e.assertion)||void 0===l?void 0:l.value)?String(e.assertion.value):"-"}),(0,n.jsx)(ei.Z,{style:{whiteSpace:"pre-wrap"},children:e.reason})]},t)})})]})})]}):null}function eh(e){let{open:t,onClose:s,prompt:r,provider:i,output:a,gradingResults:o}=e,[c,d]=(0,l.useState)(!1);(0,l.useEffect)(()=>{d(!1)},[r]);let p=async e=>{await navigator.clipboard.writeText(e),d(!0)};return(0,n.jsxs)(P.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"lg",children:[(0,n.jsxs)(F.Z,{children:["Details",i&&": ".concat(i)]}),(0,n.jsxs)(T.Z,{children:[(0,n.jsxs)(u.Z,{mb:2,children:[(0,n.jsx)(ed.Z,{variant:"subtitle1",style:{marginBottom:"1rem"},children:"Prompt"}),(0,n.jsx)(et.u,{readOnly:!0,value:r,style:{width:"100%",padding:"0.75rem"},maxRows:20}),(0,n.jsx)(L.Z,{onClick:()=>p(r),style:{position:"absolute",right:"10px",top:"10px"},children:c?(0,n.jsx)(en.Z,{}):(0,n.jsx)(es.Z,{})})]}),a&&(0,n.jsxs)(u.Z,{my:2,children:[(0,n.jsx)(ed.Z,{variant:"subtitle1",style:{marginBottom:"1rem",marginTop:"1rem"},children:"Output"}),(0,n.jsx)(et.u,{readOnly:!0,maxRows:20,value:a,style:{width:"100%",padding:"0.75rem"}})]}),(0,n.jsx)(eu,{gradingResults:o})]}),(0,n.jsx)(ee.Z,{children:(0,n.jsx)(h.Z,{onClick:s,children:"Close"})})]})}var ep=s(9396),em=s(4173),ex=function(){let e=(0,O.Z)(),[t,s]=l.useState(!1),r=()=>{s(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{textAlign:"center",marginTop:20,marginBottom:40},children:(0,n.jsx)(h.Z,{variant:"text",color:"primary",startIcon:(0,n.jsx)(ep.Z,{}),onClick:()=>{s(!0)},children:"Generate test cases"})}),(0,n.jsxs)(P.Z,{open:t,onClose:r,children:[(0,n.jsx)(F.Z,{children:"Run on Command Line"}),(0,n.jsx)(T.Z,{children:(0,n.jsxs)(em.Z,{children:[(0,n.jsx)("p",{children:"This feature is in beta. UI coming soon."}),(0,n.jsxs)("p",{children:["Run"," ",(0,n.jsx)(u.Z,{component:"code",sx:{backgroundColor:"dark"===e.palette.mode?"#424242":"#f0f0f0",padding:"2px 4px",borderRadius:"4px"},children:"promptfoo generate dataset"}),"to generate test cases on the command line."]})]})}),(0,n.jsx)(ee.Z,{children:(0,n.jsx)(h.Z,{onClick:r,color:"primary",children:"Close"})})]})]})},ej=s(2810);function eg(e){return null===e||0===e||1===e?"":"(".concat(e.toFixed(2),")")}function ef(e){return"string"==typeof e||"number"==typeof e?e.toString().length:Array.isArray(e)?e.reduce((e,t)=>e+ef(t),0):l.isValidElement(e)&&e.props.children?l.Children.toArray(e.props.children).reduce((e,t)=>e+ef(t),0):0}function ev(e){let t,{text:s,maxLength:r}=e,[i,a]=l.useState(!0),o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("string"==typeof e||"number"==typeof e){let s=e.toString();return s.slice(0,r-t)}if(Array.isArray(e)){let s=[],n=t;for(let t of e){let e=ef(t);if(n+e>r){s.push(o(t,n));break}s.push(t),n+=e}return s}if(l.isValidElement(e)&&e.props.children){let s=ef(e.props.children);if(s>r-t)return l.cloneElement(e,{...e.props,children:o(e.props.children,t)})}return e};t=l.isValidElement(s)||"string"==typeof s?s:JSON.stringify(s);let c=i?o(t):t,d=ef(t)>r;return(0,n.jsxs)("div",{style:{cursor:d?"pointer":"normal"},onClick:()=>{a(!i)},children:[c,i&&ef(t)>r&&(0,n.jsx)("span",{children:"..."})]})}function eb(e){var t,s,r,i,a;let o,c,d,u,h,{output:p,maxTextLength:m,rowIndex:x,promptIndex:j,onRating:g,firstOutput:f,filterMode:v,searchText:b,showStats:y}=e,{renderMarkdown:Z}=U(),[C,k]=l.useState(!1),S="string"==typeof p.text?p.text:JSON.stringify(p.text),R=[];if(!p.pass&&S.includes("---")?S=(R=S.split("---")).slice(1).join("---"):R=[S],"different"===v&&f){let e,t="string"==typeof f.text?f.text:JSON.stringify(f.text);t.includes("---")&&(t=t.split("---").slice(1).join("---"));try{JSON.parse(t),JSON.parse(S),e=(0,H.CT)(t,S)}catch(s){e=t.includes(". ")&&S.includes(". ")?(0,H.SY)(t,S):(0,H.NV)(t,S)}o=(0,n.jsx)(n.Fragment,{children:e.map((e,t)=>e.added?(0,n.jsx)("ins",{children:e.value},t):e.removed?(0,n.jsx)("del",{children:e.value},t):(0,n.jsx)("span",{children:e.value},t))})}if(b){let e;let t=RegExp(b,"gi"),s=[];for(;null!==(e=t.exec(S));)s.push({start:e.index,end:t.lastIndex}),t.lastIndex;o=(0,n.jsx)(n.Fragment,{children:s.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:S.substring(0,s[0].start)},"text-before"),s.map((e,t)=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"search-highlight",children:S.substring(e.start,e.end)},"match-"+t),(0,n.jsx)("span",{children:S.substring(e.end,s[t+1]?s[t+1].start:S.length)},"text-after-"+t)]}))]}):(0,n.jsx)("span",{children:S},"no-match")})}else Z&&(o=(0,n.jsx)(J.U,{children:S}));let N=e=>{var t;g(x,j,e,void 0,null===(t=p.gradingResult)||void 0===t?void 0:t.comment)},E=()=>{var e;let t=prompt("Comment:",(null===(e=p.gradingResult)||void 0===e?void 0:e.comment)||"");null!=t&&g(x,j,void 0,void 0,t)};if(null===(t=p.tokenUsage)||void 0===t?void 0:t.completion){d=(0,n.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(p.latencyMs)," ms"]});let e=p.tokenUsage.completion/(p.latencyMs/1e3);u=(0,n.jsx)("span",{children:Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)})}p.cost&&(h=(0,n.jsxs)("span",{children:["$",p.cost.toPrecision(2)]})),(null===(s=p.tokenUsage)||void 0===s?void 0:s.cached)?c=(0,n.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(p.tokenUsage.cached)," ","(cached)"]}):(null===(r=p.tokenUsage)||void 0===r?void 0:r.total)&&(c=(0,n.jsx)("span",{children:Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(p.tokenUsage.total)}));let P=(null===(i=p.gradingResult)||void 0===i?void 0:i.comment)?(0,n.jsx)("div",{className:"comment",onClick:E,children:p.gradingResult.comment}):null,F=y?(0,n.jsxs)("div",{className:"cell-detail",children:[c&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Tokens:"})," ",c]}),d&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Latency:"})," ",d]}),u&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Tokens/Sec:"})," ",u]}),h&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Cost:"})," ",h]})]}):null,T=(0,n.jsxs)("div",{className:"cell-actions",children:[p.prompt&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"action",onClick:()=>{k(!0)},children:(0,n.jsx)(w.Z,{title:"View ouput and test details",children:(0,n.jsx)("span",{children:"\uD83D\uDD0E"})})}),(0,n.jsx)(eh,{open:C,onClose:()=>{k(!1)},prompt:p.prompt,provider:p.provider,gradingResults:null===(a=p.gradingResult)||void 0===a?void 0:a.componentResults,output:S})]}),(0,n.jsx)("span",{className:"action",onClick:()=>N(!0),children:(0,n.jsx)(w.Z,{title:"Mark test passed (score 1.0)",children:(0,n.jsx)("span",{children:"\uD83D\uDC4D"})})}),(0,n.jsx)("span",{className:"action",onClick:()=>N(!1),children:(0,n.jsx)(w.Z,{title:"Mark test failed (score 0.0)",children:(0,n.jsx)("span",{children:"\uD83D\uDC4E"})})}),(0,n.jsx)("span",{className:"action",onClick:()=>{let e=prompt("Set test score (0.0 - 1.0):",String(p.score));if(null!==e){let s=parseFloat(e);if(!isNaN(s)&&s>=0&&s<=1){var t;g(x,j,void 0,s,null===(t=p.gradingResult)||void 0===t?void 0:t.comment)}else alert("Invalid score. Please enter a value between 0.0 and 1.0.")}},children:(0,n.jsx)(w.Z,{title:"Set test score",children:(0,n.jsx)("span",{children:"\uD83D\uDD22"})})}),(0,n.jsx)("span",{className:"action",onClick:E,children:(0,n.jsx)(w.Z,{title:"Edit comment",children:(0,n.jsx)("span",{children:"✏️"})})})]});return(0,n.jsxs)("div",{className:"cell",children:[p.pass?(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"status pass",children:[(0,n.jsxs)("div",{className:"pill",children:["PASS",(0,n.jsx)("span",{className:"score",children:eg(p.score)})]}),(0,n.jsx)(Q,{lookup:p.namedScores})]})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"status fail",children:[(0,n.jsxs)("div",{className:"pill",children:["FAIL",p.score>0?" ":"",(0,n.jsx)("span",{className:"score",children:eg(p.score)})]}),(0,n.jsx)(Q,{lookup:p.namedScores}),(0,n.jsx)("span",{className:"fail-reason",children:R[0].trim().split("\n").map((e,t)=>(0,n.jsxs)(l.Fragment,{children:[e,(0,n.jsx)("br",{})]},t))})]})}),(0,n.jsx)(ev,{text:o||S,maxLength:m}),P,F,T]})}function ey(e){let{text:t,maxLength:s,expandedText:r,resourceId:i,className:a}=e,[o,c]=l.useState(!1);return(0,n.jsxs)("div",{className:"".concat(a||""),children:[(0,n.jsx)(ev,{text:t,maxLength:s}),r&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w.Z,{title:"View prompt",children:(0,n.jsx)("span",{className:"action",onClick:()=>{c(!0)},children:"\uD83D\uDD0E"})}),(0,n.jsx)(eh,{open:o,onClose:()=>{c(!1)},prompt:r}),i&&(0,n.jsx)(w.Z,{title:"View other evals and datasets for this prompt",children:(0,n.jsx)("span",{className:"action",children:(0,n.jsx)(K(),{href:"/prompts/?id=".concat(i),target:"_blank",children:(0,n.jsx)(Y.Z,{fontSize:"small"})})})})]})]})}function eZ(e){let{maxTextLength:t,columnVisibility:s,wordBreak:i,filterMode:a,failureFilter:o,searchText:c,showStats:d,onFailureFilterToggle:u}=e,{filePath:h,table:m,setTable:x}=U();(0,r.Z)(m,"Table should be defined");let{head:j,body:g}=m,f=j.prompts.map((e,t)=>g.reduce((e,s)=>e+(s.outputs[t].pass?1:0),0)),v=j.prompts.map((e,t)=>g.reduce((e,s)=>{var n,l;return e+((null===(l=s.outputs[t].gradingResult)||void 0===l?void 0:null===(n=l.componentResults)||void 0===n?void 0:n.length)||0)},0)),b=j.prompts.map((e,t)=>g.reduce((e,s)=>{var n;let l=null===(n=s.outputs[t].gradingResult)||void 0===n?void 0:n.componentResults;return e+(l?l.filter(e=>e.pass).length:0)},0)),y=async(e,t,s,n,l)=>{let r=[...g],i={...r[e]},a=[...i.outputs],o=null!=s?s:a[t].pass,c=void 0===n?s?1:0:n||0;a[t].pass=o,a[t].score=c;let d={...a[t].gradingResult||{},pass:o,score:c,reason:"Manual result (overrides all other grading results)",comment:l,assertion:null};a[t].gradingResult=d,i.outputs=a,r[e]=i;let u={head:j,body:r};x(u);try{let e=await fetch("".concat(await (0,ej.b)(),"/api/eval/").concat(h),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:u})});if(!e.ok)throw Error("Network response was not ok")}catch(e){console.error("Failed to update table:",e)}},Z=f.reduce((e,t,s,n)=>t>n[e]?s:e,0),C=f[Z],k=(0,G.Cl)(),w=[];j.vars.length>0&&w.push(k.group({id:"vars",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Variables"}),columns:j.vars.map((e,s)=>k.accessor(e=>e.vars[s],{id:"Variable ".concat(s+1),header:()=>(0,n.jsx)(ey,{text:e,maxLength:t,className:"font-bold"}),cell:e=>(0,n.jsx)(ev,{text:e.getValue(),maxLength:t}),size:50}))})),w.push(k.group({id:"prompts",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Outputs"}),columns:j.prompts.map((e,s)=>k.accessor(e=>(function(e){if("string"==typeof e){let t=e.startsWith("[PASS]"),s=e;return e.startsWith("[PASS]")?s=s.slice(6):e.startsWith("[FAIL]")&&(s=s.slice(6)),{text:s,pass:t,score:t?1:0}}return e})(e.outputs[s]),{id:"Prompt ".concat(s+1),header:()=>{var l,r,i,c,h,m,x,y;let Z=f[s]&&g.length?(f[s]/g.length*100).toFixed(2):"0.00",k=f[s]===C&&0!==C,w="Prompt ".concat(s+1),S=o[w]||!1,R=d?(0,n.jsxs)("div",{className:"prompt-detail",children:[v[s]?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Asserts:"})," ",b[s],"/",v[s]," passed"]}):null,(null===(l=e.metrics)||void 0===l?void 0:l.totalLatencyMs)?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Avg Latency:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.totalLatencyMs/g.length)," ","ms"]}):null,(null===(i=e.metrics)||void 0===i?void 0:null===(r=i.tokenUsage)||void 0===r?void 0:r.total)?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Avg Tokens:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.tokenUsage.total/g.length)]}):null,(null===(c=e.metrics)||void 0===c?void 0:c.totalLatencyMs)&&(null===(m=e.metrics)||void 0===m?void 0:null===(h=m.tokenUsage)||void 0===h?void 0:h.completion)?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Tokens/Sec:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.tokenUsage.completion/(e.metrics.totalLatencyMs/1e3))]}):null,(null===(x=e.metrics)||void 0===x?void 0:x.cost)?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Cost:"})," $",e.metrics.cost.toPrecision(2)]}):null]}):null,N=j.prompts.every(e=>e.provider===j.prompts[0].provider),E=e.provider?e.provider.split(":"):[],P=E.length>1?(0,n.jsxs)(n.Fragment,{children:[E[0],":",(0,n.jsx)("strong",{children:E.slice(1).join(":")})]}):(0,n.jsx)("strong",{children:e.provider});return(0,n.jsxs)("div",{className:"output-header",children:[(0,n.jsxs)("div",{className:"pills",children:[!N&&e.provider?(0,n.jsx)("div",{className:"provider",children:P}):null,(0,n.jsx)("div",{className:"summary",children:(0,n.jsxs)("div",{className:"highlight ".concat(k?"success":""),children:[(0,n.jsxs)("strong",{children:[Z,"% passing"]})," (",f[s],"/",g.length," cases)"]})}),(null===(y=e.metrics)||void 0===y?void 0:y.namedScores)&&Object.keys(e.metrics.namedScores).length>0?(0,n.jsx)(Q,{lookup:e.metrics.namedScores}):null]}),(0,n.jsx)(ey,{className:"prompt-container",text:e.display,expandedText:e.raw,maxLength:t,resourceId:e.id}),R,"failures"===a&&(0,n.jsx)(X.Z,{sx:{"& .MuiFormControlLabel-label":{fontSize:"0.75rem"}},control:(0,n.jsx)(p.Z,{checked:S,onChange:e=>u(w,e.target.checked)}),label:"Show failures"})]})},cell:e=>(0,n.jsx)(eb,{output:e.getValue(),maxTextLength:t,rowIndex:e.row.index,promptIndex:s,onRating:y,firstOutput:R[e.row.index].outputs[0],filterMode:a,searchText:c,showStats:d})}))}));let S=g.some(e=>e.description);S&&w.splice(0,0,{accessorFn:e=>e.description||"",id:"description",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Description"}),cell:e=>(0,n.jsx)(ev,{text:String(e.getValue()),maxLength:t}),size:50});let R=l.useMemo(()=>{let e=RegExp(c,"i");return g.filter(t=>{let s="failures"===a?t.outputs.some((e,t)=>o["Prompt ".concat(t+1)]&&!e.pass):"different"!==a||!t.outputs.every(e=>e.text===t.outputs[0].text),n=!c||t.outputs.some(t=>{var s;let n="".concat(t.text," ").concat(Object.keys(t.namedScores)," ").concat(null===(s=t.gradingResult)||void 0===s?void 0:s.reason);return e.test(n)});return s&&n})},[g,o,a,c]),N=(0,q.b7)({data:R,columns:w,columnResizeMode:"onChange",getCoreRowModel:(0,G.sC)(),state:{columnVisibility:s}});return(0,n.jsxs)("div",{children:[(0,n.jsxs)("table",{className:"results-table firefox-fix ".concat(t<=25?"compact":""),style:{wordBreak:i},children:[(0,n.jsx)("thead",{children:N.getHeaderGroups().map(e=>(0,n.jsx)("tr",{className:"header",children:e.headers.map(e=>(0,n.jsxs)("th",{colSpan:e.colSpan,style:{width:e.getSize()},children:[e.isPlaceholder?null:(0,q.ie)(e.column.columnDef.header,e.getContext()),(0,n.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(e.column.getIsResizing()?"isResizing":"")})]},e.id))},e.id))}),(0,n.jsx)("tbody",{children:N.getRowModel().rows.map((e,t)=>{let s=!1;return(0,n.jsx)("tr",{children:e.getVisibleCells().map(e=>{let l=e.column.id.startsWith("Variable")||"description"===e.column.id,r=!l&&!s;return r&&(s=!0),(0,n.jsx)("td",{style:{width:e.column.getSize()},className:"".concat(l?"variable":""," ").concat(0!==t||l?"":"first-prompt-row"," ").concat(r?"first-prompt-col":""),children:(0,q.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]}),(0,n.jsx)(ex,{})]})}s(2604);var eC=s(2481),ek=s(7175);function ew(e){let{open:t,onClose:r}=e,{config:i}=U(),a=l.useRef(null),[o,c]=l.useState(!1),[d,p]=l.useState("");l.useEffect(()=>{t&&(async()=>{let{default:e}=await s.e(339).then(s.bind(s,8339));p(e.dump(i))})()},[t,i]);let m=()=>{c(!1),r()};return(0,n.jsxs)(P.Z,{open:t,onClose:m,"aria-labelledby":"config-dialog-title",maxWidth:"md",fullWidth:!0,children:[(0,n.jsx)(F.Z,{id:"config-dialog-title",children:(0,n.jsxs)(u.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,n.jsx)(ed.Z,{variant:"h6",style:{flexGrow:1},children:"Config"}),(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(w.Z,{title:"Copy to clipboard",children:(0,n.jsx)(L.Z,{onClick:()=>{a.current&&(a.current.select(),document.execCommand("copy"),c(!0))},children:o?(0,n.jsx)(en.Z,{}):(0,n.jsx)(ek.Z,{})})}),(0,n.jsx)(w.Z,{title:"Download .yaml",children:(0,n.jsx)(L.Z,{onClick:()=>{let e=new Blob([d],{type:"text/yaml;charset=utf-8"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="config.yaml",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(t)},children:(0,n.jsx)(eC.Z,{})})})]})]})}),(0,n.jsx)(T.Z,{children:(0,n.jsx)(ed.Z,{variant:"body1",component:"div",children:(0,n.jsx)("textarea",{ref:a,readOnly:!0,value:d,style:{width:"100%",minHeight:"400px",fontFamily:"monospace",border:"1px solid #ccc"}})})}),(0,n.jsx)(ee.Z,{children:(0,n.jsx)(h.Z,{onClick:m,color:"primary",children:"Close"})})]})}var eS=e=>{let{open:t,onClose:s,shareUrl:r}=e,i=(0,l.useRef)(null),[a,o]=(0,l.useState)(!1),c=()=>{s(),o(!1)};return(0,n.jsxs)(P.Z,{open:t,onClose:c,PaperProps:{style:{minWidth:"min(660px, 100%)"}},children:[(0,n.jsx)(F.Z,{children:"Your eval is ready to share"}),(0,n.jsxs)(T.Z,{children:[(0,n.jsx)(k.Z,{inputRef:i,value:r,fullWidth:!0,InputProps:{readOnly:!0,endAdornment:(0,n.jsx)(L.Z,{onClick:()=>{i.current&&(i.current.select(),document.execCommand("copy"),o(!0))},children:a?(0,n.jsx)(en.Z,{}):(0,n.jsx)(ek.Z,{})})}}),(0,n.jsx)(em.Z,{sx:{fontSize:"0.75rem"},children:"Shared URLs are deleted after 1 week."})]}),(0,n.jsx)(ee.Z,{children:(0,n.jsx)(h.Z,{onClick:c,color:"primary",children:"Close"})})]})},eR=s(33),eN=e=>{let{open:t,onClose:s}=e,{maxTextLength:l,setMaxTextLength:r,wordBreak:i,setWordBreak:a,showInferenceDetails:o,setShowInferenceDetails:c,renderMarkdown:d,setRenderMarkdown:m}=U();return(0,n.jsxs)(P.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"sm",children:[(0,n.jsx)(F.Z,{children:"Table View Settings"}),(0,n.jsxs)(T.Z,{children:[(0,n.jsx)(u.Z,{children:(0,n.jsx)(w.Z,{title:"Forcing line breaks makes it easier to adjust column widths to your liking",children:(0,n.jsx)(X.Z,{control:(0,n.jsx)(p.Z,{checked:"break-all"===i,onChange:e=>a(e.target.checked?"break-all":"break-word")}),label:"Force line breaks"})})}),(0,n.jsx)(u.Z,{children:(0,n.jsx)(X.Z,{control:(0,n.jsx)(p.Z,{checked:d,onChange:e=>m(e.target.checked)}),label:"Render model outputs as Markdown"})}),(0,n.jsx)(u.Z,{children:(0,n.jsx)(w.Z,{title:"Show detailed inference statistics such as latency, tokens used, cost, etc.",children:(0,n.jsx)(X.Z,{control:(0,n.jsx)(p.Z,{checked:o,onChange:e=>c(e.target.checked)}),label:"Show inference details"})})}),(0,n.jsxs)(u.Z,{maxWidth:"sm",children:[(0,n.jsxs)(ed.Z,{mt:2,children:["Max text length: ",l]}),(0,n.jsx)(eR.ZP,{min:25,max:1e3,value:l,onChange:(e,t)=>r(t)})]})]}),(0,n.jsx)(ee.Z,{children:(0,n.jsx)(h.Z,{onClick:s,children:"Close"})})]})},eE=s(1938),eP=s(2601);let eF=eP.env.NEXT_PUBLIC_PROMPTFOO_REMOTE_API_BASE_URL||eP.env.PROMPTFOO_REMOTE_API_BASE_URL||"https://api.promptfoo.dev",eT=eP.env.NEXT_PUBLIC_PROMPTFOO_REMOTE_APP_BASE_URL||eP.env.PROMPTFOO_REMOTE_APP_BASE_URL||"https://app.promptfoo.dev",eO=(0,R.Z)(C.Z)(e=>{let{theme:t}=e;return{maxWidth:"100%",flexWrap:"wrap",[t.breakpoints.down("sm")]:{flexDirection:"column"}}});function eI(e){let{recentEvals:t,onRecentEvalSelected:s,defaultEvalId:a}=e,c=(0,o.useRouter)(),{table:C,config:R,maxTextLength:E,wordBreak:P,showInferenceDetails:F}=U(),{setStateFromConfig:T}=(0,eE.o)(),[O,I]=l.useState({}),[L,M]=l.useState([]),[D,A]=l.useState(""),[W]=(0,N.Nr)(D,1e3),[_,V]=l.useState({}),[z,H]=l.useState("all"),[J,G]=l.useState(!1),[q,X]=l.useState(""),[Y,$]=l.useState(!1),K=async()=>{$(!0);try{let e=await fetch("".concat(eF,"/eval"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:{version:2,createdAt:new Date().toISOString(),results:{table:C},config:R}})}),{id:t}=await e.json(),s="".concat(eT,"/eval/").concat(t);X(s),G(!0)}catch(e){alert("Sorry, something went wrong.")}finally{$(!1)}},[Q,ee]=l.useState(!1),[et,es]=l.useState(!1);(0,r.Z)(C,"Table data must be loaded before rendering ResultsView");let{head:en}=C,el=[...en.vars.map((e,t)=>({value:"Variable ".concat(t+1),label:"Var ".concat(t+1,": ").concat(en.vars[t].length>100?en.vars[t].slice(0,97)+"...":en.vars[t]),group:"Variables"})),...en.prompts.map((e,t)=>({value:"Prompt ".concat(t+1),label:"Prompt ".concat(t+1,": ").concat(en.prompts[t].display.length>100?en.prompts[t].display.slice(0,97)+"...":en.prompts[t].display),group:"Prompts"}))];return l.useEffect(()=>{M(el.map(e=>e.value))},[en]),(0,n.jsxs)("div",{style:{marginLeft:"1rem",marginRight:"1rem"},children:[(0,n.jsx)(u.Z,{py:"md",children:(0,n.jsxs)(eO,{direction:"row",spacing:4,alignItems:"center",children:[(0,n.jsx)(u.Z,{children:t&&t.length>0&&(0,n.jsx)(x.Z,{sx:{m:1,minWidth:200},size:"small",children:(0,n.jsx)(d.Z,{size:"small",options:t,renderOption:(e,t)=>(0,l.createElement)("li",{...e,key:t.id},t.label),style:{width:350},renderInput:e=>(0,n.jsx)(k.Z,{...e,label:"Eval run",variant:"outlined"}),defaultValue:t[0],onChange:(e,t)=>{t&&t.id&&s(t.id)},disableClearable:!0})})}),(0,n.jsx)(u.Z,{children:(0,n.jsxs)(x.Z,{sx:{m:1,minWidth:200,maxWidth:350},size:"small",children:[(0,n.jsx)(j.Z,{id:"visible-columns-label",children:"Columns"}),(0,n.jsx)(b.Z,{labelId:"visible-columns-label",id:"visible-columns",multiple:!0,value:L,onChange:e=>{let{target:{value:t}}=e;M("string"==typeof t?t.split(","):t);let s=[...en.vars.map((e,t)=>"Variable ".concat(t+1)),...en.prompts.map((e,t)=>"Prompt ".concat(t+1))],n={};s.forEach(e=>{n[e]=("string"==typeof t?t.split(","):t).includes(e)}),I(n)},input:(0,n.jsx)(v.Z,{label:"Visible columns"}),renderValue:e=>e.join(", "),children:el.map(e=>(0,n.jsxs)(f.Z,{dense:!0,value:e.value,children:[(0,n.jsx)(p.Z,{checked:L.indexOf(e.value)>-1}),(0,n.jsx)(g.Z,{primary:e.label})]},e.value))})]})}),(0,n.jsx)(u.Z,{children:(0,n.jsxs)(x.Z,{sx:{minWidth:180},size:"small",children:[(0,n.jsx)(j.Z,{id:"failure-filter-mode-label",children:"Display"}),(0,n.jsxs)(b.Z,{labelId:"filter-mode-label",id:"filter-mode",value:z,onChange:e=>{let t=e.target.value;H(t);let s={};en.prompts.forEach((e,n)=>{s["Prompt ".concat(n+1)]="failures"===t}),V(s)},label:"Filter",children:[(0,n.jsx)(f.Z,{value:"all",children:"Show all results"}),(0,n.jsx)(f.Z,{value:"failures",children:"Show failures only"}),(0,n.jsx)(f.Z,{value:"different",children:"Show different only"})]})]})}),(0,n.jsx)(u.Z,{children:(0,n.jsx)(k.Z,{sx:{minWidth:180},size:"small",label:"Search",placeholder:"Text or regex",value:D,onChange:e=>{A(e.target.value)}})}),(0,n.jsx)(u.Z,{flexGrow:1}),(0,n.jsx)(u.Z,{display:"flex",justifyContent:"flex-end",children:(0,n.jsxs)(eO,{direction:"row",spacing:2,children:[(0,n.jsx)(w.Z,{title:"Edit table view settings",children:(0,n.jsx)(h.Z,{color:"primary",onClick:()=>es(!0),startIcon:(0,n.jsx)(y.Z,{}),children:"Table Settings"})}),R&&(0,n.jsx)(w.Z,{title:"View the configuration that defines this eval",children:(0,n.jsx)(h.Z,{color:"primary",onClick:()=>ee(!0),startIcon:(0,n.jsx)(S.Z,{}),children:"View YAML"})}),R&&(0,n.jsx)(w.Z,{title:"Edit eval",children:(0,n.jsx)(h.Z,{color:"primary",onClick:()=>{T(R),c.push("/setup/")},startIcon:(0,n.jsx)(m.Z,{}),children:"Edit Eval"})}),(null==R?void 0:R.sharing)&&(0,n.jsx)(w.Z,{title:"Generate a unique URL that others can access",children:(0,n.jsx)(h.Z,{color:"primary",onClick:K,disabled:Y,startIcon:Y?(0,n.jsx)(i.Z,{size:16}):(0,n.jsx)(Z.Z,{}),children:"Share"})})]})})]})}),(0,n.jsx)(B,{columnVisibility:O}),(0,n.jsx)(eZ,{maxTextLength:E,columnVisibility:O,wordBreak:P,showStats:F,filterMode:z,failureFilter:_,searchText:W,onFailureFilterToggle:(e,t)=>{V(s=>({...s,[e]:t}))}}),(0,n.jsx)(ew,{open:Q,onClose:()=>ee(!1)}),(0,n.jsx)(eS,{open:J,onClose:()=>G(!1),shareUrl:q}),(0,n.jsx)(eN,{open:et,onClose:()=>es(!1)})]})}var eL=s(279);async function eM(){let e=(0,c.createClientComponentClient)(),{data:{user:t}}=await e.auth.getUser();(0,r.Z)(t,"User not logged in");let{data:s,error:n}=await e.from("EvaluationResult").select("id, createdAt").eq("user_id",t.id).order("createdAt",{ascending:!1}).limit(100);return s||[]}async function eD(e){let t=(0,c.createClientComponentClient)(),{data:s,error:n}=await t.from("EvaluationResult").select("*").eq("id",e).single();return s}function eA(e){var t;let{fetchId:s,preloadedData:c,recentEvals:d,defaultEvalId:u}=e,h=(0,o.useRouter)(),{table:p,setTable:m,setConfig:x,setFilePath:j}=U(),[g,f]=l.useState(!1),[v,b]=l.useState(!1),[y,Z]=l.useState(d||[]),C=async()=>{(0,r.Z)(eL.T,"Cannot fetch recent files when not running locally");let e=await fetch("".concat(await (0,ej.b)(),"/results"),{cache:"no-store"}),t=await e.json();return Z(t.data),t.data},k=l.useCallback(async e=>{let t=await fetch("".concat(await (0,ej.b)(),"/results/").concat(e),{cache:"no-store"}),s=await t.json();m(s.data.results.table),x(s.data.config),j(e)},[m,x,j]),w=async e=>{eL.T?k(e):(f(!1),h.push("/eval/remote:".concat(encodeURIComponent(e))))},[S,R]=l.useState(u||(null===(t=y[0])||void 0===t?void 0:t.id)),N=(0,o.useSearchParams)(),E=N?N.get("file"):null;return(l.useEffect(()=>{if(E){let e=async()=>{await k(E),f(!0)};e()}else if(c){var e;m(null===(e=c.data.results)||void 0===e?void 0:e.table),x(c.data.config),f(!0)}else if(s){let e=async()=>{var e;let t="".concat(eF,"/eval/").concat(s);console.log("Fetching eval from remote server",t);let n=await fetch(t);if(!n.ok){b(!0);return}let l=await n.json();m(null===(e=l.data.results)||void 0===e?void 0:e.table),x(l.data.config),f(!0)};e()}else eL.T?(0,ej.b)().then(e=>{let t=(0,a.io)(e);return t.on("init",e=>{console.log("Initialized socket connection",e),f(!0),m(e.results.table),x(e.config),C().then(e=>{var t,s;R(null===(t=e[0])||void 0===t?void 0:t.id),j(null===(s=e[0])||void 0===s?void 0:s.id)})}),t.on("update",e=>{console.log("Received data update",e),m(e.results.table),x(e.config),C().then(e=>{var t;R(null===(t=e[0])||void 0===t?void 0:t.id)})}),()=>{t.disconnect()}}):eM().then(e=>{Z(e.map(e=>({id:e.id,label:e.createdAt}))),e.length>0&&eD(e[0].id).then(t=>{(0,r.Z)(t,"Eval not found");let s=t.results,n=t.config;R(e[0].id),m(s.table),x(n),f(!0)})})},[s,m,x,j,k,c,R,E]),v)?(0,n.jsx)("div",{className:"loading",children:"404 Eval not found"}):g&&p?(0,n.jsx)(eI,{defaultEvalId:S,recentEvals:y,onRecentEvalSelected:w}):(0,n.jsxs)("div",{className:"loading",children:[(0,n.jsx)("div",{children:(0,n.jsx)(i.Z,{size:22})}),(0,n.jsx)("div",{children:"Loading eval data"})]})}s(5038)},279:function(e,t,s){"use strict";s.d(t,{T:function(){return l},e:function(){return r}});var n=s(2601);let l=!n.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,r=""},1938:function(e,t,s){"use strict";s.d(t,{o:function(){return r}});var n=s(4660),l=s(4810);let r=(0,n.Ue)()((0,l.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],setEnv:t=>e({env:t}),setTestCases:t=>e({testCases:t}),setDescription:t=>e({description:t}),setProviders:t=>e({providers:t}),setPrompts:t=>e({prompts:t}),setStateFromConfig:t=>{let s={};t.description&&(s.description=t.description||""),t.tests&&(s.testCases=t.tests),t.providers&&(s.providers=t.providers),t.prompts&&("string"==typeof t.prompts?s.prompts=[t.prompts]:Array.isArray(t.prompts)?s.prompts=t.prompts.filter(e=>!e.endsWith(".txt")&&!e.endsWith(".json")&&!e.endsWith(".yaml")):console.warn("Invalid prompts config",t.prompts)),e(s)},getTestSuite:()=>{let{description:e,testCases:s,providers:n,prompts:l,env:r}=t();return{env:r,description:e,providers:n,prompts:l,tests:s}}}),{name:"promptfoo",skipHydration:!0}))},8715:function(){},5038:function(){},2604:function(){},5777:function(){}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.custom-metric-container{display:inline-flex;flex-wrap:wrap;gap:.25rem;font-weight:400}.custom-metric-container>span{padding:.25rem .5rem;border-radius:4px;color:var(--text-color);border:1px solid var(--border-color);margin-right:.25rem}.font-bold{font-weight:700}.divTable,table.results-table{border:1px solid var(--table-border-color);border-collapse:collapse;width:100%;margin:1rem 0;box-shadow:0 2px 4px rgba(0,0,0,.1)}.results-table ins{background-color:var(--insert-highlight-color);text-decoration:none}.results-table del{background-color:var(--delete-highlight-color);-webkit-text-decoration:strikethrough;text-decoration:strikethrough}.tr{display:flex}.results-table tr,.tr{width:-moz-fit-content;width:fit-content}.results-table tr:hover,.tr:hover{background-color:rgba(0,0,0,.02)}.results-table td,.results-table th,.td,.th{position:relative;box-shadow:inset 0 0 0 1px var(--border-color);vertical-align:top;padding:1rem}.compact .td,.compact .th,.compact.results-table td,.compact.results-table th{padding:.5rem}.results-table td.variable,.results-table th.variable,.td.variable,.th.variable{background-color:var(--variable-background-color)}.results-table tr.header{background-color:var(--header-background-color)}.results-table th,.th{padding:1rem;position:relative;vertical-align:bottom;text-align:left;white-space:pre-wrap;font-weight:400}.results-table th .action{cursor:pointer;margin-left:.5rem}.results-table th .action svg{vertical-align:middle}.results-table td,.results-table th{height:1px}@-moz-document url-prefix(){.results-table td,.results-table th{height:100%}}.firefox-fix{display:table;height:100%}.results-table tr .cell{display:flex;flex-direction:column;white-space:pre-wrap;height:100%}.compact.results-table tr .cell>*,.results-table tr .variable>*{display:inline}.results-table tr .cell-actions{display:flex;gap:.5rem;visibility:hidden;position:absolute;top:1.25rem;right:.75rem;line-height:0;font-size:1.25rem}.results-table tr:hover .cell-actions{visibility:visible}.results-table tr .cell-detail{display:flex;flex-wrap:wrap;column-gap:.5rem;row-gap:.25rem;padding-top:1rem;margin-top:auto}.results-table tr .stat-item{font-weight:400;font-size:.75rem;color:#888}.results-table tr .cell-actions .action{cursor:pointer}.results-table th .output-header{display:flex;flex-direction:column;height:100%;align-items:flex-start}.results-table th .output-header .pills{display:flex;flex-wrap:wrap;gap:.25rem;align-items:center;margin-bottom:.5rem}.results-table th .prompt-container{font-weight:700;margin-bottom:.5rem}.results-table th .prompt-container>*{display:inline}.results-table th .provider{display:inline-block;padding:.25rem .5rem;background-color:var(--neutral-background-color);border:1px solid var(--border-color);border-radius:4px;margin-right:.25rem}.results-table th .summary{font-weight:400}.results-table th .prompt-detail{display:flex;flex-wrap:wrap;column-gap:.5rem;row-gap:.25rem;font-size:.75rem;color:#888;margin-top:auto}.results-table th .summary .highlight{padding:.25rem .5rem;border-radius:4px;background-color:var(--fail-background-color);border:1px solid var(--border-color)}.results-table th .summary .highlight.success{background-color:var(--success-background-color);border:1px solid var(--pass-color)}.results-table .status{font-weight:700;margin-bottom:.5rem}.results-table .status .pill{display:inline-block;padding:.25rem .5rem;border-radius:4px;margin-right:.25rem}.results-table .pass .pill{background-color:var(--success-background-color);color:var(--pass-color);border:1px solid var(--pass-color)}.results-table .fail .pill{border:1px solid var(--fail-color)}.fail-reason,.results-table .fail{color:var(--fail-color)}.fail-reason{font-weight:700}.compact .fail-reason{display:inline}.results-table .fail .pill{background-color:var(--fail-background-color)}.results-table td .score{font-weight:400}.results-table .comment{margin-top:.5rem;padding:.25rem .5rem;border-radius:4px;background-color:var(--neutral-background-color);font-style:italic;cursor:pointer}.first-prompt-col{border-left:2px solid #888}.first-prompt-row{border-top:2px solid #888}.search-highlight{color:var(--search-text-color);background-color:var(--search-highlight-color)}.resizer{position:absolute;right:0;top:0;height:100%;width:5px;cursor:col-resize;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:none;background:var(--text-color);opacity:.5}.resizer.isResizing{background:var(--text-color);opacity:1}@media (hover:hover){.resizer{opacity:0}:hover>.resizer{opacity:1}}body{background-color:var(--background-color);color:var(--text-color)}.error,.loading{display:flex;flex-direction:column;gap:1.5rem;justify-content:center;align-items:center;height:9rem}.error{font-size:1.5rem}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.custom-metric-container{display:inline-flex;flex-wrap:wrap;gap:.25rem;font-weight:400}.custom-metric-container>span{padding:.25rem .5rem;border-radius:4px;color:var(--text-color);border:1px solid var(--border-color);margin-right:.25rem}.font-bold{font-weight:700}.divTable,table.results-table{border:1px solid var(--table-border-color);border-collapse:collapse;width:100%;margin:1rem 0;box-shadow:0 2px 4px rgba(0,0,0,.1)}.results-table ins{background-color:var(--insert-highlight-color);text-decoration:none}.results-table del{background-color:var(--delete-highlight-color);-webkit-text-decoration:strikethrough;text-decoration:strikethrough}.tr{display:flex}.results-table tr,.tr{width:-moz-fit-content;width:fit-content}.results-table tr:hover,.tr:hover{background-color:rgba(0,0,0,.02)}.results-table td,.results-table th,.td,.th{position:relative;box-shadow:inset 0 0 0 1px var(--border-color);vertical-align:top;padding:1rem}.compact .td,.compact .th,.compact.results-table td,.compact.results-table th{padding:.5rem}.results-table td.variable,.results-table th.variable,.td.variable,.th.variable{background-color:var(--variable-background-color)}.results-table tr.header{background-color:var(--header-background-color)}.results-table th,.th{padding:1rem;position:relative;vertical-align:bottom;text-align:left;white-space:pre-wrap;font-weight:400}.results-table th .action{cursor:pointer;margin-left:.5rem}.results-table th .action svg{vertical-align:middle}.results-table td,.results-table th{height:1px}@-moz-document url-prefix(){.results-table td,.results-table th{height:100%}}.firefox-fix{display:table;height:100%}.results-table tr .cell{display:flex;flex-direction:column;white-space:pre-wrap;height:100%}.compact.results-table tr .cell>*,.results-table tr .variable>*{display:inline}.results-table tr .cell-actions{display:flex;gap:.5rem;visibility:hidden;position:absolute;top:1.25rem;right:.75rem;line-height:0;font-size:1.25rem}.results-table tr:hover .cell-actions{visibility:visible}.results-table tr .cell-detail{display:flex;flex-wrap:wrap;column-gap:.5rem;row-gap:.25rem;padding-top:1rem;margin-top:auto}.results-table tr .stat-item{font-weight:400;font-size:.75rem;color:#888}.results-table tr .cell-actions .action{cursor:pointer}.results-table th .output-header{display:flex;flex-direction:column;height:100%;align-items:flex-start}.results-table th .output-header .pills{display:flex;flex-wrap:wrap;gap:.25rem;align-items:center;margin-bottom:.5rem}.results-table th .prompt-container{font-weight:700;margin-bottom:.5rem}.results-table th .prompt-container>*{display:inline}.results-table th .provider{display:inline-block;padding:.25rem .5rem;background-color:var(--neutral-background-color);border:1px solid var(--border-color);border-radius:4px;margin-right:.25rem}.results-table th .summary{font-weight:400}.results-table th .prompt-detail{display:flex;flex-wrap:wrap;column-gap:.5rem;row-gap:.25rem;font-size:.75rem;color:#888;margin-top:auto}.results-table th .summary .highlight{padding:.25rem .5rem;border-radius:4px;background-color:var(--fail-background-color);border:1px solid var(--border-color)}.results-table th .summary .highlight.success{background-color:var(--success-background-color);border:1px solid var(--pass-color)}.results-table .status{font-weight:700;margin-bottom:.5rem}.results-table .status .pill{display:inline-block;padding:.25rem .5rem;border-radius:4px;margin-right:.25rem}.results-table .pass .pill{background-color:var(--success-background-color);color:var(--pass-color);border:1px solid var(--pass-color)}.results-table .fail .pill{border:1px solid var(--fail-color)}.fail-reason,.results-table .fail{color:var(--fail-color)}.fail-reason{font-weight:700}.compact .fail-reason{display:inline}.results-table .fail .pill{background-color:var(--fail-background-color)}.results-table td .score{font-weight:400}.results-table .comment{margin-top:.5rem;padding:.25rem .5rem;border-radius:4px;background-color:var(--neutral-background-color);font-style:italic;cursor:pointer}.first-prompt-col{border-left:2px solid #888}.first-prompt-row{border-top:2px solid #888}.search-highlight{color:var(--search-text-color);background-color:var(--search-highlight-color)}.resizer{position:absolute;right:0;top:0;height:100%;width:5px;cursor:col-resize;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:none;background:var(--text-color);opacity:.5}.resizer.isResizing{background:var(--text-color);opacity:1}@media (hover:hover){.resizer{opacity:0}:hover>.resizer{opacity:1}}body{background-color:var(--background-color);color:var(--text-color)}.loading{display:flex;flex-direction:column;gap:1.5rem;justify-content:center;align-items:center;height:9rem}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|