promptfoo 0.54.0 → 0.55.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.
Files changed (70) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/src/assertions.d.ts.map +1 -1
  3. package/dist/src/assertions.js +17 -6
  4. package/dist/src/assertions.js.map +1 -1
  5. package/dist/src/cache.d.ts.map +1 -1
  6. package/dist/src/cache.js +27 -24
  7. package/dist/src/cache.js.map +1 -1
  8. package/dist/src/csv.js +2 -2
  9. package/dist/src/csv.js.map +1 -1
  10. package/dist/src/evaluator.d.ts.map +1 -1
  11. package/dist/src/evaluator.js +10 -3
  12. package/dist/src/evaluator.js.map +1 -1
  13. package/dist/src/googleSheets.d.ts +1 -0
  14. package/dist/src/googleSheets.d.ts.map +1 -1
  15. package/dist/src/googleSheets.js +30 -1
  16. package/dist/src/googleSheets.js.map +1 -1
  17. package/dist/src/index.js +2 -2
  18. package/dist/src/index.js.map +1 -1
  19. package/dist/src/integrations/portkey.d.ts +19 -0
  20. package/dist/src/integrations/portkey.d.ts.map +1 -0
  21. package/dist/src/integrations/portkey.js +30 -0
  22. package/dist/src/integrations/portkey.js.map +1 -0
  23. package/dist/src/main.js +6 -2
  24. package/dist/src/main.js.map +1 -1
  25. package/dist/src/matchers.d.ts.map +1 -1
  26. package/dist/src/matchers.js +36 -12
  27. package/dist/src/matchers.js.map +1 -1
  28. package/dist/src/prompts.d.ts.map +1 -1
  29. package/dist/src/prompts.js +1 -0
  30. package/dist/src/prompts.js.map +1 -1
  31. package/dist/src/providers/mistral.d.ts.map +1 -1
  32. package/dist/src/providers/mistral.js +7 -0
  33. package/dist/src/providers/mistral.js.map +1 -1
  34. package/dist/src/providers/openai.d.ts.map +1 -1
  35. package/dist/src/providers/openai.js +2 -1
  36. package/dist/src/providers/openai.js.map +1 -1
  37. package/dist/src/providers.d.ts.map +1 -1
  38. package/dist/src/providers.js +63 -45
  39. package/dist/src/providers.js.map +1 -1
  40. package/dist/src/testCases.js +1 -1
  41. package/dist/src/testCases.js.map +1 -1
  42. package/dist/src/types.d.ts +6 -1
  43. package/dist/src/types.d.ts.map +1 -1
  44. package/dist/src/util.d.ts +2 -2
  45. package/dist/src/util.d.ts.map +1 -1
  46. package/dist/src/util.js +56 -40
  47. package/dist/src/util.js.map +1 -1
  48. package/dist/src/web/nextui/404/index.html +1 -1
  49. package/dist/src/web/nextui/404.html +1 -1
  50. package/dist/src/web/nextui/_next/static/chunks/{670-cbba26ea73165041.js → 670-c0bbfb378b86dbd6.js} +1 -1
  51. package/dist/src/web/nextui/_next/static/chunks/app/setup/{page-cc8eca41f942feda.js → page-1d8e707bf06b6d74.js} +1 -1
  52. package/dist/src/web/nextui/auth/login/index.html +1 -1
  53. package/dist/src/web/nextui/auth/login/index.txt +1 -1
  54. package/dist/src/web/nextui/auth/signup/index.html +1 -1
  55. package/dist/src/web/nextui/auth/signup/index.txt +1 -1
  56. package/dist/src/web/nextui/datasets/index.html +1 -1
  57. package/dist/src/web/nextui/datasets/index.txt +1 -1
  58. package/dist/src/web/nextui/eval/index.html +1 -1
  59. package/dist/src/web/nextui/eval/index.txt +2 -2
  60. package/dist/src/web/nextui/index.html +1 -1
  61. package/dist/src/web/nextui/index.txt +1 -1
  62. package/dist/src/web/nextui/progress/index.html +1 -1
  63. package/dist/src/web/nextui/progress/index.txt +1 -1
  64. package/dist/src/web/nextui/prompts/index.html +1 -1
  65. package/dist/src/web/nextui/prompts/index.txt +1 -1
  66. package/dist/src/web/nextui/setup/index.html +1 -1
  67. package/dist/src/web/nextui/setup/index.txt +2 -2
  68. package/package.json +1 -1
  69. /package/dist/src/web/nextui/_next/static/{C1CVMf9gtZLc_4C6z7Oy8 → 3HpbHMqtYmi39VCixO04u}/_buildManifest.js +0 -0
  70. /package/dist/src/web/nextui/_next/static/{C1CVMf9gtZLc_4C6z7Oy8 → 3HpbHMqtYmi39VCixO04u}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[670],{2810:function(e,t,s){"use strict";let n,l;async function a(){if(n||(l||(l=fetch("/api/config").then(e=>e.json()).then(e=>n=e.apiBaseUrl)),await l),void 0===n)throw Error("API base URL is undefined");return n}s.d(t,{b:function(){return a}})},9670:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eJ}});var n=s(7437),l=s(2265),a=s(2130),i=s(6882),r=s(3388),o=s(4033),c=s(3082),d=s(1116),u=s(8440),p=s(6507),h=s(5551),x=s(7760),m=s(6446),j=s(3391),g=s(4081),f=s(3226),v=s(819),y=s(8212),b=s(8864),Z=s(3375),C=s(9114),w=s(923),S=s(654),k=s(3295),N=s(2467),R=s(3457),P=s(1975),E=s(8276),I=s(9605),O=s(9190),F=s(2053),T=s(8339),L=s(2481),M=s(9394),D=s(6337),U=s(4660),A=s(4810);let _=(0,U.Ue)()((0,A.tJ)((e,t)=>({evalId:null,setEvalId:t=>e(()=>({evalId: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})),prettifyJson:!1,setPrettifyJson:t=>e(()=>({prettifyJson:t})),showPrompts:!1,setShowPrompts:t=>e(()=>({showPrompts:t}))}),{name:"ResultsViewStorage",storage:(0,A.FL)(()=>localStorage)}));var W=function(){let{table:e,config:t,evalId:s}=_(),[a,i]=l.useState(!1),r=(e,t)=>{let s=URL.createObjectURL(e),n=document.createElement("a");n.href=s,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)},o=()=>{i(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(C.Z,{onClick:()=>{i(!0)},children:[(0,n.jsx)(b.Z,{children:(0,n.jsx)(L.Z,{fontSize:"small"})}),(0,n.jsx)(y.Z,{children:"Download"})]}),(0,n.jsx)(M.Z,{onClose:o,open:a,children:(0,n.jsx)(D.Z,{children:(0,n.jsxs)(R.Z,{direction:"column",spacing:2,sx:{width:"100%"},children:[(0,n.jsx)(h.Z,{onClick:()=>{let e=T.default.dump(t),s=new Blob([e],{type:"text/yaml;charset=utf-8"});r(s,"promptfooconfig.yaml"),o()},startIcon:(0,n.jsx)(L.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download YAML Config"}),(0,n.jsx)(h.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"});r(t,"".concat(s,"-table.json")),o()},startIcon:(0,n.jsx)(L.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download Table JSON"}),(0,n.jsx)(h.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=e.body.map((t,s)=>({chosen:t.outputs.filter(e=>e.pass).map(e=>e.text),rejected:t.outputs.filter(e=>!e.pass).map(e=>e.text),vars:t.test.vars,providers:e.head.prompts.map(e=>e.provider),prompts:e.head.prompts.map(e=>e.display)})),n=new Blob([JSON.stringify(t,null,2)],{type:"application/json"});r(n,"".concat(s,"-dpo.json")),o()},startIcon:(0,n.jsx)(L.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download DPO JSON"})]})})})]})},V=s(6704),z=s(1797),B=s(1101),J=s(9872),H=s(2653),G=s(3533),X=s(4740);let Y=["#fd7f6f","#7eb0d5","#b2e061","#bd7ebe","#ffb55a","#ffee65","#beb9db","#fdcce5","#8bd3c7"];function q(e){let{table:t}=e,s=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!s.current)return;a.current&&a.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))),r=t.head.prompts.map((e,s)=>{let n=t.body.flatMap(e=>e.outputs[s].score),a=i.map(e=>n.filter(t=>t>=e&&t<e+l).length);return{label:"Prompt ".concat(s+1),data:a,backgroundColor:Y[s%Y.length]}});a.current=new V.kL(s.current,{type:"bar",data:{labels:i,datasets:r},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 $(e){let{table:t}=e,s=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!s.current)return;a.current&&a.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,a=l/n.length*100;return{label:"Prompt ".concat(s+1),data:[a],backgroundColor:Y[s%Y.length]}});a.current=new V.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 K(e){let{table:t}=e,s=(0,l.useRef)(null),a=(0,l.useRef)(null),[i,r]=(0,l.useState)(0),[o,c]=(0,l.useState)(1),[d,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(!s.current)return;a.current&&a.current.destroy();let e=t.body.flatMap(e=>e.outputs.map(e=>e.score)),n=Math.min(...e),l=Math.max(...e),r=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"}});a.current=new V.kL(s.current,{type:"scatter",data:{datasets:[{data:r,backgroundColor:r.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)(M.Z,{open:d,onClose:()=>u(!1),children:[(0,n.jsx)(z.Z,{children:"Compare prompt outputs"}),(0,n.jsxs)(D.Z,{children:[(0,n.jsx)(g.Z,{sx:{m:1,minWidth:120},children:(0,n.jsx)(S.Z,{value:i,onChange:e=>r(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,n.jsxs)(C.Z,{value:t,children:["Prompt ",t+1]},t))})}),(0,n.jsx)(g.Z,{sx:{m:1,minWidth:120},children:(0,n.jsx)(S.Z,{value:o,onChange:e=>c(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,n.jsxs)(C.Z,{value:t,children:["Prompt ",t+1]},t))})})]})]}),(0,n.jsx)("canvas",{ref:s,style:{maxHeight:"300px",cursor:"pointer"},onClick:()=>u(!0)})]})}function Q(e){let{columnVisibility:t}=e,s=(0,B.Z)();V.kL.defaults.color="dark"===s.palette.mode?"#aaa":"#666";let[a,i]=(0,l.useState)(!0),{table:r}=_();if(!r||!a||r.head.prompts.length<2)return null;let o=r.body.flatMap(e=>e.outputs.map(e=>e.score));return 1===new Set(o).size?null:(0,n.jsx)(X.SV,{fallback:null,children:(0,n.jsxs)(J.Z,{style:{position:"relative",padding:s.spacing(3)},children:[(0,n.jsx)(H.Z,{style:{position:"absolute",right:0,top:0},onClick:()=>i(!1),children:(0,n.jsx)(G.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)($,{table:r})}),(0,n.jsx)("div",{style:{width:"33%"},children:(0,n.jsx)(q,{table:r})}),(0,n.jsx)("div",{style:{width:"33%"},children:(0,n.jsx)(K,{table:r})})]})]})})}V.kL.register(V.vn,V.ST,V.ho,V.uw,V.f$,V.ZL,V.jn,V.od,V.u,V.wL);var ee=s(9116);s(5777);var et=s(3425),es=s(7660),en=s(3216),el=s(182),ea=s(5391),ei=s(1396),er=s.n(ei);s(8715);var eo=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},ec=s(2834),ed=s(5446),eu=s(9329),ep=s(4719),eh=s(3701),ex=s(9279),em=s(666),ej=s(5795),eg=s(6988),ef=s(4147);function ev(e){let{gradingResults:t}=e;return t?(0,n.jsxs)(p.Z,{mt:2,children:[(0,n.jsx)(f.Z,{variant:"subtitle1",children:"Assertions"}),(0,n.jsx)(ej.Z,{children:(0,n.jsxs)(eh.Z,{children:[(0,n.jsx)(eg.Z,{children:(0,n.jsxs)(ef.Z,{children:[(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Pass"}),(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Score"}),(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Type"}),(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Value"}),(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Reason"})]})}),(0,n.jsx)(ex.Z,{children:t.map((e,t)=>{var s,l;return(0,n.jsxs)(ef.Z,{children:[(0,n.jsx)(em.Z,{children:e.pass?"✅":"❌"}),(0,n.jsx)(em.Z,{children:e.score.toFixed(2)}),(0,n.jsx)(em.Z,{children:(null===(s=e.assertion)||void 0===s?void 0:s.type)||""}),(0,n.jsx)(em.Z,{style:{whiteSpace:"pre-wrap"},children:(null===(l=e.assertion)||void 0===l?void 0:l.value)?String(e.assertion.value):"-"}),(0,n.jsx)(em.Z,{style:{whiteSpace:"pre-wrap"},children:e.reason})]},t)})})]})})]}):null}function ey(e){let{open:t,onClose:s,prompt:a,provider:i,output:r,gradingResults:o}=e,[c,d]=(0,l.useState)(!1);(0,l.useEffect)(()=>{d(!1)},[a]);let u=async e=>{await navigator.clipboard.writeText(e),d(!0)};return(0,n.jsxs)(M.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"lg",children:[(0,n.jsxs)(z.Z,{children:["Details",i&&": ".concat(i)]}),(0,n.jsxs)(D.Z,{children:[(0,n.jsxs)(p.Z,{mb:2,children:[(0,n.jsx)(f.Z,{variant:"subtitle1",style:{marginBottom:"1rem"},children:"Prompt"}),(0,n.jsx)(ed.u,{readOnly:!0,value:a,style:{width:"100%",padding:"0.75rem"},maxRows:20}),(0,n.jsx)(H.Z,{onClick:()=>u(a),style:{position:"absolute",right:"10px",top:"10px"},children:c?(0,n.jsx)(ep.Z,{}):(0,n.jsx)(eu.Z,{})})]}),r&&(0,n.jsxs)(p.Z,{my:2,children:[(0,n.jsx)(f.Z,{variant:"subtitle1",style:{marginBottom:"1rem",marginTop:"1rem"},children:"Output"}),(0,n.jsx)(ed.u,{readOnly:!0,maxRows:20,value:r,style:{width:"100%",padding:"0.75rem"}})]}),(0,n.jsx)(ev,{gradingResults:o})]}),(0,n.jsx)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:s,children:"Close"})})]})}var eb=s(9396),eZ=s(4173),eC=function(){let e=(0,B.Z)(),[t,s]=l.useState(!1),a=()=>{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)(eb.Z,{}),onClick:()=>{s(!0)},children:"Generate test cases"})}),(0,n.jsxs)(M.Z,{open:t,onClose:a,children:[(0,n.jsx)(z.Z,{children:"Run on Command Line"}),(0,n.jsx)(D.Z,{children:(0,n.jsxs)(eZ.Z,{children:[(0,n.jsx)("p",{children:"This feature is in beta. UI coming soon."}),(0,n.jsxs)("p",{children:["Run"," ",(0,n.jsx)(p.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)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:a,color:"primary",children:"Close"})})]})]})},ew=s(2810);function eS(e){return null===e||0===e||1===e?"":"(".concat(e.toFixed(2),")")}function ek(e){return"string"==typeof e||"number"==typeof e?e.toString().length:Array.isArray(e)?e.reduce((e,t)=>e+ek(t),0):l.isValidElement(e)&&e.props.children?l.Children.toArray(e.props.children).reduce((e,t)=>e+ek(t),0):0}function eN(e){let t,{text:s,maxLength:a}=e,[i,r]=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,a-t)}if(Array.isArray(e)){let s=[],n=t;for(let t of e){let e=ek(t);if(n+e>a){s.push(o(t,n));break}s.push(t),n+=e}return s}if(l.isValidElement(e)&&e.props.children){let s=ek(e.props.children);if(s>a-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=ek(t)>a;return(0,n.jsxs)("div",{style:{cursor:d?"pointer":"normal"},onClick:()=>{r(!i)},children:[c,i&&ek(t)>a&&(0,n.jsx)("span",{children:"..."})]})}function eR(e){var t,s,a,i,r,o;let c,d,u,p,h,{output:x,maxTextLength:m,rowIndex:j,promptIndex:g,onRating:f,firstOutput:v,filterMode:y,searchText:b,showStats:Z}=e,{renderMarkdown:C,prettifyJson:w,showPrompts:S}=_(),[k,N]=l.useState(!1),[R,P]=l.useState(!1),I=()=>P(!R),O="string"==typeof x.text?x.text:JSON.stringify(x.text),F=[];if(O.startsWith("[IMAGE]")){let e=O.slice(7).trim();c=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("img",{loading:"lazy",src:e,alt:x.prompt,onClick:I}),R&&(0,n.jsx)("div",{className:"lightbox",onClick:I,children:(0,n.jsx)("img",{src:e,alt:x.prompt})})]})}else!x.pass&&O.includes("---")?O=(F=O.split("---")).slice(1).join("---"):F=[O];if("different"===y&&v){let e,t="string"==typeof v.text?v.text:JSON.stringify(v.text);t.includes("---")&&(t=t.split("---").slice(1).join("---"));try{JSON.parse(t),JSON.parse(O),e=(0,ee.CT)(t,O)}catch(s){e=t.includes(". ")&&O.includes(". ")?(0,ee.SY)(t,O):(0,ee.NV)(t,O)}c=(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)try{let e;let t=RegExp(b,"gi"),s=[];for(;null!==(e=t.exec(O));)s.push({start:e.index,end:t.lastIndex});c=(0,n.jsx)(n.Fragment,{children:s.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:O.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:O.substring(e.start,e.end)},"match-"+t),(0,n.jsx)("span",{children:O.substring(e.end,s[t+1]?s[t+1].start:O.length)},"text-after-"+t)]}))]}):(0,n.jsx)("span",{children:O},"no-match")})}catch(e){console.error("Invalid regular expression:",e.message)}else if(C)c=(0,n.jsx)(et.U,{children:O});else if(w)try{c=(0,n.jsx)("pre",{children:JSON.stringify(JSON.parse(O),null,2)})}catch(e){}let T=e=>{var t;f(j,g,e,void 0,null===(t=x.gradingResult)||void 0===t?void 0:t.comment)},L=()=>{var e;let t=prompt("Comment:",(null===(e=x.gradingResult)||void 0===e?void 0:e.comment)||"");null!=t&&f(j,g,void 0,void 0,t)};if(null===(t=x.tokenUsage)||void 0===t?void 0:t.completion){u=(0,n.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(x.latencyMs)," ms"]});let e=x.tokenUsage.completion/(x.latencyMs/1e3);p=(0,n.jsx)("span",{children:Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)})}x.cost&&(h=(0,n.jsxs)("span",{children:["$",x.cost.toPrecision(2)]})),(null===(s=x.tokenUsage)||void 0===s?void 0:s.cached)?d=(0,n.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(x.tokenUsage.cached)," ","(cached)"]}):(null===(a=x.tokenUsage)||void 0===a?void 0:a.total)&&(d=(0,n.jsx)("span",{children:Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(x.tokenUsage.total)}));let M=(null===(i=x.gradingResult)||void 0===i?void 0:i.comment)?(0,n.jsx)("div",{className:"comment",onClick:L,children:x.gradingResult.comment}):null,D=Z?(0,n.jsxs)("div",{className:"cell-detail",children:[d&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Tokens:"})," ",d]}),u&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Latency:"})," ",u]}),p&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Tokens/Sec:"})," ",p]}),h&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Cost:"})," ",h]})]}):null,U=(0,n.jsxs)("div",{className:"cell-actions",children:[x.prompt&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"action",onClick:()=>{N(!0)},children:(0,n.jsx)(E.Z,{title:"View ouput and test details",children:(0,n.jsx)("span",{children:"\uD83D\uDD0E"})})}),(0,n.jsx)(ey,{open:k,onClose:()=>{N(!1)},prompt:x.prompt,provider:x.provider,gradingResults:null===(r=x.gradingResult)||void 0===r?void 0:r.componentResults,output:O})]}),(0,n.jsx)("span",{className:"action",onClick:()=>T(!0),children:(0,n.jsx)(E.Z,{title:"Mark test passed (score 1.0)",children:(0,n.jsx)("span",{children:"\uD83D\uDC4D"})})}),(0,n.jsx)("span",{className:"action",onClick:()=>T(!1),children:(0,n.jsx)(E.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(x.score));if(null!==e){let s=parseFloat(e);if(!isNaN(s)&&s>=0&&s<=1){var t;f(j,g,void 0,s,null===(t=x.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)(E.Z,{title:"Set test score",children:(0,n.jsx)("span",{children:"\uD83D\uDD22"})})}),(0,n.jsx)("span",{className:"action",onClick:L,children:(0,n.jsx)(E.Z,{title:"Edit comment",children:(0,n.jsx)("span",{children:"✏️"})})})]});return(0,n.jsxs)("div",{className:"cell",children:[x.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:eS(x.score)})]}),(0,n.jsx)(eo,{lookup:x.namedScores})]})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"status fail",children:[(0,n.jsxs)("div",{className:"pill",children:["FAIL",x.score>0?" ":"",(0,n.jsx)("span",{className:"score",children:eS(x.score)})]}),(0,n.jsx)(eo,{lookup:x.namedScores}),(0,n.jsx)("span",{className:"fail-reason",children:null===(o=F[0])||void 0===o?void 0:o.trim().split("\n").map((e,t)=>(0,n.jsxs)(l.Fragment,{children:[e,(0,n.jsx)("br",{})]},t))})]})}),S&&v.prompt&&(0,n.jsxs)("div",{className:"prompt",children:[(0,n.jsx)("span",{className:"pill",children:"Prompt"}),x.prompt]}),(0,n.jsx)(eN,{text:c||O,maxLength:m}),M,D,U]})}function eP(e){let{text:t,maxLength:s,expandedText:a,resourceId:i,className:r}=e,[o,c]=l.useState(!1);return(0,n.jsxs)("div",{className:"".concat(r||""),children:[(0,n.jsx)(eN,{text:t,maxLength:s}),a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E.Z,{title:"View prompt",children:(0,n.jsx)("span",{className:"action",onClick:()=>{c(!0)},children:"\uD83D\uDD0E"})}),(0,n.jsx)(ey,{open:o,onClose:()=>{c(!1)},prompt:a}),i&&(0,n.jsx)(E.Z,{title:"View other evals and datasets for this prompt",children:(0,n.jsx)("span",{className:"action",children:(0,n.jsx)(er(),{href:"/prompts/?id=".concat(i),target:"_blank",children:(0,n.jsx)(ea.Z,{fontSize:"small"})})})})]})]})}function eE(e){let{maxTextLength:t,columnVisibility:s,wordBreak:i,filterMode:r,failureFilter:o,searchText:c,showStats:d,onFailureFilterToggle:u}=e,{evalId:m,table:j,setTable:g}=_();(0,a.Z)(j,"Table should be defined");let{head:v,body:y}=j,b=v.prompts.map((e,t)=>y.reduce((e,s)=>e+(s.outputs[t].pass?1:0),0)),Z=v.prompts.map((e,t)=>y.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)),C=v.prompts.map((e,t)=>y.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)),w=async(e,t,s,n,l)=>{let a=[...y],i={...a[e]},r=[...i.outputs],o=null!=s?s:r[t].pass,c=void 0===n?s?1:0:n||0;r[t].pass=o,r[t].score=c;let d={...r[t].gradingResult||{},pass:o,score:c,reason:"Manual result (overrides all other grading results)",comment:l,assertion:null};r[t].gradingResult=d,i.outputs=r,a[e]=i;let u={head:v,body:a};g(u);try{let e=await fetch("".concat(await (0,ew.b)(),"/api/eval/").concat(m),{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)}},S=b.reduce((e,t,s,n)=>t>n[e]?s:e,0),k=b[S],N=(0,es.Cl)(),R=[];v.vars.length>0&&R.push(N.group({id:"vars",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Variables"}),columns:v.vars.map((e,s)=>N.accessor(e=>e.vars[s],{id:"Variable ".concat(s+1),header:()=>(0,n.jsx)(eP,{text:e,maxLength:t,className:"font-bold"}),cell:e=>(0,n.jsx)(eN,{text:e.getValue(),maxLength:t}),size:50}))})),R.push(N.group({id:"prompts",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Outputs"}),columns:v.prompts.map((e,s)=>N.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,a,i,c,p,h,m,j;let g=b[s]&&y.length?(b[s]/y.length*100).toFixed(2):"0.00",f=b[s]===k&&0!==k,w="Prompt ".concat(s+1),S=o[w]||!1,N=d?(0,n.jsxs)("div",{className:"prompt-detail",children:[Z[s]?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Asserts:"})," ",C[s],"/",Z[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/y.length)," ","ms"]}):null,(null===(i=e.metrics)||void 0===i?void 0:null===(a=i.tokenUsage)||void 0===a?void 0:a.total)?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Avg Tokens:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.tokenUsage.total/y.length)]}):null,(null===(c=e.metrics)||void 0===c?void 0:c.totalLatencyMs)&&(null===(h=e.metrics)||void 0===h?void 0:null===(p=h.tokenUsage)||void 0===p?void 0:p.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===(m=e.metrics)||void 0===m?void 0:m.cost)?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Cost:"})," $",e.metrics.cost.toPrecision(2)]}):null]}):null,R=v.prompts.every(e=>e.provider===v.prompts[0].provider),P=e.provider?e.provider.split(":"):[],E=P.length>1?(0,n.jsxs)(n.Fragment,{children:[P[0],":",(0,n.jsx)("strong",{children:P.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:[!R&&e.provider?(0,n.jsx)("div",{className:"provider",children:E}):null,(0,n.jsx)("div",{className:"summary",children:(0,n.jsxs)("div",{className:"highlight ".concat(f?"success":""),children:[(0,n.jsxs)("strong",{children:[g,"% passing"]})," (",b[s],"/",y.length," cases)"]})}),(null===(j=e.metrics)||void 0===j?void 0:j.namedScores)&&Object.keys(e.metrics.namedScores).length>0?(0,n.jsx)(eo,{lookup:e.metrics.namedScores}):null]}),(0,n.jsx)(eP,{className:"prompt-container",text:e.display,expandedText:e.raw,maxLength:t,resourceId:e.id}),N,"failures"===r&&(0,n.jsx)(el.Z,{sx:{"& .MuiFormControlLabel-label":{fontSize:"0.75rem"}},control:(0,n.jsx)(x.Z,{checked:S,onChange:e=>u(w,e.target.checked)}),label:"Show failures"})]})},cell:e=>(0,n.jsx)(eR,{output:e.getValue(),maxTextLength:t,rowIndex:e.row.index,promptIndex:s,onRating:w,firstOutput:O[e.row.index].outputs[0],filterMode:r,searchText:c,showStats:d})}))}));let E=y.some(e=>e.description);E&&R.splice(0,0,{accessorFn:e=>e.description||"",id:"description",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Description"}),cell:e=>(0,n.jsx)(eN,{text:String(e.getValue()),maxLength:t}),size:50});let I=Object.keys(s).length>0,O=l.useMemo(()=>{try{let e=RegExp(c,"i");return y.filter(t=>{let n="failures"===r?t.outputs.some((e,t)=>{let n="Prompt ".concat(t+1);return o[n]&&!e.pass&&(!I||s[n])}):"different"!==r||!t.outputs.every(e=>e.text===t.outputs[0].text),l=!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 n&&l})}catch(e){return console.error("Invalid regular expression:",e.message),y}},[y,o,r,c,s,I]),[F,T]=l.useState({pageIndex:0,pageSize:50}),L=(0,en.b7)({data:O,columns:R,columnResizeMode:"onChange",getCoreRowModel:(0,es.sC)(),getPaginationRowModel:(0,es.G_)(),state:{columnVisibility:s,pagination:F}});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:L.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,en.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:L.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,a=!l&&!s;return a&&(s=!0),(0,n.jsx)("td",{style:{width:e.column.getSize()},className:"".concat(l?"variable":""," ").concat(0!==t||l?"":"first-prompt-row"," ").concat(a?"first-prompt-col":""),children:(0,en.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]}),L.getPageCount()>1&&(0,n.jsxs)(p.Z,{className:"pagination",sx:{display:"flex",alignItems:"center",gap:2},children:[(0,n.jsx)(h.Z,{onClick:()=>T(e=>({...e,pageIndex:Math.max(e.pageIndex-1,0)})),disabled:0===L.getState().pagination.pageIndex,variant:"contained",children:"Previous"}),(0,n.jsxs)(f.Z,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:["Page",(0,n.jsx)(P.Z,{size:"small",type:"number",value:L.getState().pagination.pageIndex+1,onChange:e=>{let t=e.target.value?Number(e.target.value)-1:0;T(e=>({...e,pageIndex:Math.min(Math.max(t,0),L.getPageCount()-1)}))},InputProps:{style:{width:"60px",textAlign:"center"}},variant:"outlined"}),(0,n.jsxs)("span",{children:["of ",L.getPageCount()]})]}),(0,n.jsx)(h.Z,{onClick:()=>T(e=>({...e,pageIndex:Math.min(e.pageIndex+1,L.getPageCount()-1)})),disabled:L.getState().pagination.pageIndex+1>=L.getPageCount(),variant:"contained",children:"Next"})]}),(0,n.jsx)(eC,{})]})}s(2604);var eI=s(7175);function eO(e){let{open:t,onClose:a}=e,{config:i}=_(),r=l.useRef(null),[o,c]=l.useState(!1),[d,u]=l.useState("");l.useEffect(()=>{t&&(async()=>{let{default:e}=await Promise.resolve().then(s.bind(s,8339));u(e.dump(i))})()},[t,i]);let x=()=>{c(!1),a()};return(0,n.jsxs)(M.Z,{open:t,onClose:x,"aria-labelledby":"config-dialog-title",maxWidth:"md",fullWidth:!0,children:[(0,n.jsx)(z.Z,{id:"config-dialog-title",children:(0,n.jsxs)(p.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,n.jsx)(f.Z,{variant:"h6",style:{flexGrow:1},children:"Config"}),(0,n.jsxs)(p.Z,{children:[(0,n.jsx)(E.Z,{title:"Copy to clipboard",children:(0,n.jsx)(H.Z,{onClick:()=>{r.current&&(r.current.select(),document.execCommand("copy"),c(!0))},children:o?(0,n.jsx)(ep.Z,{}):(0,n.jsx)(eI.Z,{})})}),(0,n.jsx)(E.Z,{title:"Download .yaml",children:(0,n.jsx)(H.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)(L.Z,{})})})]})]})}),(0,n.jsx)(D.Z,{children:(0,n.jsx)(f.Z,{variant:"body1",component:"div",children:(0,n.jsx)("textarea",{ref:r,readOnly:!0,value:d,style:{width:"100%",minHeight:"400px",fontFamily:"monospace",border:"1px solid #ccc"}})})}),(0,n.jsx)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:x,color:"primary",children:"Close"})})]})}var eF=e=>{let{open:t,onClose:s,shareUrl:a}=e,i=(0,l.useRef)(null),[r,o]=(0,l.useState)(!1),c=()=>{s(),o(!1)};return(0,n.jsxs)(M.Z,{open:t,onClose:c,PaperProps:{style:{minWidth:"min(660px, 100%)"}},children:[(0,n.jsx)(z.Z,{children:"Your eval is ready to share"}),(0,n.jsxs)(D.Z,{children:[(0,n.jsx)(P.Z,{inputRef:i,value:a,fullWidth:!0,InputProps:{readOnly:!0,endAdornment:(0,n.jsx)(H.Z,{onClick:()=>{i.current&&(i.current.select(),document.execCommand("copy"),o(!0))},children:r?(0,n.jsx)(ep.Z,{}):(0,n.jsx)(eI.Z,{})})}}),(0,n.jsx)(eZ.Z,{sx:{fontSize:"0.75rem"},children:"Shared URLs are deleted after 2 weeks."})]}),(0,n.jsx)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:c,color:"primary",children:"Close"})})]})},eT=s(33),eL=e=>{let{open:t,onClose:s}=e,{maxTextLength:l,setMaxTextLength:a,wordBreak:i,setWordBreak:r,showInferenceDetails:o,setShowInferenceDetails:c,renderMarkdown:d,setRenderMarkdown:u,prettifyJson:m,setPrettifyJson:j,showPrompts:g,setShowPrompts:v}=_();return(0,n.jsxs)(M.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"sm",children:[(0,n.jsx)(z.Z,{children:"Table View Settings"}),(0,n.jsxs)(D.Z,{children:[(0,n.jsx)(p.Z,{children:(0,n.jsx)(E.Z,{title:"Forcing line breaks makes it easier to adjust column widths to your liking",children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:"break-all"===i,onChange:e=>r(e.target.checked?"break-all":"break-word")}),label:"Force line breaks"})})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:d,onChange:e=>u(e.target.checked)}),label:"Render model outputs as Markdown"})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:m,onChange:e=>j(e.target.checked)}),label:"Prettify JSON outputs"})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(E.Z,{title:"Show the final prompt that produced the output in each cell.",children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:g,onChange:e=>v(e.target.checked)}),label:"Show full prompt in output cell"})})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(E.Z,{title:"Show detailed inference statistics such as latency, tokens used, cost, etc.",children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:o,onChange:e=>c(e.target.checked)}),label:"Show inference details"})})}),(0,n.jsxs)(p.Z,{maxWidth:"sm",children:[(0,n.jsxs)(f.Z,{mt:2,children:["Max text length: ",l]}),(0,n.jsx)(eT.ZP,{min:25,max:1e3,value:l,onChange:(e,t)=>a(t)})]})]}),(0,n.jsx)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:s,children:"Close"})})]})},eM=s(1938),eD=s(7580);let eU=eD.env.NEXT_PUBLIC_PROMPTFOO_REMOTE_API_BASE_URL||eD.env.NEXT_PUBLIC_PROMPTFOO_BASE_URL||eD.env.PROMPTFOO_REMOTE_API_BASE_URL||"https://api.promptfoo.dev",eA=eD.env.NEXT_PUBLIC_PROMPTFOO_BASE_URL||eD.env.PROMPTFOO_REMOTE_APP_BASE_URL||"https://app.promptfoo.dev";s(6911);let e_=(0,O.Z)(R.Z)(e=>{let{theme:t}=e;return{maxWidth:"100%",flexWrap:"wrap",[t.breakpoints.down("sm")]:{flexDirection:"column"}}});function eW(e){let{recentEvals:t,onRecentEvalSelected:s,defaultEvalId:r}=e,c=(0,o.useRouter)(),{table:R,config:O,setConfig:T,maxTextLength:L,wordBreak:M,showInferenceDetails:D,evalId:U}=_(),{setStateFromConfig:A}=(0,eM.o)(),[V,z]=l.useState({}),[B,J]=l.useState([]),[H,G]=l.useState(""),[X]=(0,F.Nr)(H,1e3),[Y,q]=l.useState({}),[$,K]=l.useState("all"),[ee,et]=l.useState(!1),[es,en]=l.useState(""),[el,ea]=l.useState(!1),ei=async()=>{ea(!0);try{let e=await fetch("".concat(eU,"/api/eval"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:{version:2,createdAt:new Date().toISOString(),results:{table:R},config:O}})}),{id:t}=await e.json(),s="".concat(eA,"/eval/").concat(t);en(s),et(!0)}catch(e){alert("Sorry, something went wrong.")}finally{ea(!1)}},[er,eo]=l.useState(!1),[ec,ed]=l.useState(!1);(0,a.Z)(R,"Table data must be loaded before rendering ResultsView");let{head:eu}=R,ep=async()=>{(0,a.Z)(O,"Config must be loaded before clicking its description");let e=window.prompt("Enter new description:",O.description);if(null!==e&&e!==O.description){let t={...O,description:e};try{let e=await fetch("".concat(await (0,ew.b)(),"/api/eval/").concat(U),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:t})});if(!e.ok)throw Error("Network response was not ok");T(t)}catch(e){console.error("Failed to update table:",e)}}},eh=async()=>{if(window.confirm("Are you sure you want to delete this evaluation?"))try{let e=await fetch("".concat(await (0,ew.b)(),"/api/eval/").concat(U),{method:"DELETE"});if(!e.ok)throw Error("Network response was not ok");c.push("/")}catch(e){console.error("Failed to delete evaluation:",e),alert("Failed to delete evaluation")}},ex=[...eu.vars.map((e,t)=>({value:"Variable ".concat(t+1),label:"Var ".concat(t+1,": ").concat(eu.vars[t].length>100?eu.vars[t].slice(0,97)+"...":eu.vars[t]),group:"Variables"})),...eu.prompts.map((e,t)=>({value:"Prompt ".concat(t+1),label:"Prompt ".concat(t+1,": ").concat(eu.prompts[t].display.length>100?eu.prompts[t].display.slice(0,97)+"...":eu.prompts[t].display),group:"Prompts"}))];l.useEffect(()=>{J(ex.map(e=>e.value))},[eu]);let[em,ej]=l.useState(null);return(0,n.jsxs)("div",{style:{marginLeft:"1rem",marginRight:"1rem"},children:[(0,n.jsx)(p.Z,{mb:2,sx:{display:"flex",alignItems:"center"},children:(0,n.jsxs)(f.Z,{variant:"h5",sx:{flexGrow:1},children:[(0,n.jsx)("span",{className:"description",onClick:ep,children:(null==O?void 0:O.description)||U})," ",(null==O?void 0:O.description)&&(0,n.jsx)("span",{className:"description-filepath",children:U})]})}),(0,n.jsx)(p.Z,{py:"md",children:(0,n.jsxs)(e_,{direction:"row",spacing:4,alignItems:"center",children:[(0,n.jsx)(p.Z,{children:t&&t.length>0&&(0,n.jsx)(g.Z,{sx:{m:1,minWidth:200},size:"small",children:(0,n.jsx)(u.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)(P.Z,{...e,label:"Eval run",variant:"outlined"}),defaultValue:t.find(e=>e.id===r)||t[0],onChange:(e,t)=>{t&&t.id&&s(t.id)},disableClearable:!0})})}),(0,n.jsx)(p.Z,{children:(0,n.jsxs)(g.Z,{sx:{m:1,minWidth:200,maxWidth:350},size:"small",children:[(0,n.jsx)(v.Z,{id:"visible-columns-label",children:"Columns"}),(0,n.jsx)(S.Z,{labelId:"visible-columns-label",id:"visible-columns",multiple:!0,value:B,onChange:e=>{let{target:{value:t}}=e;J("string"==typeof t?t.split(","):t);let s=[...eu.vars.map((e,t)=>"Variable ".concat(t+1)),...eu.prompts.map((e,t)=>"Prompt ".concat(t+1))],n={};s.forEach(e=>{n[e]=("string"==typeof t?t.split(","):t).includes(e)}),z(n)},input:(0,n.jsx)(w.Z,{label:"Visible columns"}),renderValue:e=>e.join(", "),children:ex.map(e=>(0,n.jsxs)(C.Z,{dense:!0,value:e.value,children:[(0,n.jsx)(x.Z,{checked:B.indexOf(e.value)>-1}),(0,n.jsx)(y.Z,{primary:e.label})]},e.value))})]})}),(0,n.jsx)(p.Z,{children:(0,n.jsxs)(g.Z,{sx:{minWidth:180},size:"small",children:[(0,n.jsx)(v.Z,{id:"failure-filter-mode-label",children:"Display"}),(0,n.jsxs)(S.Z,{labelId:"filter-mode-label",id:"filter-mode",value:$,onChange:e=>{let t=e.target.value;K(t);let s={};eu.prompts.forEach((e,n)=>{s["Prompt ".concat(n+1)]="failures"===t}),q(s)},label:"Filter",children:[(0,n.jsx)(C.Z,{value:"all",children:"Show all results"}),(0,n.jsx)(C.Z,{value:"failures",children:"Show failures only"}),(0,n.jsx)(C.Z,{value:"different",children:"Show different only"})]})]})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(P.Z,{sx:{minWidth:180},size:"small",label:"Search",placeholder:"Text or regex",value:H,onChange:e=>{G(e.target.value)}})}),(0,n.jsx)(p.Z,{flexGrow:1}),(0,n.jsx)(p.Z,{display:"flex",justifyContent:"flex-end",children:(0,n.jsxs)(e_,{direction:"row",spacing:2,children:[(0,n.jsx)(h.Z,{color:"primary",onClick:e=>{ej(e.currentTarget)},startIcon:(0,n.jsx)(d.Z,{}),children:"Eval actions"}),O&&(0,n.jsxs)(Z.Z,{id:"eval-actions-menu",anchorEl:em,keepMounted:!0,open:!!em,onClose:()=>{ej(null)},children:[(0,n.jsx)(E.Z,{title:"View the configuration that defines this eval",placement:"left",children:(0,n.jsxs)(C.Z,{onClick:()=>eo(!0),children:[(0,n.jsx)(b.Z,{children:(0,n.jsx)(I.Z,{fontSize:"small"})}),"View YAML"]})}),(0,n.jsx)(E.Z,{title:"Edit this eval in the web UI",placement:"left",children:(0,n.jsxs)(C.Z,{onClick:()=>{A(O),c.push("/setup/")},children:[(0,n.jsx)(b.Z,{children:(0,n.jsx)(j.Z,{fontSize:"small"})}),"Edit Eval"]})}),(0,n.jsx)(W,{}),(null==O?void 0:O.sharing)&&(0,n.jsx)(E.Z,{title:"Generate a unique URL that others can access",placement:"left",children:(0,n.jsxs)(C.Z,{onClick:ei,disabled:el,children:[(0,n.jsx)(b.Z,{children:el?(0,n.jsx)(i.Z,{size:16}):(0,n.jsx)(N.Z,{fontSize:"small"})}),"Share"]})}),(0,n.jsx)(E.Z,{title:"Delete this eval",placement:"left",children:(0,n.jsxs)(C.Z,{onClick:eh,children:[(0,n.jsx)(b.Z,{children:(0,n.jsx)(m.Z,{fontSize:"small"})}),"Delete"]})})]}),(0,n.jsx)(E.Z,{title:"Edit table view settings",placement:"left",children:(0,n.jsx)(h.Z,{color:"primary",onClick:()=>ed(!0),startIcon:(0,n.jsx)(k.Z,{}),children:"Table Settings"})})]})})]})}),(0,n.jsx)(Q,{columnVisibility:V}),(0,n.jsx)(eE,{maxTextLength:L,columnVisibility:V,wordBreak:M,showStats:D,filterMode:$,failureFilter:Y,searchText:X,onFailureFilterToggle:(e,t)=>{q(s=>({...s,[e]:t}))}}),(0,n.jsx)(eO,{open:er,onClose:()=>eo(!1)}),(0,n.jsx)(eF,{open:ee,onClose:()=>et(!1),shareUrl:es}),(0,n.jsx)(eL,{open:ec,onClose:()=>ed(!1)})]})}var eV=s(279);async function ez(){let e=(0,c.createClientComponentClient)(),{data:{user:t}}=await e.auth.getUser();(0,a.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 eB(e){let t=(0,c.createClientComponentClient)(),{data:s,error:n}=await t.from("EvaluationResult").select("*").eq("id",e).single();return s}function eJ(e){var t;let{fetchId:s,preloadedData:c,recentEvals:d,defaultEvalId:u}=e,p=(0,o.useRouter)(),{table:h,setTable:x,setConfig:m,setEvalId:j}=_(),[g,f]=l.useState(!1),[v,y]=l.useState(!1),[b,Z]=l.useState(d||[]),C=async()=>{let e=await fetch("".concat(await (0,ew.b)(),"/api/results"),{cache:"no-store"}),t=await e.json();return Z(t.data),t.data},w=l.useCallback(async e=>{let t=await fetch("".concat(await (0,ew.b)(),"/api/results/").concat(e),{cache:"no-store"}),s=await t.json();x(s.data.results.table),m(s.data.config),j(e)},[x,m,j]),S=async e=>{eV.Ox?(f(!1),p.push("/eval/remote:".concat(encodeURIComponent(e)))):p.push("/eval/?evalId=".concat(encodeURIComponent(e)))},[k,N]=l.useState(u||(null===(t=b[0])||void 0===t?void 0:t.id)),R=(0,o.useSearchParams)(),P=R?R.get("evalId"):null;return(l.useEffect(()=>{if(P){let e=async()=>{await w(P),f(!0),N(P),C()};e()}else if(c){var e;x(null===(e=c.data.results)||void 0===e?void 0:e.table),m(c.data.config),f(!0)}else if(s){let e=async()=>{var e;let t="".concat(eU,"/api/eval/").concat(s);console.log("Fetching eval from remote server",t);let n=await fetch(t);if(!n.ok){y(!0);return}let l=await n.json();x(null===(e=l.data.results)||void 0===e?void 0:e.table),m(l.data.config),f(!0)};e()}else if(eV.T8)(0,ew.b)().then(e=>{let t=(0,r.io)(e);return t.on("init",e=>{console.log("Initialized socket connection",e),f(!0),x(null==e?void 0:e.results.table),m(null==e?void 0:e.config),C().then(e=>{var t,s;N(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),x(e.results.table),m(e.config),C().then(e=>{var t;let s=null===(t=e[0])||void 0===t?void 0:t.id;s&&(N(s),j(s))})}),()=>{t.disconnect()}});else if(eV.Ox)ez().then(e=>{Z(e.map(e=>({id:e.id,label:e.createdAt}))),e.length>0&&eB(e[0].id).then(t=>{(0,a.Z)(t,"Eval not found");let s=t.results,n=t.config;N(e[0].id),x(s.table),m(n),f(!0)})});else{let e=async()=>{let e=await C();if(!(e.length>0))return(0,n.jsx)("div",{className:"notice",children:"No evals yet. Share some evals to this server and they will appear here."});{let t=await (0,ew.b)(),s=e[0].id,n=await fetch("".concat(t,"/api/results/").concat(s)),l=await n.json();x(l.data.results.table),m(l.data.config),f(!0),N(s),j(s)}};e()}},[s,x,m,j,w,c,N,P]),v)?(0,n.jsx)("div",{className:"notice",children:"404 Eval not found"}):g&&h?(0,n.jsx)(eW,{defaultEvalId:k,recentEvals:b,onRecentEvalSelected:S}):(0,n.jsxs)("div",{className:"notice",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,{Ox:function(){return a},T8:function(){return l},eA:function(){return i}});var n=s(7580);let l=!n.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,a=!!n.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,i=""},1938:function(e,t,s){"use strict";s.d(t,{o:function(){return a}});var n=s(4660),l=s(4810);let a=(0,n.Ue)()((0,l.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},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}),setDefaultTest:t=>e({defaultTest:t}),setEvaluateOptions:t=>e({evaluateOptions: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:a}=t();return{env:a,description:e,providers:n,prompts:l,tests:s}}}),{name:"promptfoo",skipHydration:!0}))},8715:function(){},5038:function(){},2604:function(){},6911:function(){},5777:function(){}}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[670],{2810:function(e,t,s){"use strict";let n,l;async function a(){if(n||(l||(l=fetch("/api/config").then(e=>e.json()).then(e=>n=e.apiBaseUrl)),await l),void 0===n)throw Error("API base URL is undefined");return n}s.d(t,{b:function(){return a}})},9670:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eJ}});var n=s(7437),l=s(2265),a=s(2130),i=s(6882),r=s(3388),o=s(4033),c=s(3082),d=s(1116),u=s(8440),p=s(6507),h=s(5551),x=s(7760),m=s(6446),j=s(3391),g=s(4081),f=s(3226),v=s(819),y=s(8212),b=s(8864),Z=s(3375),C=s(9114),w=s(923),S=s(654),k=s(3295),N=s(2467),R=s(3457),P=s(1975),E=s(8276),I=s(9605),O=s(9190),F=s(2053),T=s(8339),L=s(2481),M=s(9394),D=s(6337),U=s(4660),A=s(4810);let _=(0,U.Ue)()((0,A.tJ)((e,t)=>({evalId:null,setEvalId:t=>e(()=>({evalId: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})),prettifyJson:!1,setPrettifyJson:t=>e(()=>({prettifyJson:t})),showPrompts:!1,setShowPrompts:t=>e(()=>({showPrompts:t}))}),{name:"ResultsViewStorage",storage:(0,A.FL)(()=>localStorage)}));var W=function(){let{table:e,config:t,evalId:s}=_(),[a,i]=l.useState(!1),r=(e,t)=>{let s=URL.createObjectURL(e),n=document.createElement("a");n.href=s,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)},o=()=>{i(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(C.Z,{onClick:()=>{i(!0)},children:[(0,n.jsx)(b.Z,{children:(0,n.jsx)(L.Z,{fontSize:"small"})}),(0,n.jsx)(y.Z,{children:"Download"})]}),(0,n.jsx)(M.Z,{onClose:o,open:a,children:(0,n.jsx)(D.Z,{children:(0,n.jsxs)(R.Z,{direction:"column",spacing:2,sx:{width:"100%"},children:[(0,n.jsx)(h.Z,{onClick:()=>{let e=T.default.dump(t),s=new Blob([e],{type:"text/yaml;charset=utf-8"});r(s,"promptfooconfig.yaml"),o()},startIcon:(0,n.jsx)(L.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download YAML Config"}),(0,n.jsx)(h.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"});r(t,"".concat(s,"-table.json")),o()},startIcon:(0,n.jsx)(L.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download Table JSON"}),(0,n.jsx)(h.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=e.body.map((t,s)=>({chosen:t.outputs.filter(e=>e.pass).map(e=>e.text),rejected:t.outputs.filter(e=>!e.pass).map(e=>e.text),vars:t.test.vars,providers:e.head.prompts.map(e=>e.provider),prompts:e.head.prompts.map(e=>e.display)})),n=new Blob([JSON.stringify(t,null,2)],{type:"application/json"});r(n,"".concat(s,"-dpo.json")),o()},startIcon:(0,n.jsx)(L.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download DPO JSON"})]})})})]})},z=s(6704),V=s(1797),B=s(1101),J=s(9872),H=s(2653),G=s(3533),X=s(4740);let Y=["#fd7f6f","#7eb0d5","#b2e061","#bd7ebe","#ffb55a","#ffee65","#beb9db","#fdcce5","#8bd3c7"];function q(e){let{table:t}=e,s=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!s.current)return;a.current&&a.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))),r=t.head.prompts.map((e,s)=>{let n=t.body.flatMap(e=>e.outputs[s].score),a=i.map(e=>n.filter(t=>t>=e&&t<e+l).length);return{label:"Prompt ".concat(s+1),data:a,backgroundColor:Y[s%Y.length]}});a.current=new z.kL(s.current,{type:"bar",data:{labels:i,datasets:r},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 $(e){let{table:t}=e,s=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!s.current)return;a.current&&a.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,a=l/n.length*100;return{label:"Prompt ".concat(s+1),data:[a],backgroundColor:Y[s%Y.length]}});a.current=new z.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 K(e){let{table:t}=e,s=(0,l.useRef)(null),a=(0,l.useRef)(null),[i,r]=(0,l.useState)(0),[o,c]=(0,l.useState)(1),[d,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(!s.current)return;a.current&&a.current.destroy();let e=t.body.flatMap(e=>e.outputs.map(e=>e.score)),n=Math.min(...e),l=Math.max(...e),r=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"}});a.current=new z.kL(s.current,{type:"scatter",data:{datasets:[{data:r,backgroundColor:r.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)(M.Z,{open:d,onClose:()=>u(!1),children:[(0,n.jsx)(V.Z,{children:"Compare prompt outputs"}),(0,n.jsxs)(D.Z,{children:[(0,n.jsx)(g.Z,{sx:{m:1,minWidth:120},children:(0,n.jsx)(S.Z,{value:i,onChange:e=>r(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,n.jsxs)(C.Z,{value:t,children:["Prompt ",t+1]},t))})}),(0,n.jsx)(g.Z,{sx:{m:1,minWidth:120},children:(0,n.jsx)(S.Z,{value:o,onChange:e=>c(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,n.jsxs)(C.Z,{value:t,children:["Prompt ",t+1]},t))})})]})]}),(0,n.jsx)("canvas",{ref:s,style:{maxHeight:"300px",cursor:"pointer"},onClick:()=>u(!0)})]})}function Q(e){let{columnVisibility:t}=e,s=(0,B.Z)();z.kL.defaults.color="dark"===s.palette.mode?"#aaa":"#666";let[a,i]=(0,l.useState)(!0),{table:r}=_();if(!r||!a||r.head.prompts.length<2)return null;let o=r.body.flatMap(e=>e.outputs.map(e=>e.score));return 1===new Set(o).size?null:(0,n.jsx)(X.SV,{fallback:null,children:(0,n.jsxs)(J.Z,{style:{position:"relative",padding:s.spacing(3)},children:[(0,n.jsx)(H.Z,{style:{position:"absolute",right:0,top:0},onClick:()=>i(!1),children:(0,n.jsx)(G.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)($,{table:r})}),(0,n.jsx)("div",{style:{width:"33%"},children:(0,n.jsx)(q,{table:r})}),(0,n.jsx)("div",{style:{width:"33%"},children:(0,n.jsx)(K,{table:r})})]})]})})}z.kL.register(z.vn,z.ST,z.ho,z.uw,z.f$,z.ZL,z.jn,z.od,z.u,z.wL);var ee=s(9116);s(5777);var et=s(3425),es=s(7660),en=s(3216),el=s(182),ea=s(5391),ei=s(1396),er=s.n(ei);s(8715);var eo=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},ec=s(2834),ed=s(5446),eu=s(9329),ep=s(4719),eh=s(3701),ex=s(9279),em=s(666),ej=s(5795),eg=s(6988),ef=s(4147);function ev(e){let{gradingResults:t}=e;return t?(0,n.jsxs)(p.Z,{mt:2,children:[(0,n.jsx)(f.Z,{variant:"subtitle1",children:"Assertions"}),(0,n.jsx)(ej.Z,{children:(0,n.jsxs)(eh.Z,{children:[(0,n.jsx)(eg.Z,{children:(0,n.jsxs)(ef.Z,{children:[(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Pass"}),(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Score"}),(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Type"}),(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Value"}),(0,n.jsx)(em.Z,{style:{fontWeight:"bold"},children:"Reason"})]})}),(0,n.jsx)(ex.Z,{children:t.map((e,t)=>{var s,l;return(0,n.jsxs)(ef.Z,{children:[(0,n.jsx)(em.Z,{children:e.pass?"✅":"❌"}),(0,n.jsx)(em.Z,{children:e.score.toFixed(2)}),(0,n.jsx)(em.Z,{children:(null===(s=e.assertion)||void 0===s?void 0:s.type)||""}),(0,n.jsx)(em.Z,{style:{whiteSpace:"pre-wrap"},children:(null===(l=e.assertion)||void 0===l?void 0:l.value)?String(e.assertion.value):"-"}),(0,n.jsx)(em.Z,{style:{whiteSpace:"pre-wrap"},children:e.reason})]},t)})})]})})]}):null}function ey(e){let{open:t,onClose:s,prompt:a,provider:i,output:r,gradingResults:o}=e,[c,d]=(0,l.useState)(!1);(0,l.useEffect)(()=>{d(!1)},[a]);let u=async e=>{await navigator.clipboard.writeText(e),d(!0)};return(0,n.jsxs)(M.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"lg",children:[(0,n.jsxs)(V.Z,{children:["Details",i&&": ".concat(i)]}),(0,n.jsxs)(D.Z,{children:[(0,n.jsxs)(p.Z,{mb:2,children:[(0,n.jsx)(f.Z,{variant:"subtitle1",style:{marginBottom:"1rem"},children:"Prompt"}),(0,n.jsx)(ed.u,{readOnly:!0,value:a,style:{width:"100%",padding:"0.75rem"},maxRows:20}),(0,n.jsx)(H.Z,{onClick:()=>u(a),style:{position:"absolute",right:"10px",top:"10px"},children:c?(0,n.jsx)(ep.Z,{}):(0,n.jsx)(eu.Z,{})})]}),r&&(0,n.jsxs)(p.Z,{my:2,children:[(0,n.jsx)(f.Z,{variant:"subtitle1",style:{marginBottom:"1rem",marginTop:"1rem"},children:"Output"}),(0,n.jsx)(ed.u,{readOnly:!0,maxRows:20,value:r,style:{width:"100%",padding:"0.75rem"}})]}),(0,n.jsx)(ev,{gradingResults:o})]}),(0,n.jsx)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:s,children:"Close"})})]})}var eb=s(9396),eZ=s(4173),eC=function(){let e=(0,B.Z)(),[t,s]=l.useState(!1),a=()=>{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)(eb.Z,{}),onClick:()=>{s(!0)},children:"Generate test cases"})}),(0,n.jsxs)(M.Z,{open:t,onClose:a,children:[(0,n.jsx)(V.Z,{children:"Run on Command Line"}),(0,n.jsx)(D.Z,{children:(0,n.jsxs)(eZ.Z,{children:[(0,n.jsx)("p",{children:"This feature is in beta. UI coming soon."}),(0,n.jsxs)("p",{children:["Run"," ",(0,n.jsx)(p.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)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:a,color:"primary",children:"Close"})})]})]})},ew=s(2810);function eS(e){return null===e||0===e||1===e?"":"(".concat(e.toFixed(2),")")}function ek(e){return"string"==typeof e||"number"==typeof e?e.toString().length:Array.isArray(e)?e.reduce((e,t)=>e+ek(t),0):l.isValidElement(e)&&e.props.children?l.Children.toArray(e.props.children).reduce((e,t)=>e+ek(t),0):0}function eN(e){let t,{text:s,maxLength:a}=e,[i,r]=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,a-t)}if(Array.isArray(e)){let s=[],n=t;for(let t of e){let e=ek(t);if(n+e>a){s.push(o(t,n));break}s.push(t),n+=e}return s}if(l.isValidElement(e)&&e.props.children){let s=ek(e.props.children);if(s>a-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=ek(t)>a;return(0,n.jsxs)("div",{style:{cursor:d?"pointer":"normal"},onClick:()=>{r(!i)},children:[c,i&&ek(t)>a&&(0,n.jsx)("span",{children:"..."})]})}function eR(e){var t,s,a,i,r,o;let c,d,u,p,h,{output:x,maxTextLength:m,rowIndex:j,promptIndex:g,onRating:f,firstOutput:v,filterMode:y,searchText:b,showStats:Z}=e,{renderMarkdown:C,prettifyJson:w,showPrompts:S}=_(),[k,N]=l.useState(!1),[R,P]=l.useState(!1),I=()=>P(!R),O="string"==typeof x.text?x.text:JSON.stringify(x.text),F=[];if(O.startsWith("[IMAGE]")){let e=O.slice(7).trim();c=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("img",{loading:"lazy",src:e,alt:x.prompt,onClick:I}),R&&(0,n.jsx)("div",{className:"lightbox",onClick:I,children:(0,n.jsx)("img",{src:e,alt:x.prompt})})]})}else!x.pass&&O.includes("---")?O=(F=O.split("---")).slice(1).join("---"):F=[O];if("different"===y&&v){let e,t="string"==typeof v.text?v.text:JSON.stringify(v.text);t.includes("---")&&(t=t.split("---").slice(1).join("---"));try{JSON.parse(t),JSON.parse(O),e=(0,ee.CT)(t,O)}catch(s){e=t.includes(". ")&&O.includes(". ")?(0,ee.SY)(t,O):(0,ee.NV)(t,O)}c=(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)try{let e;let t=RegExp(b,"gi"),s=[];for(;null!==(e=t.exec(O));)s.push({start:e.index,end:t.lastIndex});c=(0,n.jsx)(n.Fragment,{children:s.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:O.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:O.substring(e.start,e.end)},"match-"+t),(0,n.jsx)("span",{children:O.substring(e.end,s[t+1]?s[t+1].start:O.length)},"text-after-"+t)]}))]}):(0,n.jsx)("span",{children:O},"no-match")})}catch(e){console.error("Invalid regular expression:",e.message)}else if(C)c=(0,n.jsx)(et.U,{children:O});else if(w)try{c=(0,n.jsx)("pre",{children:JSON.stringify(JSON.parse(O),null,2)})}catch(e){}let T=e=>{var t;f(j,g,e,void 0,null===(t=x.gradingResult)||void 0===t?void 0:t.comment)},L=()=>{var e;let t=prompt("Comment:",(null===(e=x.gradingResult)||void 0===e?void 0:e.comment)||"");null!=t&&f(j,g,void 0,void 0,t)};if(null===(t=x.tokenUsage)||void 0===t?void 0:t.completion){u=(0,n.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(x.latencyMs)," ms"]});let e=x.tokenUsage.completion/(x.latencyMs/1e3);p=(0,n.jsx)("span",{children:Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)})}x.cost&&(h=(0,n.jsxs)("span",{children:["$",x.cost.toPrecision(2)]})),(null===(s=x.tokenUsage)||void 0===s?void 0:s.cached)?d=(0,n.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(x.tokenUsage.cached)," ","(cached)"]}):(null===(a=x.tokenUsage)||void 0===a?void 0:a.total)&&(d=(0,n.jsx)("span",{children:Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(x.tokenUsage.total)}));let M=(null===(i=x.gradingResult)||void 0===i?void 0:i.comment)?(0,n.jsx)("div",{className:"comment",onClick:L,children:x.gradingResult.comment}):null,D=Z?(0,n.jsxs)("div",{className:"cell-detail",children:[d&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Tokens:"})," ",d]}),u&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Latency:"})," ",u]}),p&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Tokens/Sec:"})," ",p]}),h&&(0,n.jsxs)("div",{className:"stat-item",children:[(0,n.jsx)("strong",{children:"Cost:"})," ",h]})]}):null,U=(0,n.jsxs)("div",{className:"cell-actions",children:[x.prompt&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"action",onClick:()=>{N(!0)},children:(0,n.jsx)(E.Z,{title:"View ouput and test details",children:(0,n.jsx)("span",{children:"\uD83D\uDD0E"})})}),(0,n.jsx)(ey,{open:k,onClose:()=>{N(!1)},prompt:x.prompt,provider:x.provider,gradingResults:null===(r=x.gradingResult)||void 0===r?void 0:r.componentResults,output:O})]}),(0,n.jsx)("span",{className:"action",onClick:()=>T(!0),children:(0,n.jsx)(E.Z,{title:"Mark test passed (score 1.0)",children:(0,n.jsx)("span",{children:"\uD83D\uDC4D"})})}),(0,n.jsx)("span",{className:"action",onClick:()=>T(!1),children:(0,n.jsx)(E.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(x.score));if(null!==e){let s=parseFloat(e);if(!isNaN(s)&&s>=0&&s<=1){var t;f(j,g,void 0,s,null===(t=x.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)(E.Z,{title:"Set test score",children:(0,n.jsx)("span",{children:"\uD83D\uDD22"})})}),(0,n.jsx)("span",{className:"action",onClick:L,children:(0,n.jsx)(E.Z,{title:"Edit comment",children:(0,n.jsx)("span",{children:"✏️"})})})]});return(0,n.jsxs)("div",{className:"cell",children:[x.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:eS(x.score)})]}),(0,n.jsx)(eo,{lookup:x.namedScores})]})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"status fail",children:[(0,n.jsxs)("div",{className:"pill",children:["FAIL",x.score>0?" ":"",(0,n.jsx)("span",{className:"score",children:eS(x.score)})]}),(0,n.jsx)(eo,{lookup:x.namedScores}),(0,n.jsx)("span",{className:"fail-reason",children:null===(o=F[0])||void 0===o?void 0:o.trim().split("\n").map((e,t)=>(0,n.jsxs)(l.Fragment,{children:[e,(0,n.jsx)("br",{})]},t))})]})}),S&&v.prompt&&(0,n.jsxs)("div",{className:"prompt",children:[(0,n.jsx)("span",{className:"pill",children:"Prompt"}),x.prompt]}),(0,n.jsx)(eN,{text:c||O,maxLength:m}),M,D,U]})}function eP(e){let{text:t,maxLength:s,expandedText:a,resourceId:i,className:r}=e,[o,c]=l.useState(!1);return(0,n.jsxs)("div",{className:"".concat(r||""),children:[(0,n.jsx)(eN,{text:t,maxLength:s}),a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E.Z,{title:"View prompt",children:(0,n.jsx)("span",{className:"action",onClick:()=>{c(!0)},children:"\uD83D\uDD0E"})}),(0,n.jsx)(ey,{open:o,onClose:()=>{c(!1)},prompt:a}),i&&(0,n.jsx)(E.Z,{title:"View other evals and datasets for this prompt",children:(0,n.jsx)("span",{className:"action",children:(0,n.jsx)(er(),{href:"/prompts/?id=".concat(i),target:"_blank",children:(0,n.jsx)(ea.Z,{fontSize:"small"})})})})]})]})}function eE(e){let{maxTextLength:t,columnVisibility:s,wordBreak:i,filterMode:r,failureFilter:o,searchText:c,showStats:d,onFailureFilterToggle:u}=e,{evalId:m,table:j,setTable:g}=_();(0,a.Z)(j,"Table should be defined");let{head:v,body:y}=j,b=v.prompts.map((e,t)=>y.reduce((e,s)=>e+(s.outputs[t].pass?1:0),0)),Z=v.prompts.map((e,t)=>y.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)),w=v.prompts.map((e,t)=>y.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)),k=async(e,t,s,n,l)=>{let a=[...y],i={...a[e]},r=[...i.outputs],o=null!=s?s:r[t].pass,c=void 0===n?s?1:0:n||0;r[t].pass=o,r[t].score=c;let d={...r[t].gradingResult||{},pass:o,score:c,reason:"Manual result (overrides all other grading results)",comment:l,assertion:null};r[t].gradingResult=d,i.outputs=r,a[e]=i;let u={head:v,body:a};g(u);try{let e=await fetch("".concat(await (0,ew.b)(),"/api/eval/").concat(m),{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)}},N=b.reduce((e,t,s,n)=>t>n[e]?s:e,0),R=b[N],E=(0,es.Cl)(),I=[];v.vars.length>0&&I.push(E.group({id:"vars",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Variables"}),columns:v.vars.map((e,s)=>E.accessor(e=>e.vars[s],{id:"Variable ".concat(s+1),header:()=>(0,n.jsx)(eP,{text:e,maxLength:t,className:"font-bold"}),cell:e=>(0,n.jsx)(eN,{text:e.getValue(),maxLength:t}),size:50}))})),I.push(E.group({id:"prompts",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Outputs"}),columns:v.prompts.map((e,s)=>E.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,a,i,c,p,h,m,j;let g=b[s]&&y.length?(b[s]/y.length*100).toFixed(2):"0.00",f=b[s]===R&&0!==R,C="Prompt ".concat(s+1),S=o[C]||!1,k=d?(0,n.jsxs)("div",{className:"prompt-detail",children:[Z[s]?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Asserts:"})," ",w[s],"/",Z[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/y.length)," ","ms"]}):null,(null===(i=e.metrics)||void 0===i?void 0:null===(a=i.tokenUsage)||void 0===a?void 0:a.total)?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Avg Tokens:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.tokenUsage.total/y.length)]}):null,(null===(c=e.metrics)||void 0===c?void 0:c.totalLatencyMs)&&(null===(h=e.metrics)||void 0===h?void 0:null===(p=h.tokenUsage)||void 0===p?void 0:p.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===(m=e.metrics)||void 0===m?void 0:m.cost)?(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Cost:"})," $",e.metrics.cost.toPrecision(2)]}):null]}):null,N=v.prompts.every(e=>e.provider===v.prompts[0].provider),P=e.provider?e.provider.split(":"):[],E=P.length>1?(0,n.jsxs)(n.Fragment,{children:[P[0],":",(0,n.jsx)("strong",{children:P.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:E}):null,(0,n.jsx)("div",{className:"summary",children:(0,n.jsxs)("div",{className:"highlight ".concat(f?"success":""),children:[(0,n.jsxs)("strong",{children:[g,"% passing"]})," (",b[s],"/",y.length," cases)"]})}),(null===(j=e.metrics)||void 0===j?void 0:j.namedScores)&&Object.keys(e.metrics.namedScores).length>0?(0,n.jsx)(eo,{lookup:e.metrics.namedScores}):null]}),(0,n.jsx)(eP,{className:"prompt-container",text:e.display,expandedText:e.raw,maxLength:t,resourceId:e.id}),k,"failures"===r&&(0,n.jsx)(el.Z,{sx:{"& .MuiFormControlLabel-label":{fontSize:"0.75rem"}},control:(0,n.jsx)(x.Z,{checked:S,onChange:e=>u(C,e.target.checked)}),label:"Show failures"})]})},cell:e=>(0,n.jsx)(eR,{output:e.getValue(),maxTextLength:t,rowIndex:e.row.index,promptIndex:s,onRating:k,firstOutput:T[e.row.index].outputs[0],filterMode:r,searchText:c,showStats:d})}))}));let O=y.some(e=>e.description);O&&I.splice(0,0,{accessorFn:e=>e.description||"",id:"description",header:()=>(0,n.jsx)("span",{className:"font-bold",children:"Description"}),cell:e=>(0,n.jsx)(eN,{text:String(e.getValue()),maxLength:t}),size:50});let F=Object.keys(s).length>0,T=l.useMemo(()=>{try{let e=RegExp(c,"i");return y.filter(t=>{let n="failures"===r?t.outputs.some((e,t)=>{let n="Prompt ".concat(t+1);return o[n]&&!e.pass&&(!F||s[n])}):"different"!==r||!t.outputs.every(e=>e.text===t.outputs[0].text),l=!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 n&&l})}catch(e){return console.error("Invalid regular expression:",e.message),y}},[y,o,r,c,s,F]),[L,M]=l.useState({pageIndex:0,pageSize:50}),D=(0,en.b7)({data:T,columns:I,columnResizeMode:"onChange",getCoreRowModel:(0,es.sC)(),getPaginationRowModel:(0,es.G_)(),state:{columnVisibility:s,pagination:L}});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:D.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,en.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:D.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,a=!l&&!s;return a&&(s=!0),(0,n.jsx)("td",{style:{width:e.column.getSize()},className:"".concat(l?"variable":""," ").concat(0!==t||l?"":"first-prompt-row"," ").concat(a?"first-prompt-col":""),children:(0,en.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]}),D.getPageCount()>1&&(0,n.jsxs)(p.Z,{className:"pagination",sx:{display:"flex",alignItems:"center",gap:2},children:[(0,n.jsx)(h.Z,{onClick:()=>M(e=>({...e,pageIndex:Math.max(e.pageIndex-1,0)})),disabled:0===D.getState().pagination.pageIndex,variant:"contained",children:"Previous"}),(0,n.jsxs)(f.Z,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:["Page",(0,n.jsx)(P.Z,{size:"small",type:"number",value:D.getState().pagination.pageIndex+1,onChange:e=>{let t=e.target.value?Number(e.target.value)-1:0;M(e=>({...e,pageIndex:Math.min(Math.max(t,0),D.getPageCount()-1)}))},InputProps:{style:{width:"60px",textAlign:"center"}},variant:"outlined"}),(0,n.jsxs)("span",{children:["of ",D.getPageCount()]})]}),(0,n.jsx)(h.Z,{onClick:()=>M(e=>({...e,pageIndex:Math.min(e.pageIndex+1,D.getPageCount()-1)})),disabled:D.getState().pagination.pageIndex+1>=D.getPageCount(),variant:"contained",children:"Next"}),(0,n.jsxs)(f.Z,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsxs)(S.Z,{value:L.pageSize,onChange:e=>M({pageIndex:0,pageSize:Number(e.target.value)}),displayEmpty:!0,inputProps:{"aria-label":"Results per page"},size:"small",sx:{m:1,minWidth:80},children:[(0,n.jsx)(C.Z,{value:10,children:"10"}),(0,n.jsx)(C.Z,{value:50,children:"50"}),(0,n.jsx)(C.Z,{value:100,children:"100"}),(0,n.jsx)(C.Z,{value:500,children:"500"}),(0,n.jsx)(C.Z,{value:1e3,children:"1000"})]}),(0,n.jsx)("span",{children:"results per page"})]})]}),(0,n.jsx)(eC,{})]})}s(2604);var eI=s(7175);function eO(e){let{open:t,onClose:a}=e,{config:i}=_(),r=l.useRef(null),[o,c]=l.useState(!1),[d,u]=l.useState("");l.useEffect(()=>{t&&(async()=>{let{default:e}=await Promise.resolve().then(s.bind(s,8339));u(e.dump(i))})()},[t,i]);let x=()=>{c(!1),a()};return(0,n.jsxs)(M.Z,{open:t,onClose:x,"aria-labelledby":"config-dialog-title",maxWidth:"md",fullWidth:!0,children:[(0,n.jsx)(V.Z,{id:"config-dialog-title",children:(0,n.jsxs)(p.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,n.jsx)(f.Z,{variant:"h6",style:{flexGrow:1},children:"Config"}),(0,n.jsxs)(p.Z,{children:[(0,n.jsx)(E.Z,{title:"Copy to clipboard",children:(0,n.jsx)(H.Z,{onClick:()=>{r.current&&(r.current.select(),document.execCommand("copy"),c(!0))},children:o?(0,n.jsx)(ep.Z,{}):(0,n.jsx)(eI.Z,{})})}),(0,n.jsx)(E.Z,{title:"Download .yaml",children:(0,n.jsx)(H.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)(L.Z,{})})})]})]})}),(0,n.jsx)(D.Z,{children:(0,n.jsx)(f.Z,{variant:"body1",component:"div",children:(0,n.jsx)("textarea",{ref:r,readOnly:!0,value:d,style:{width:"100%",minHeight:"400px",fontFamily:"monospace",border:"1px solid #ccc"}})})}),(0,n.jsx)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:x,color:"primary",children:"Close"})})]})}var eF=e=>{let{open:t,onClose:s,shareUrl:a}=e,i=(0,l.useRef)(null),[r,o]=(0,l.useState)(!1),c=()=>{s(),o(!1)};return(0,n.jsxs)(M.Z,{open:t,onClose:c,PaperProps:{style:{minWidth:"min(660px, 100%)"}},children:[(0,n.jsx)(V.Z,{children:"Your eval is ready to share"}),(0,n.jsxs)(D.Z,{children:[(0,n.jsx)(P.Z,{inputRef:i,value:a,fullWidth:!0,InputProps:{readOnly:!0,endAdornment:(0,n.jsx)(H.Z,{onClick:()=>{i.current&&(i.current.select(),document.execCommand("copy"),o(!0))},children:r?(0,n.jsx)(ep.Z,{}):(0,n.jsx)(eI.Z,{})})}}),(0,n.jsx)(eZ.Z,{sx:{fontSize:"0.75rem"},children:"Shared URLs are deleted after 2 weeks."})]}),(0,n.jsx)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:c,color:"primary",children:"Close"})})]})},eT=s(33),eL=e=>{let{open:t,onClose:s}=e,{maxTextLength:l,setMaxTextLength:a,wordBreak:i,setWordBreak:r,showInferenceDetails:o,setShowInferenceDetails:c,renderMarkdown:d,setRenderMarkdown:u,prettifyJson:m,setPrettifyJson:j,showPrompts:g,setShowPrompts:v}=_();return(0,n.jsxs)(M.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"sm",children:[(0,n.jsx)(V.Z,{children:"Table View Settings"}),(0,n.jsxs)(D.Z,{children:[(0,n.jsx)(p.Z,{children:(0,n.jsx)(E.Z,{title:"Forcing line breaks makes it easier to adjust column widths to your liking",children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:"break-all"===i,onChange:e=>r(e.target.checked?"break-all":"break-word")}),label:"Force line breaks"})})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:d,onChange:e=>u(e.target.checked)}),label:"Render model outputs as Markdown"})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:m,onChange:e=>j(e.target.checked)}),label:"Prettify JSON outputs"})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(E.Z,{title:"Show the final prompt that produced the output in each cell.",children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:g,onChange:e=>v(e.target.checked)}),label:"Show full prompt in output cell"})})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(E.Z,{title:"Show detailed inference statistics such as latency, tokens used, cost, etc.",children:(0,n.jsx)(el.Z,{control:(0,n.jsx)(x.Z,{checked:o,onChange:e=>c(e.target.checked)}),label:"Show inference details"})})}),(0,n.jsxs)(p.Z,{maxWidth:"sm",children:[(0,n.jsxs)(f.Z,{mt:2,children:["Max text length: ",l]}),(0,n.jsx)(eT.ZP,{min:25,max:1e3,value:l,onChange:(e,t)=>a(t)})]})]}),(0,n.jsx)(ec.Z,{children:(0,n.jsx)(h.Z,{onClick:s,children:"Close"})})]})},eM=s(1938),eD=s(7580);let eU=eD.env.NEXT_PUBLIC_PROMPTFOO_REMOTE_API_BASE_URL||eD.env.NEXT_PUBLIC_PROMPTFOO_BASE_URL||eD.env.PROMPTFOO_REMOTE_API_BASE_URL||"https://api.promptfoo.dev",eA=eD.env.NEXT_PUBLIC_PROMPTFOO_BASE_URL||eD.env.PROMPTFOO_REMOTE_APP_BASE_URL||"https://app.promptfoo.dev";s(6911);let e_=(0,O.Z)(R.Z)(e=>{let{theme:t}=e;return{maxWidth:"100%",flexWrap:"wrap",[t.breakpoints.down("sm")]:{flexDirection:"column"}}});function eW(e){let{recentEvals:t,onRecentEvalSelected:s,defaultEvalId:r}=e,c=(0,o.useRouter)(),{table:R,config:O,setConfig:T,maxTextLength:L,wordBreak:M,showInferenceDetails:D,evalId:U}=_(),{setStateFromConfig:A}=(0,eM.o)(),[z,V]=l.useState({}),[B,J]=l.useState([]),[H,G]=l.useState(""),[X]=(0,F.Nr)(H,1e3),[Y,q]=l.useState({}),[$,K]=l.useState("all"),[ee,et]=l.useState(!1),[es,en]=l.useState(""),[el,ea]=l.useState(!1),ei=async()=>{ea(!0);try{let e=await fetch("".concat(eU,"/api/eval"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:{version:2,createdAt:new Date().toISOString(),results:{table:R},config:O}})}),{id:t}=await e.json(),s="".concat(eA,"/eval/").concat(t);en(s),et(!0)}catch(e){alert("Sorry, something went wrong.")}finally{ea(!1)}},[er,eo]=l.useState(!1),[ec,ed]=l.useState(!1);(0,a.Z)(R,"Table data must be loaded before rendering ResultsView");let{head:eu}=R,ep=async()=>{(0,a.Z)(O,"Config must be loaded before clicking its description");let e=window.prompt("Enter new description:",O.description);if(null!==e&&e!==O.description){let t={...O,description:e};try{let e=await fetch("".concat(await (0,ew.b)(),"/api/eval/").concat(U),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:t})});if(!e.ok)throw Error("Network response was not ok");T(t)}catch(e){console.error("Failed to update table:",e)}}},eh=async()=>{if(window.confirm("Are you sure you want to delete this evaluation?"))try{let e=await fetch("".concat(await (0,ew.b)(),"/api/eval/").concat(U),{method:"DELETE"});if(!e.ok)throw Error("Network response was not ok");c.push("/")}catch(e){console.error("Failed to delete evaluation:",e),alert("Failed to delete evaluation")}},ex=[...eu.vars.map((e,t)=>({value:"Variable ".concat(t+1),label:"Var ".concat(t+1,": ").concat(eu.vars[t].length>100?eu.vars[t].slice(0,97)+"...":eu.vars[t]),group:"Variables"})),...eu.prompts.map((e,t)=>({value:"Prompt ".concat(t+1),label:"Prompt ".concat(t+1,": ").concat(eu.prompts[t].display.length>100?eu.prompts[t].display.slice(0,97)+"...":eu.prompts[t].display),group:"Prompts"}))];l.useEffect(()=>{J(ex.map(e=>e.value))},[eu]);let[em,ej]=l.useState(null);return(0,n.jsxs)("div",{style:{marginLeft:"1rem",marginRight:"1rem"},children:[(0,n.jsx)(p.Z,{mb:2,sx:{display:"flex",alignItems:"center"},children:(0,n.jsxs)(f.Z,{variant:"h5",sx:{flexGrow:1},children:[(0,n.jsx)("span",{className:"description",onClick:ep,children:(null==O?void 0:O.description)||U})," ",(null==O?void 0:O.description)&&(0,n.jsx)("span",{className:"description-filepath",children:U})]})}),(0,n.jsx)(p.Z,{py:"md",children:(0,n.jsxs)(e_,{direction:"row",spacing:4,alignItems:"center",children:[(0,n.jsx)(p.Z,{children:t&&t.length>0&&(0,n.jsx)(g.Z,{sx:{m:1,minWidth:200},size:"small",children:(0,n.jsx)(u.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)(P.Z,{...e,label:"Eval run",variant:"outlined"}),defaultValue:t.find(e=>e.id===r)||t[0],onChange:(e,t)=>{t&&t.id&&s(t.id)},disableClearable:!0})})}),(0,n.jsx)(p.Z,{children:(0,n.jsxs)(g.Z,{sx:{m:1,minWidth:200,maxWidth:350},size:"small",children:[(0,n.jsx)(v.Z,{id:"visible-columns-label",children:"Columns"}),(0,n.jsx)(S.Z,{labelId:"visible-columns-label",id:"visible-columns",multiple:!0,value:B,onChange:e=>{let{target:{value:t}}=e;J("string"==typeof t?t.split(","):t);let s=[...eu.vars.map((e,t)=>"Variable ".concat(t+1)),...eu.prompts.map((e,t)=>"Prompt ".concat(t+1))],n={};s.forEach(e=>{n[e]=("string"==typeof t?t.split(","):t).includes(e)}),V(n)},input:(0,n.jsx)(w.Z,{label:"Visible columns"}),renderValue:e=>e.join(", "),children:ex.map(e=>(0,n.jsxs)(C.Z,{dense:!0,value:e.value,children:[(0,n.jsx)(x.Z,{checked:B.indexOf(e.value)>-1}),(0,n.jsx)(y.Z,{primary:e.label})]},e.value))})]})}),(0,n.jsx)(p.Z,{children:(0,n.jsxs)(g.Z,{sx:{minWidth:180},size:"small",children:[(0,n.jsx)(v.Z,{id:"failure-filter-mode-label",children:"Display"}),(0,n.jsxs)(S.Z,{labelId:"filter-mode-label",id:"filter-mode",value:$,onChange:e=>{let t=e.target.value;K(t);let s={};eu.prompts.forEach((e,n)=>{s["Prompt ".concat(n+1)]="failures"===t}),q(s)},label:"Filter",children:[(0,n.jsx)(C.Z,{value:"all",children:"Show all results"}),(0,n.jsx)(C.Z,{value:"failures",children:"Show failures only"}),(0,n.jsx)(C.Z,{value:"different",children:"Show different only"})]})]})}),(0,n.jsx)(p.Z,{children:(0,n.jsx)(P.Z,{sx:{minWidth:180},size:"small",label:"Search",placeholder:"Text or regex",value:H,onChange:e=>{G(e.target.value)}})}),(0,n.jsx)(p.Z,{flexGrow:1}),(0,n.jsx)(p.Z,{display:"flex",justifyContent:"flex-end",children:(0,n.jsxs)(e_,{direction:"row",spacing:2,children:[(0,n.jsx)(h.Z,{color:"primary",onClick:e=>{ej(e.currentTarget)},startIcon:(0,n.jsx)(d.Z,{}),children:"Eval actions"}),O&&(0,n.jsxs)(Z.Z,{id:"eval-actions-menu",anchorEl:em,keepMounted:!0,open:!!em,onClose:()=>{ej(null)},children:[(0,n.jsx)(E.Z,{title:"View the configuration that defines this eval",placement:"left",children:(0,n.jsxs)(C.Z,{onClick:()=>eo(!0),children:[(0,n.jsx)(b.Z,{children:(0,n.jsx)(I.Z,{fontSize:"small"})}),"View YAML"]})}),(0,n.jsx)(E.Z,{title:"Edit this eval in the web UI",placement:"left",children:(0,n.jsxs)(C.Z,{onClick:()=>{A(O),c.push("/setup/")},children:[(0,n.jsx)(b.Z,{children:(0,n.jsx)(j.Z,{fontSize:"small"})}),"Edit Eval"]})}),(0,n.jsx)(W,{}),(null==O?void 0:O.sharing)&&(0,n.jsx)(E.Z,{title:"Generate a unique URL that others can access",placement:"left",children:(0,n.jsxs)(C.Z,{onClick:ei,disabled:el,children:[(0,n.jsx)(b.Z,{children:el?(0,n.jsx)(i.Z,{size:16}):(0,n.jsx)(N.Z,{fontSize:"small"})}),"Share"]})}),(0,n.jsx)(E.Z,{title:"Delete this eval",placement:"left",children:(0,n.jsxs)(C.Z,{onClick:eh,children:[(0,n.jsx)(b.Z,{children:(0,n.jsx)(m.Z,{fontSize:"small"})}),"Delete"]})})]}),(0,n.jsx)(E.Z,{title:"Edit table view settings",placement:"left",children:(0,n.jsx)(h.Z,{color:"primary",onClick:()=>ed(!0),startIcon:(0,n.jsx)(k.Z,{}),children:"Table Settings"})})]})})]})}),(0,n.jsx)(Q,{columnVisibility:z}),(0,n.jsx)(eE,{maxTextLength:L,columnVisibility:z,wordBreak:M,showStats:D,filterMode:$,failureFilter:Y,searchText:X,onFailureFilterToggle:(e,t)=>{q(s=>({...s,[e]:t}))}}),(0,n.jsx)(eO,{open:er,onClose:()=>eo(!1)}),(0,n.jsx)(eF,{open:ee,onClose:()=>et(!1),shareUrl:es}),(0,n.jsx)(eL,{open:ec,onClose:()=>ed(!1)})]})}var ez=s(279);async function eV(){let e=(0,c.createClientComponentClient)(),{data:{user:t}}=await e.auth.getUser();(0,a.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 eB(e){let t=(0,c.createClientComponentClient)(),{data:s,error:n}=await t.from("EvaluationResult").select("*").eq("id",e).single();return s}function eJ(e){var t;let{fetchId:s,preloadedData:c,recentEvals:d,defaultEvalId:u}=e,p=(0,o.useRouter)(),{table:h,setTable:x,setConfig:m,setEvalId:j}=_(),[g,f]=l.useState(!1),[v,y]=l.useState(!1),[b,Z]=l.useState(d||[]),C=async()=>{let e=await fetch("".concat(await (0,ew.b)(),"/api/results"),{cache:"no-store"}),t=await e.json();return Z(t.data),t.data},w=l.useCallback(async e=>{let t=await fetch("".concat(await (0,ew.b)(),"/api/results/").concat(e),{cache:"no-store"}),s=await t.json();x(s.data.results.table),m(s.data.config),j(e)},[x,m,j]),S=async e=>{ez.Ox?(f(!1),p.push("/eval/remote:".concat(encodeURIComponent(e)))):p.push("/eval/?evalId=".concat(encodeURIComponent(e)))},[k,N]=l.useState(u||(null===(t=b[0])||void 0===t?void 0:t.id)),R=(0,o.useSearchParams)(),P=R?R.get("evalId"):null;return(l.useEffect(()=>{if(P){let e=async()=>{await w(P),f(!0),N(P),C()};e()}else if(c){var e;x(null===(e=c.data.results)||void 0===e?void 0:e.table),m(c.data.config),f(!0)}else if(s){let e=async()=>{var e;let t="".concat(eU,"/api/eval/").concat(s);console.log("Fetching eval from remote server",t);let n=await fetch(t);if(!n.ok){y(!0);return}let l=await n.json();x(null===(e=l.data.results)||void 0===e?void 0:e.table),m(l.data.config),f(!0)};e()}else if(ez.T8)(0,ew.b)().then(e=>{let t=(0,r.io)(e);return t.on("init",e=>{console.log("Initialized socket connection",e),f(!0),x(null==e?void 0:e.results.table),m(null==e?void 0:e.config),C().then(e=>{var t,s;N(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),x(e.results.table),m(e.config),C().then(e=>{var t;let s=null===(t=e[0])||void 0===t?void 0:t.id;s&&(N(s),j(s))})}),()=>{t.disconnect()}});else if(ez.Ox)eV().then(e=>{Z(e.map(e=>({id:e.id,label:e.createdAt}))),e.length>0&&eB(e[0].id).then(t=>{(0,a.Z)(t,"Eval not found");let s=t.results,n=t.config;N(e[0].id),x(s.table),m(n),f(!0)})});else{let e=async()=>{let e=await C();if(!(e.length>0))return(0,n.jsx)("div",{className:"notice",children:"No evals yet. Share some evals to this server and they will appear here."});{let t=await (0,ew.b)(),s=e[0].id,n=await fetch("".concat(t,"/api/results/").concat(s)),l=await n.json();x(l.data.results.table),m(l.data.config),f(!0),N(s),j(s)}};e()}},[s,x,m,j,w,c,N,P]),v)?(0,n.jsx)("div",{className:"notice",children:"404 Eval not found"}):g&&h?(0,n.jsx)(eW,{defaultEvalId:k,recentEvals:b,onRecentEvalSelected:S}):(0,n.jsxs)("div",{className:"notice",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,{Ox:function(){return a},T8:function(){return l},eA:function(){return i}});var n=s(7580);let l=!n.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,a=!!n.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,i=""},1938:function(e,t,s){"use strict";s.d(t,{o:function(){return a}});var n=s(4660),l=s(4810);let a=(0,n.Ue)()((0,l.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},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}),setDefaultTest:t=>e({defaultTest:t}),setEvaluateOptions:t=>e({evaluateOptions: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:a}=t();return{env:a,description:e,providers:n,prompts:l,tests:s}}}),{name:"promptfoo",skipHydration:!0}))},8715:function(){},5038:function(){},2604:function(){},6911:function(){},5777:function(){}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{3515:function(e,t,n){Promise.resolve().then(n.bind(n,2378))},2378:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ed}});var a=n(7437),i=n(2265),r=n(5551),l=n(8938),s=n(3226),o=n(6507),c=n(3457),d=n(9394),p=n(2834),u=n(6337),h=n(4173),x=n(1797),m=n(4740),f=n(4033),g=n(6882),j=n(1938),v=n(279),Z=()=>{let e=(0,f.useRouter)(),{env:t,description:n,providers:l,prompts:s,testCases:o}=(0,j.o)(),[c,d]=(0,i.useState)(!1),[p,u]=(0,i.useState)(0),h=async()=>{d(!0);try{let a=await fetch("".concat(v.eA,"/api/eval/job/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t,description:n,providers:l,prompts:s,tests:o})});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));let i=await a.json(),r=setInterval(async()=>{let t=await fetch("".concat(v.eA,"/api/eval/job/").concat(i.id,"/"));if(!t.ok)throw clearInterval(r),Error("HTTP error! status: ".concat(t.status));let n=await t.json();if("complete"===n.status)clearInterval(r),d(!1),v.Ox?e.push("/eval/remote:".concat(encodeURIComponent(i.id))):e.push("/eval");else if("failed"===n.status)throw clearInterval(r),d(!1),Error("Job failed");else{let e=0===n.total?0:Math.round(n.progress/n.total*100);u(e)}},1e3)}catch(e){console.error(e),d(!1),alert("An error occurred: ".concat(e.message))}};return(0,a.jsx)(r.Z,{variant:"contained",color:"primary",onClick:h,disabled:c,children:c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{size:24,sx:{marginRight:2}}),p.toFixed(0),"% complete"]}):"Run Evaluation"})},b=n(2057),y=n(8768),_=n(5873),C=n(1975),k=n(3295),A=()=>{let{env:e,setEnv:t}=(0,j.o)(),[n,l]=(0,i.useState)(!1),[s,o]=(0,i.useState)(e),c=()=>{l(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{variant:"outlined",startIcon:(0,a.jsx)(k.Z,{}),onClick:()=>{l(!0)},children:"API keys"}),(0,a.jsxs)(d.Z,{open:n,onClose:c,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Provider settings"}),(0,a.jsxs)(u.Z,{children:[(0,a.jsxs)(b.Z,{defaultExpanded:!0,children:[(0,a.jsx)(_.Z,{children:"OpenAI"}),(0,a.jsxs)(y.Z,{children:[(0,a.jsx)(C.Z,{label:"OpenAI API key",fullWidth:!0,margin:"normal",value:s.OPENAI_API_KEY,onChange:e=>o({...s,OPENAI_API_KEY:e.target.value})}),(0,a.jsx)(C.Z,{label:"OpenAI API host",fullWidth:!0,margin:"normal",value:s.OPENAI_API_HOST,onChange:e=>o({...s,OPENAI_API_HOST:e.target.value})}),(0,a.jsx)(C.Z,{label:"OpenAI organization",fullWidth:!0,margin:"normal",value:s.OPENAI_ORGANIZATION,onChange:e=>o({...s,OPENAI_ORGANIZATION:e.target.value})})]})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Azure"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Azure API key",fullWidth:!0,margin:"normal",value:s.AZURE_OPENAI_API_KEY,onChange:e=>o({...s,AZURE_OPENAI_API_KEY:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Amazon Bedrock"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Bedrock Region",fullWidth:!0,margin:"normal",value:s.AWS_BEDROCK_REGION,onChange:e=>o({...s,AWS_BEDROCK_REGION:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Anthropic"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Anthropic API key",fullWidth:!0,margin:"normal",value:s.ANTHROPIC_API_KEY,onChange:e=>o({...s,ANTHROPIC_API_KEY:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Google Vertex AI"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex API Key",fullWidth:!0,margin:"normal",value:s.VERTEX_API_KEY,onChange:e=>o({...s,VERTEX_API_KEY:e.target.value})})}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex Project ID",fullWidth:!0,margin:"normal",value:s.VERTEX_PROJECT_ID,onChange:e=>o({...s,VERTEX_PROJECT_ID:e.target.value})})}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex Region",fullWidth:!0,margin:"normal",value:s.VERTEX_REGION,onChange:e=>o({...s,VERTEX_REGION:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Replicate"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Replicate API key",fullWidth:!0,margin:"normal",value:s.REPLICATE_API_KEY,onChange:e=>o({...s,REPLICATE_API_KEY:e.target.value})})})]})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:c,color:"primary",children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{t(s),c()},color:"primary",variant:"contained",children:"Save"})]})]})]})},E=n(2653),I=n(3701),P=n(9279),S=n(666),O=n(5795),T=n(4147),w=n(8276),R=n(3391),W=n(6446),N=n(1280),z=n(9329),V=e=>{let{open:t,prompt:n,index:l,onAdd:s,onCancel:o}=e,[c,h]=i.useState(n),m=i.useRef(null);i.useEffect(()=>{h(n)},[n]);let f=e=>{s(c),h(""),e?o():m.current&&m.current.focus()};return(0,a.jsxs)(d.Z,{open:t,onClose:o,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Edit Prompt ".concat(l+1)}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(C.Z,{value:c,onChange:e=>h(e.target.value),fullWidth:!0,margin:"normal",multiline:!0,placeholder:"The quick brown {{animal1}} jumps over the lazy {{animal2}}.",helperText:"Tip: use the {{varname}} syntax to add variables to your prompt.",inputRef:m})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:f.bind(null,!0),color:"primary",variant:"contained",disabled:!c.length,children:"Add"}),(0,a.jsx)(r.Z,{onClick:f.bind(null,!1),color:"primary",variant:"contained",disabled:!c.length,children:"Add Another"}),(0,a.jsx)(r.Z,{onClick:o,color:"secondary",children:"Cancel"})]})]})};n(2280);var F=()=>{let[e,t]=(0,i.useState)(!1),[n,l]=(0,i.useState)(null),{prompts:o,setPrompts:d}=(0,j.o)(),p=(0,i.useRef)(null);(0,i.useEffect)(()=>{null!==n&&n>0&&p.current&&p.current.focus()},[n]);let u=e=>{l(e),t(!0)},h=(e,t)=>{e.stopPropagation();let n=o[t];d([...o,n])},x=(e,t)=>{d(o.map((n,a)=>a===e?t:n))},m=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to remove this prompt?")&&d(o.filter((e,n)=>n!==t))};return(0,a.jsxs)("div",{children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Prompts"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"file-input-add-prompt",children:(0,a.jsx)(w.Z,{title:"Upload prompt from file",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(E.Z,{component:"span",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)("input",{id:"file-input-add-prompt",type:"file",accept:".txt,.md",onChange:e=>{var t;e.stopPropagation(),e.preventDefault();let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){let e=new FileReader;e.onload=e=>{var t,n;let a=null===(n=e.target)||void 0===n?void 0:null===(t=n.result)||void 0===t?void 0:t.toString();a&&d([...o,a])},e.readAsText(n)}},style:{display:"none"}})]})})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>{t(!0)},variant:"contained",children:"Add Prompt"})]})]}),(0,a.jsx)(O.Z,{children:(0,a.jsx)(I.Z,{children:(0,a.jsx)(P.Z,{children:0===o.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(S.Z,{colSpan:2,align:"center",children:"No prompts added yet."})}):o.map((e,t)=>(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>u(t),children:[(0,a.jsx)(S.Z,{children:(0,a.jsxs)(s.Z,{variant:"body2",children:["Prompt #".concat(t+1,": "),(e.length>250?e.slice(0,250)+" ...":e).split(/({{\w+}})/g).map((e,t)=>/{{\w+}}/g.test(e)?(0,a.jsx)("span",{className:"prompt-var-highlight",children:e},t):e)]})}),(0,a.jsxs)(S.Z,{align:"right",sx:{minWidth:150},children:[(0,a.jsx)(E.Z,{onClick:()=>u(t),size:"small",children:(0,a.jsx)(R.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>h(e,t),size:"small",children:(0,a.jsx)(z.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>m(e,t),size:"small",children:(0,a.jsx)(W.Z,{})})]})]},t))})})}),(0,a.jsx)(V,{open:e,prompt:null!==n?o[n]:"",index:null!==n?n:0,onAdd:e=>{null!==n?x(n,e):d([...o,e]),l(null)},onCancel:()=>{l(null),t(!1)}})]})},L=n(6988),U=e=>{let{onAdd:t,varsList:n,initialValues:r}=e,[l,d]=i.useState(r||{});return(0,i.useEffect)(()=>{let e={};n.forEach(t=>{e[t]=(null==r?void 0:r[t])||""}),d(e)},[n,r]),(0,a.jsxs)(o.Z,{my:2,children:[(0,a.jsx)(s.Z,{variant:"h6",mb:2,children:"Vars"}),n.length>0?(0,a.jsx)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:Object.keys(l).map((e,n)=>(0,a.jsx)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:(0,a.jsx)(C.Z,{placeholder:e,label:e,value:l[e],fullWidth:!0,onChange:n=>{let a=n.target.value,i={...l,[e]:a};d(i),t(i)}})},n))}):(0,a.jsxs)(s.Z,{variant:"subtitle1",gutterBottom:!0,children:["Add variables to your prompt using the ","{{varname}}"," syntax."]})]})},B=n(8440);let K=["equals","contains","icontains","contains-all","contains-any","starts-with","regex","is-json","contains-json","similar","llm-rubric","model-graded-closedqa","factuality","webhook","rouge-n","rouge-s","rouge-l","not-equals","not-contains","not-icontains","not-contains-all","not-contains-any","not-starts-with","not-regex","not-is-json","not-contains-json","not-similar","not-webhook","not-rouge-n","not-rouge-s","not-rouge-l","is-valid-openai-function-call","is-valid-openai-tools-call","latency","perplexity","perplexity-score","cost","answer-relevance","context-faithfulness","context-recall","context-relevance","select-best"];var D=e=>{let{onAdd:t,initialValues:n}=e,[l,d]=(0,i.useState)(n||[]),p=e=>{let n=l.filter((t,n)=>n!==e);d(n),t(n)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.Z,{variant:"h6",children:"Asserts"}),(0,a.jsx)(o.Z,{my:l.length>0?2:0,children:(0,a.jsx)(c.Z,{direction:"column",spacing:2,children:l.map((e,n)=>(0,a.jsxs)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:[(0,a.jsx)(B.Z,{value:e.type,options:K,sx:{minWidth:200},onChange:(e,a)=>{let i=l.map((e,t)=>t===n?{...e,type:a}:e);d(i),t(i)},renderInput:e=>(0,a.jsx)(C.Z,{...e,label:"Type"})}),(0,a.jsx)(C.Z,{label:"Value",value:e.value,fullWidth:!0,onChange:e=>{let a=e.target.value,i=l.map((e,t)=>t===n?{...e,value:a}:e);d(i),t(i)}}),(0,a.jsx)(E.Z,{onClick:()=>p(n),size:"small",children:(0,a.jsx)(W.Z,{})})]},n))})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>{let e=[...l,{type:"equals",value:""}];d(e),t(e)},children:"Add Assert"})]})},Y=e=>{let{open:t,onAdd:n,varsList:l,initialValues:s,onCancel:c}=e,[h,m]=(0,i.useState)((null==s?void 0:s.description)||""),[f,g]=(0,i.useState)((null==s?void 0:s.vars)||{}),[j,v]=(0,i.useState)((null==s?void 0:s.assert)||[]),[Z,b]=(0,i.useState)(0);i.useEffect(()=>{s?(m(s.description||""),g(s.vars||{}),v(s.assert||[])):(m(""),g({}),v([]))},[s]);let y=e=>{n({description:h,vars:f,assert:j},e),e&&c(),m(""),g({}),v([]),b(e=>e+1)};return(0,a.jsxs)(d.Z,{open:t,onClose:c,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:s?"Edit Test Case":"Add Test Case"}),(0,a.jsx)(u.Z,{children:(0,a.jsxs)(o.Z,{children:[(0,a.jsx)(U,{onAdd:e=>g(e),varsList:l,initialValues:null==s?void 0:s.vars}),(0,a.jsx)(D,{onAdd:e=>v(e),initialValues:(null==s?void 0:s.assert)||[]},Z)]})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:y.bind(void 0,!0),color:"primary",variant:"contained",children:s?"Update Test Case":"Add Test Case"}),!s&&(0,a.jsx)(r.Z,{onClick:y.bind(void 0,!1),color:"primary",variant:"contained",children:"Add Another"}),(0,a.jsx)(r.Z,{onClick:c,color:"secondary",children:"Cancel"})]})]})},q=n(5320),J=e=>{let{varsList:t}=e,{testCases:l,setTestCases:o}=(0,j.o)(),[d,p]=i.useState(null),[u,h]=i.useState(!1),x=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to delete this test case?")&&o(l.filter((e,n)=>n!==t))},m=(e,t)=>{e.stopPropagation();let n=JSON.parse(JSON.stringify(l[t]));o([...l,n])};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Test Cases"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"file-input-add-test-case",children:(0,a.jsx)(w.Z,{title:"Upload test cases from csv",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(E.Z,{component:"span",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)("input",{id:"file-input-add-test-case",type:"file",accept:".csv",onChange:e=>{var t;e.stopPropagation(),e.preventDefault();let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(a){let e=new FileReader;e.onload=async e=>{var t,a;let i=null===(a=e.target)||void 0===a?void 0:null===(t=a.result)||void 0===t?void 0:t.toString();if(i){let{parse:e}=await Promise.all([n.e(133),n.e(922)]).then(n.bind(n,8922)),t=e(i,{columns:!0});o([...l,...t.map(e=>(0,q.It)(e))])}},e.readAsText(a)}},style:{display:"none"}})]})})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>h(!0),variant:"contained",children:"Add Test Case"})]})]}),(0,a.jsx)(O.Z,{children:(0,a.jsxs)(I.Z,{children:[(0,a.jsx)(L.Z,{children:(0,a.jsxs)(T.Z,{children:[(0,a.jsx)(S.Z,{children:"Description"}),(0,a.jsx)(S.Z,{children:"Assertions"}),(0,a.jsx)(S.Z,{children:"Variables"}),(0,a.jsx)(S.Z,{align:"right"})]})}),(0,a.jsx)(P.Z,{children:0===l.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(S.Z,{colSpan:4,align:"center",children:"No test cases added yet."})}):l.map((e,t)=>{var n;return(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>{p(t),h(!0)},children:[(0,a.jsx)(S.Z,{children:(0,a.jsx)(s.Z,{variant:"body2",children:e.description||"Test Case #".concat(t+1)})}),(0,a.jsxs)(S.Z,{children:[(null===(n=e.assert)||void 0===n?void 0:n.length)||0," assertions"]}),(0,a.jsx)(S.Z,{children:Object.entries(e.vars||{}).map(e=>{let[t,n]=e;return t+"="+n}).join(", ")}),(0,a.jsxs)(S.Z,{align:"right",sx:{minWidth:150},children:[(0,a.jsx)(E.Z,{onClick:()=>{p(t),h(!0)},size:"small",children:(0,a.jsx)(R.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>m(e,t),size:"small",children:(0,a.jsx)(z.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>x(e,t),size:"small",children:(0,a.jsx)(W.Z,{})})]})]},t)})})]})}),(0,a.jsx)(Y,{open:u,onAdd:(e,t)=>{if(null===d)o([...l,e]);else{let t=l.map((t,n)=>n===d?e:t);o(t),p(null)}t&&h(!1)},varsList:t,initialValues:null!==d?l[d]:void 0,onCancel:()=>{p(null),h(!1)}})]})},X=n(7827),G=e=>{let{onChange:t,...n}=e,[r,l]=i.useState(""),[s,o]=i.useState(!1);return(0,a.jsx)(C.Z,{...n,error:s,helperText:s?"Invalid JSON":"",value:r,onChange:e=>{let n=e.target.value;try{let e=JSON.parse(n);l(n),o(!1),t&&t(e)}catch(e){l(n),o(!0)}}})},H=e=>{let{open:t,providerId:n,config:l,onClose:s,onSave:c}=e,[h,m]=i.useState(l);return i.useEffect(()=>{m(l)},[l]),(0,a.jsxs)(d.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"md",children:[(0,a.jsxs)(x.Z,{children:["Edit ",n.length>50?n.slice(0,50)+"...":n]}),(0,a.jsx)(u.Z,{children:Object.keys(h).map(e=>{let t;let n=h[e];return"number"==typeof n||"boolean"==typeof n||"string"==typeof n?(t="number"==typeof n?t=>m({...h,[e]:parseFloat(t.target.value)}):"boolean"==typeof n?t=>m({...h,[e]:"true"===t.target.value}):t=>{let n=t.target.value.trim();if(n.startsWith("{")||n.startsWith("["))try{m({...h,[e]:JSON.parse(n)})}catch(t){m({...h,[e]:n})}else"null"===n?m({...h,[e]:null}):"undefined"===n?m({...h,[e]:void 0}):m({...h,[e]:n})},(0,a.jsx)(o.Z,{my:2,children:(0,a.jsx)(C.Z,{label:e,value:n,onChange:t,fullWidth:!0,InputLabelProps:{shrink:!0},type:"number"==typeof n?"number":"text"})},e)):(0,a.jsx)(o.Z,{my:2,children:(0,a.jsx)(G,{label:e,defaultValue:JSON.stringify(n),onChange:t=>{m({...h,[e]:t})},fullWidth:!0,multiline:!0,minRows:2,InputLabelProps:{shrink:!0}})},e)})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:s,children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{c(h)},children:"Save"})]})]})};let M=[].concat(["replicate:replicate/flan-t5-small:69716ad8c34274043bf4a135b7315c7c569ec931d8f23d6826e249e1c142a264"].map(e=>({id:e,config:{temperature:.5,max_length:1024,repetition_penality:1}}))).concat(["replicate:replicate/codellama-7b-instruct:0103579e86fc75ba0d65912890fa19ef03c84a68554635319accf2e0ba93d3ae","replicate:replicate/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b","replicate:replicate/llama-2-70b-chat:2796ee9483c3fd7aa2e171d38f4ca12251a30609463dcfd4cd76703f22e96cdf"].map(e=>({id:e,config:{system_prompt:"",temperature:.75,top_p:.9,top_k:50,max_new_tokens:128,min_new_tokens:-1}}))).concat(["replicate:replicate/codellama-7b:6880b103613a9cd23950c5fd6c140197e519905bd0dd00e448c4858bdd06090a","replicate:replicate/codellama-13b-python:09b87c02dfa403e0c3289166dece62286b3bce49bae39a9c9204713cf94b8b7d","replicate:replicate/codellama-13b:1c914d844307b0588599b8393480a3ba917b660c7e9dfae681542b5325f228db","replicate:replicate/codellama-34b-python:9048743d22a7b19cd0abb018066809ea6af4f2b4717bef9aad3c5ae21ceac00d","replicate:replicate/codellama-34b:0666717e5ead8557dff55ee8f11924b5c0309f5f1ca52f64bb8eec405fdb38a7"].map(e=>({id:e,config:{temperature:.75,top_p:.9,top_k:50,max_new_tokens:128,min_new_tokens:-1}}))).concat(["replicate:a16z-infra/llama-2-7b-chat:7b0bfc9aff140d5b75bacbed23e91fd3c34b01a1e958d32132de6e0a19796e2c","replicate:a16z-infra/llama-2-13b-chat:2a7f981751ec7fdf87b5b91ad4db53683a98082e9ff7bfd12c8cd5ea85980a52"].map(e=>({id:e,config:{temperature:.95,top_p:.95,top_k:250,max_new_tokens:500,min_new_tokens:-1,repetition_penality:1,system_prompt:""}}))).concat(["replicate:mistralai/mistral-7b-v0.1","replicate:mistralai/mistral-7b-instruct-v0.2","replicate:mistralai/mixtral-8x7b-instruct-v0.1"].map(e=>({id:e,config:{temperature:.7,top_p:.9,top_k:-1,max_new_tokens:128,min_new_tokens:-1,repetition_penality:1.15,prompt_template:"{prompt}"}}))).concat(["anthropic:claude-1","anthropic:claude-1-100k","anthropic:claude-instant-1","anthropic:claude-instant-1-100k"].map(e=>({id:e,config:{max_tokens_to_sample:256,temperature:.5}}))).concat(["anthropic:messages:claude-instant-1.2","anthropic:messages:claude-2.0","anthropic:messages:claude-2.1","anthropic:messages:claude-3-haiku-20240307","anthropic:messages:claude-3-sonnet-20240229","anthropic:messages:claude-3-opus-20240229"].map(e=>({id:e,config:{max_tokens:1024,temperature:.5}}))).concat(["bedrock:anthropic.claude-instant-v1","bedrock:anthropic.claude-v1","bedrock:anthropic.claude-v2"].map(e=>({id:e,config:{max_tokens_to_sample:256,temperature:.5}}))).concat(["openai:gpt-3.5-turbo","openai:gpt-3.5-turbo-0301","openai:gpt-3.5-turbo-0613","openai:gpt-3.5-turbo-16k","openai:gpt-3.5-turbo-16k-0613","openai:gpt-4","openai:gpt-4-0314","openai:gpt-4-0613","openai:gpt-4-32k","openai:gpt-4-32k-0314"].map(e=>({id:e,config:{organization:"",temperature:.5,max_tokens:1024,top_p:1,frequency_penalty:0,presence_penalty:0,function_call:void 0,functions:void 0,stop:void 0}}))).concat(["azureopenai:gpt-3.5-turbo","azureopenai:gpt-3.5-turbo-0301","azureopenai:gpt-3.5-turbo-0613","azureopenai:gpt-3.5-turbo-16k","azureopenai:gpt-3.5-turbo-16k-0613","azureopenai:gpt-4","azureopenai:gpt-4-0314","azureopenai:gpt-4-0613","azureopenai:gpt-4-32k","azureopenai:gpt-4-32k-0314"].map(e=>({id:e,config:{temperature:.5,max_tokens:1024,top_p:1,frequency_penalty:0,presence_penalty:0,function_call:void 0,functions:void 0,stop:void 0}}))).concat(["vertex:chat-bison@001","vertex:chat-bison","vertex:chat-bison-32k","vertex:chat-bison-32k@001"].map(e=>({id:e,config:{context:void 0,examples:void 0,temperature:0,maxOutputTokens:1024,topP:.95,topK:40,safetySettings:void 0,stopSequence:void 0}}))).sort((e,t)=>e.id.localeCompare(t.id)),$={anthropic:"Anthropic",bedrock:"Amazon Web Services",azureopenai:"Azure",openai:"OpenAI",replicate:"Replicate"};var Q=e=>{let{providers:t,onChange:n}=e,[r,l]=i.useState(null),s=e=>"string"==typeof e?e:e.id||"Unknown provider",c=(e,t)=>"string"==typeof e?e:e.id||t,d=e=>{"string"==typeof e?alert("Cannot edit custom providers"):e.config?l(e):alert("There is no config for this provider")};return(0,a.jsxs)(o.Z,{mt:2,children:[(0,a.jsx)(B.Z,{multiple:!0,freeSolo:!0,options:M,value:t,groupBy:e=>(function(e){if(!e)return"Other";let t=e.split(":")[0];return $[t]||t})(e.id),onChange:(e,t)=>{n(t.map(e=>"string"==typeof e?{id:e}:e))},getOptionLabel:e=>{if(!e)return"";let t="";"string"==typeof e&&(t=e),e.id&&"string"==typeof e.id&&(t=e.id);let n=t.split(":");return n.length>1?n.length>2&&"anthropic"===n[0]?n[2]:n[1]:"Unknown provider"},renderTags:(e,t)=>e.map((e,n)=>{let a=s(e),r=c(e,n);return(0,i.createElement)(X.Z,{variant:"outlined",label:a,...t({index:n}),key:r,onClick:()=>d(e)})}),renderInput:e=>(0,a.jsx)(C.Z,{...e,variant:"outlined",placeholder:"Select LLM providers",helperText:t.length>0?"Click a provider to configure its settings.":null})}),r&&r.id&&(0,a.jsx)(H,{open:!!r,providerId:r.id,config:r.config,onClose:()=>l(null),onSave:e=>{if(r){let a=t.map(t=>t.id===r.id?{...t,config:e}:t);n(a),l(null)}}})]})},ee=n(2666),et=n.n(ee),en=n(4759);n(5341),n(7555);var ea=n(8339),ei=n(9963),er=n(1396),el=n.n(er);n(695);var es=()=>{let{env:e,setEnv:t,description:n,setDescription:l,providers:c,setProviders:d,prompts:p,setPrompts:u,testCases:h,setTestCases:x,defaultTest:m,setDefaultTest:f,evaluateOptions:g,setEvaluateOptions:v}=(0,j.o)(),[Z,b]=i.useState(""),[y,_]=i.useState(!0);i.useEffect(()=>{b(ea.default.dump({env:e,description:n,providers:c,prompts:p,tests:h,defaultTest:m,evaluateOptions:g}))},[e,n,c,p,h,m,g]);let C=e=>{t(e.env||{}),l(e.description||""),d(e.providers||[]),u(e.prompts||[]),x(e.tests||[]),f(e.defaultTest||{}),v(e.evaluateOptions||{})};return(0,a.jsxs)(o.Z,{mt:4,children:[(0,a.jsx)(s.Z,{variant:"h5",gutterBottom:!0,children:"Configuration"}),(0,a.jsxs)(s.Z,{variant:"body1",gutterBottom:!0,children:["This is the YAML config that defines the evaluation and is processed by promptfoo. See"," ",(0,a.jsx)(el(),{target:"_blank",href:"https://promptfoo.dev/docs/configuration/guide",children:"configuration docs"})," ","to learn more."]}),(0,a.jsx)(r.Z,{variant:"text",color:"primary",startIcon:y?(0,a.jsx)(R.Z,{}):(0,a.jsx)(ei.Z,{}),onClick:()=>{if(!y)try{let e=ea.default.load(Z,{json:!0});C(e)}catch(e){}_(!y)},children:y?"Edit YAML":"Save"}),(0,a.jsx)(et(),{autoCapitalize:"off",value:Z,onValueChange:e=>{y||b(e)},highlight:e=>(0,en.highlight)(e,en.languages.yaml),padding:10,style:{fontFamily:'"Fira code", "Fira Mono", monospace',fontSize:14},disabled:y,className:y?"":"glowing-border"})]})};n(284);var eo=n(7580);function ec(e){let{error:t,resetErrorBoundary:n}=e;return(0,a.jsxs)("div",{role:"alert",children:[(0,a.jsx)("p",{children:"Something went wrong:"}),(0,a.jsx)("pre",{children:t.message}),(0,a.jsx)("button",{onClick:n,children:"Try again"})]})}var ed=()=>{let[e,t]=(0,i.useState)(!1),{description:n,setDescription:f,providers:g,setProviders:v,prompts:b,setPrompts:y,testCases:_,setTestCases:C}=(0,j.o)();if((0,i.useEffect)(()=>{j.o.persist.rehydrate()},[]),eo.env.NEXT_PUBLIC_NO_BROWSING)return null;let k=(e=>{let t=/{{(\w+)}}/g,n=new Set;return e.forEach(e=>{let a;for(;null!==(a=t.exec(e));)n.add(a[1])}),Array.from(n)})(b);return(0,a.jsxs)(l.Z,{maxWidth:"lg",sx:{marginTop:"2rem"},children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h4",children:"Set up an evaluation"}),(0,a.jsxs)(c.Z,{direction:"row",spacing:2,children:[(0,a.jsx)(Z,{}),(0,a.jsx)(A,{}),(0,a.jsx)(r.Z,{variant:"outlined",color:"primary",onClick:()=>t(!0),children:"Reset"})]})]}),(0,a.jsx)(o.Z,{mt:4}),(0,a.jsx)(o.Z,{mt:2,children:(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{v([])},children:(0,a.jsxs)(c.Z,{direction:"column",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Providers"}),(0,a.jsx)(Q,{providers:g,onChange:v})]})})}),(0,a.jsx)(o.Z,{mt:4}),(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{y([])},children:(0,a.jsx)(F,{})}),(0,a.jsx)(o.Z,{mt:6}),(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{C([])},children:(0,a.jsx)(J,{varsList:k})}),(0,a.jsx)(es,{}),(0,a.jsxs)(d.Z,{open:e,onClose:()=>t(!1),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,a.jsx)(x.Z,{id:"alert-dialog-title",children:"Confirm Reset"}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(h.Z,{id:"alert-dialog-description",children:"Are you sure you want to reset all the fields? This action cannot be undone."})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:()=>t(!1),children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{f(""),v([]),y([]),C([]),t(!1)},autoFocus:!0,children:"Reset"})]})]})]})}},279:function(e,t,n){"use strict";n.d(t,{Ox:function(){return r},T8:function(){return i},eA:function(){return l}});var a=n(7580);let i=!a.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,r=!!a.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,l=""},1938:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var a=n(4660),i=n(4810);let r=(0,a.Ue)()((0,i.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},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}),setDefaultTest:t=>e({defaultTest:t}),setEvaluateOptions:t=>e({evaluateOptions:t}),setStateFromConfig:t=>{let n={};t.description&&(n.description=t.description||""),t.tests&&(n.testCases=t.tests),t.providers&&(n.providers=t.providers),t.prompts&&("string"==typeof t.prompts?n.prompts=[t.prompts]:Array.isArray(t.prompts)?n.prompts=t.prompts.filter(e=>!e.endsWith(".txt")&&!e.endsWith(".json")&&!e.endsWith(".yaml")):console.warn("Invalid prompts config",t.prompts)),e(n)},getTestSuite:()=>{let{description:e,testCases:n,providers:a,prompts:i,env:r}=t();return{env:r,description:e,providers:a,prompts:i,tests:n}}}),{name:"promptfoo",skipHydration:!0}))},2280:function(){},695:function(){},284:function(){},5320:function(e,t){"use strict";t.It=void 0,t.It=function(e){let t,n;let a={},i=[],r={};for(let[l,s]of Object.entries(e))l.startsWith("__expected")?""!==s.trim()&&i.push(function(e){if(e.startsWith("javascript:")||e.startsWith("fn:")||e.startsWith("eval:")){let t;e.startsWith("javascript:")&&(t=11),e.startsWith("fn:")&&(t=3),e.startsWith("eval:")&&(t=5);let n=e.slice(t);return{type:"javascript",value:n}}if(e.startsWith("grade:")||e.startsWith("llm-rubric:"))return{type:"llm-rubric",value:e.slice(6)};if(e.startsWith("python:")){let t=e.slice(7);return{type:"python",value:t}}let t=e.match(/^(not-)?(equals|contains-any|contains-all|icontains-any|icontains-all|contains-json|is-json|regex|icontains|contains|webhook|rouge-n|similar|starts-with|levenshtein|classifier|model-graded-factuality|factuality|model-graded-closedqa|answer-relevance|context-recall|context-relevance|context-faithfulness|is-valid-openai-function-call|is-valid-openai-tools-call|latency|perplexity|perplexity-score|cost)(?:\((\d+(?:\.\d+)?)\))?(?::([\s\S]*))?$/);if(t){let[e,n,a,i,r]=t,l=n?`not-${a}`:a,s=parseFloat(i);return"contains-any"===a||"contains-all"===a||"icontains-any"===a||"icontains-all"===a?{type:l,value:r.split(",").map(e=>e.trim())}:"contains-json"===a||"is-json"===a?{type:l,value:r}:"rouge-n"===a||"similar"===a||"starts-with"===a||"levenshtein"===a||"classifier"===a||"answer-relevance"===a||"context-recall"===a||"context-relevance"===a||"context-faithfulness"===a||"latency"===a||"perplexity"===a||"perplexity-score"===a||"cost"===a?{type:l,value:r,threshold:s||("similar"===a?.8:.75)}:{type:l,value:r}}return{type:"equals",value:e}}(s)):"__prefix"===l?r.prefix=s:"__suffix"===l?r.suffix=s:"__description"===l?n=s:"__providerOutput"===l?t=s:a[l]=s;return{vars:a,...t?{providerOutput:t}:{},assert:i,options:r,...n?{description:n}:{}}}}},function(e){e.O(0,[547,602,72,975,414,113,261,339,921,946,971,596,744],function(){return e(e.s=3515)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{3515:function(e,t,n){Promise.resolve().then(n.bind(n,2378))},2378:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ed}});var a=n(7437),i=n(2265),r=n(5551),l=n(8938),s=n(3226),o=n(6507),c=n(3457),d=n(9394),p=n(2834),u=n(6337),h=n(4173),x=n(1797),m=n(4740),f=n(4033),g=n(6882),j=n(1938),v=n(279),Z=()=>{let e=(0,f.useRouter)(),{env:t,description:n,providers:l,prompts:s,testCases:o}=(0,j.o)(),[c,d]=(0,i.useState)(!1),[p,u]=(0,i.useState)(0),h=async()=>{d(!0);try{let a=await fetch("".concat(v.eA,"/api/eval/job/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t,description:n,providers:l,prompts:s,tests:o})});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));let i=await a.json(),r=setInterval(async()=>{let t=await fetch("".concat(v.eA,"/api/eval/job/").concat(i.id,"/"));if(!t.ok)throw clearInterval(r),Error("HTTP error! status: ".concat(t.status));let n=await t.json();if("complete"===n.status)clearInterval(r),d(!1),v.Ox?e.push("/eval/remote:".concat(encodeURIComponent(i.id))):e.push("/eval");else if("failed"===n.status)throw clearInterval(r),d(!1),Error("Job failed");else{let e=0===n.total?0:Math.round(n.progress/n.total*100);u(e)}},1e3)}catch(e){console.error(e),d(!1),alert("An error occurred: ".concat(e.message))}};return(0,a.jsx)(r.Z,{variant:"contained",color:"primary",onClick:h,disabled:c,children:c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{size:24,sx:{marginRight:2}}),p.toFixed(0),"% complete"]}):"Run Evaluation"})},b=n(2057),y=n(8768),_=n(5873),C=n(1975),k=n(3295),A=()=>{let{env:e,setEnv:t}=(0,j.o)(),[n,l]=(0,i.useState)(!1),[s,o]=(0,i.useState)(e),c=()=>{l(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{variant:"outlined",startIcon:(0,a.jsx)(k.Z,{}),onClick:()=>{l(!0)},children:"API keys"}),(0,a.jsxs)(d.Z,{open:n,onClose:c,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Provider settings"}),(0,a.jsxs)(u.Z,{children:[(0,a.jsxs)(b.Z,{defaultExpanded:!0,children:[(0,a.jsx)(_.Z,{children:"OpenAI"}),(0,a.jsxs)(y.Z,{children:[(0,a.jsx)(C.Z,{label:"OpenAI API key",fullWidth:!0,margin:"normal",value:s.OPENAI_API_KEY,onChange:e=>o({...s,OPENAI_API_KEY:e.target.value})}),(0,a.jsx)(C.Z,{label:"OpenAI API host",fullWidth:!0,margin:"normal",value:s.OPENAI_API_HOST,onChange:e=>o({...s,OPENAI_API_HOST:e.target.value})}),(0,a.jsx)(C.Z,{label:"OpenAI organization",fullWidth:!0,margin:"normal",value:s.OPENAI_ORGANIZATION,onChange:e=>o({...s,OPENAI_ORGANIZATION:e.target.value})})]})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Azure"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Azure API key",fullWidth:!0,margin:"normal",value:s.AZURE_OPENAI_API_KEY,onChange:e=>o({...s,AZURE_OPENAI_API_KEY:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Amazon Bedrock"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Bedrock Region",fullWidth:!0,margin:"normal",value:s.AWS_BEDROCK_REGION,onChange:e=>o({...s,AWS_BEDROCK_REGION:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Anthropic"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Anthropic API key",fullWidth:!0,margin:"normal",value:s.ANTHROPIC_API_KEY,onChange:e=>o({...s,ANTHROPIC_API_KEY:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Google Vertex AI"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex API Key",fullWidth:!0,margin:"normal",value:s.VERTEX_API_KEY,onChange:e=>o({...s,VERTEX_API_KEY:e.target.value})})}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex Project ID",fullWidth:!0,margin:"normal",value:s.VERTEX_PROJECT_ID,onChange:e=>o({...s,VERTEX_PROJECT_ID:e.target.value})})}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex Region",fullWidth:!0,margin:"normal",value:s.VERTEX_REGION,onChange:e=>o({...s,VERTEX_REGION:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Replicate"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Replicate API key",fullWidth:!0,margin:"normal",value:s.REPLICATE_API_KEY,onChange:e=>o({...s,REPLICATE_API_KEY:e.target.value})})})]})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:c,color:"primary",children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{t(s),c()},color:"primary",variant:"contained",children:"Save"})]})]})]})},E=n(2653),I=n(3701),P=n(9279),S=n(666),O=n(5795),T=n(4147),w=n(8276),R=n(3391),W=n(6446),N=n(1280),z=n(9329),V=e=>{let{open:t,prompt:n,index:l,onAdd:s,onCancel:o}=e,[c,h]=i.useState(n),m=i.useRef(null);i.useEffect(()=>{h(n)},[n]);let f=e=>{s(c),h(""),e?o():m.current&&m.current.focus()};return(0,a.jsxs)(d.Z,{open:t,onClose:o,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Edit Prompt ".concat(l+1)}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(C.Z,{value:c,onChange:e=>h(e.target.value),fullWidth:!0,margin:"normal",multiline:!0,placeholder:"The quick brown {{animal1}} jumps over the lazy {{animal2}}.",helperText:"Tip: use the {{varname}} syntax to add variables to your prompt.",inputRef:m})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:f.bind(null,!0),color:"primary",variant:"contained",disabled:!c.length,children:"Add"}),(0,a.jsx)(r.Z,{onClick:f.bind(null,!1),color:"primary",variant:"contained",disabled:!c.length,children:"Add Another"}),(0,a.jsx)(r.Z,{onClick:o,color:"secondary",children:"Cancel"})]})]})};n(2280);var F=()=>{let[e,t]=(0,i.useState)(!1),[n,l]=(0,i.useState)(null),{prompts:o,setPrompts:d}=(0,j.o)(),p=(0,i.useRef)(null);(0,i.useEffect)(()=>{null!==n&&n>0&&p.current&&p.current.focus()},[n]);let u=e=>{l(e),t(!0)},h=(e,t)=>{e.stopPropagation();let n=o[t];d([...o,n])},x=(e,t)=>{d(o.map((n,a)=>a===e?t:n))},m=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to remove this prompt?")&&d(o.filter((e,n)=>n!==t))};return(0,a.jsxs)("div",{children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Prompts"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"file-input-add-prompt",children:(0,a.jsx)(w.Z,{title:"Upload prompt from file",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(E.Z,{component:"span",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)("input",{id:"file-input-add-prompt",type:"file",accept:".txt,.md",onChange:e=>{var t;e.stopPropagation(),e.preventDefault();let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){let e=new FileReader;e.onload=e=>{var t,n;let a=null===(n=e.target)||void 0===n?void 0:null===(t=n.result)||void 0===t?void 0:t.toString();a&&d([...o,a])},e.readAsText(n)}},style:{display:"none"}})]})})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>{t(!0)},variant:"contained",children:"Add Prompt"})]})]}),(0,a.jsx)(O.Z,{children:(0,a.jsx)(I.Z,{children:(0,a.jsx)(P.Z,{children:0===o.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(S.Z,{colSpan:2,align:"center",children:"No prompts added yet."})}):o.map((e,t)=>(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>u(t),children:[(0,a.jsx)(S.Z,{children:(0,a.jsxs)(s.Z,{variant:"body2",children:["Prompt #".concat(t+1,": "),(e.length>250?e.slice(0,250)+" ...":e).split(/({{\w+}})/g).map((e,t)=>/{{\w+}}/g.test(e)?(0,a.jsx)("span",{className:"prompt-var-highlight",children:e},t):e)]})}),(0,a.jsxs)(S.Z,{align:"right",sx:{minWidth:150},children:[(0,a.jsx)(E.Z,{onClick:()=>u(t),size:"small",children:(0,a.jsx)(R.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>h(e,t),size:"small",children:(0,a.jsx)(z.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>m(e,t),size:"small",children:(0,a.jsx)(W.Z,{})})]})]},t))})})}),(0,a.jsx)(V,{open:e,prompt:null!==n?o[n]:"",index:null!==n?n:0,onAdd:e=>{null!==n?x(n,e):d([...o,e]),l(null)},onCancel:()=>{l(null),t(!1)}})]})},L=n(6988),U=e=>{let{onAdd:t,varsList:n,initialValues:r}=e,[l,d]=i.useState(r||{});return(0,i.useEffect)(()=>{let e={};n.forEach(t=>{e[t]=(null==r?void 0:r[t])||""}),d(e)},[n,r]),(0,a.jsxs)(o.Z,{my:2,children:[(0,a.jsx)(s.Z,{variant:"h6",mb:2,children:"Vars"}),n.length>0?(0,a.jsx)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:Object.keys(l).map((e,n)=>(0,a.jsx)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:(0,a.jsx)(C.Z,{placeholder:e,label:e,value:l[e],fullWidth:!0,onChange:n=>{let a=n.target.value,i={...l,[e]:a};d(i),t(i)}})},n))}):(0,a.jsxs)(s.Z,{variant:"subtitle1",gutterBottom:!0,children:["Add variables to your prompt using the ","{{varname}}"," syntax."]})]})},B=n(8440);let K=["equals","contains","icontains","contains-all","contains-any","starts-with","regex","is-json","contains-json","similar","llm-rubric","model-graded-closedqa","factuality","webhook","rouge-n","rouge-s","rouge-l","not-equals","not-contains","not-icontains","not-contains-all","not-contains-any","not-starts-with","not-regex","not-is-json","not-contains-json","not-similar","not-webhook","not-rouge-n","not-rouge-s","not-rouge-l","is-valid-openai-function-call","is-valid-openai-tools-call","latency","perplexity","perplexity-score","cost","answer-relevance","context-faithfulness","context-recall","context-relevance","select-best"];var D=e=>{let{onAdd:t,initialValues:n}=e,[l,d]=(0,i.useState)(n||[]),p=e=>{let n=l.filter((t,n)=>n!==e);d(n),t(n)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.Z,{variant:"h6",children:"Asserts"}),(0,a.jsx)(o.Z,{my:l.length>0?2:0,children:(0,a.jsx)(c.Z,{direction:"column",spacing:2,children:l.map((e,n)=>(0,a.jsxs)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:[(0,a.jsx)(B.Z,{value:e.type,options:K,sx:{minWidth:200},onChange:(e,a)=>{let i=l.map((e,t)=>t===n?{...e,type:a}:e);d(i),t(i)},renderInput:e=>(0,a.jsx)(C.Z,{...e,label:"Type"})}),(0,a.jsx)(C.Z,{label:"Value",value:e.value,fullWidth:!0,onChange:e=>{let a=e.target.value,i=l.map((e,t)=>t===n?{...e,value:a}:e);d(i),t(i)}}),(0,a.jsx)(E.Z,{onClick:()=>p(n),size:"small",children:(0,a.jsx)(W.Z,{})})]},n))})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>{let e=[...l,{type:"equals",value:""}];d(e),t(e)},children:"Add Assert"})]})},Y=e=>{let{open:t,onAdd:n,varsList:l,initialValues:s,onCancel:c}=e,[h,m]=(0,i.useState)((null==s?void 0:s.description)||""),[f,g]=(0,i.useState)((null==s?void 0:s.vars)||{}),[j,v]=(0,i.useState)((null==s?void 0:s.assert)||[]),[Z,b]=(0,i.useState)(0);i.useEffect(()=>{s?(m(s.description||""),g(s.vars||{}),v(s.assert||[])):(m(""),g({}),v([]))},[s]);let y=e=>{n({description:h,vars:f,assert:j},e),e&&c(),m(""),g({}),v([]),b(e=>e+1)};return(0,a.jsxs)(d.Z,{open:t,onClose:c,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:s?"Edit Test Case":"Add Test Case"}),(0,a.jsx)(u.Z,{children:(0,a.jsxs)(o.Z,{children:[(0,a.jsx)(U,{onAdd:e=>g(e),varsList:l,initialValues:null==s?void 0:s.vars}),(0,a.jsx)(D,{onAdd:e=>v(e),initialValues:(null==s?void 0:s.assert)||[]},Z)]})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:y.bind(void 0,!0),color:"primary",variant:"contained",children:s?"Update Test Case":"Add Test Case"}),!s&&(0,a.jsx)(r.Z,{onClick:y.bind(void 0,!1),color:"primary",variant:"contained",children:"Add Another"}),(0,a.jsx)(r.Z,{onClick:c,color:"secondary",children:"Cancel"})]})]})},q=n(5320),J=e=>{let{varsList:t}=e,{testCases:l,setTestCases:o}=(0,j.o)(),[d,p]=i.useState(null),[u,h]=i.useState(!1),x=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to delete this test case?")&&o(l.filter((e,n)=>n!==t))},m=(e,t)=>{e.stopPropagation();let n=JSON.parse(JSON.stringify(l[t]));o([...l,n])};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Test Cases"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"file-input-add-test-case",children:(0,a.jsx)(w.Z,{title:"Upload test cases from csv",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(E.Z,{component:"span",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)("input",{id:"file-input-add-test-case",type:"file",accept:".csv",onChange:e=>{var t;e.stopPropagation(),e.preventDefault();let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(a){let e=new FileReader;e.onload=async e=>{var t,a;let i=null===(a=e.target)||void 0===a?void 0:null===(t=a.result)||void 0===t?void 0:t.toString();if(i){let{parse:e}=await Promise.all([n.e(133),n.e(922)]).then(n.bind(n,8922)),t=e(i,{columns:!0});o([...l,...t.map(e=>(0,q.It)(e))])}},e.readAsText(a)}},style:{display:"none"}})]})})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>h(!0),variant:"contained",children:"Add Test Case"})]})]}),(0,a.jsx)(O.Z,{children:(0,a.jsxs)(I.Z,{children:[(0,a.jsx)(L.Z,{children:(0,a.jsxs)(T.Z,{children:[(0,a.jsx)(S.Z,{children:"Description"}),(0,a.jsx)(S.Z,{children:"Assertions"}),(0,a.jsx)(S.Z,{children:"Variables"}),(0,a.jsx)(S.Z,{align:"right"})]})}),(0,a.jsx)(P.Z,{children:0===l.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(S.Z,{colSpan:4,align:"center",children:"No test cases added yet."})}):l.map((e,t)=>{var n;return(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>{p(t),h(!0)},children:[(0,a.jsx)(S.Z,{children:(0,a.jsx)(s.Z,{variant:"body2",children:e.description||"Test Case #".concat(t+1)})}),(0,a.jsxs)(S.Z,{children:[(null===(n=e.assert)||void 0===n?void 0:n.length)||0," assertions"]}),(0,a.jsx)(S.Z,{children:Object.entries(e.vars||{}).map(e=>{let[t,n]=e;return t+"="+n}).join(", ")}),(0,a.jsxs)(S.Z,{align:"right",sx:{minWidth:150},children:[(0,a.jsx)(E.Z,{onClick:()=>{p(t),h(!0)},size:"small",children:(0,a.jsx)(R.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>m(e,t),size:"small",children:(0,a.jsx)(z.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>x(e,t),size:"small",children:(0,a.jsx)(W.Z,{})})]})]},t)})})]})}),(0,a.jsx)(Y,{open:u,onAdd:(e,t)=>{if(null===d)o([...l,e]);else{let t=l.map((t,n)=>n===d?e:t);o(t),p(null)}t&&h(!1)},varsList:t,initialValues:null!==d?l[d]:void 0,onCancel:()=>{p(null),h(!1)}})]})},X=n(7827),G=e=>{let{onChange:t,...n}=e,[r,l]=i.useState(""),[s,o]=i.useState(!1);return(0,a.jsx)(C.Z,{...n,error:s,helperText:s?"Invalid JSON":"",value:r,onChange:e=>{let n=e.target.value;try{let e=JSON.parse(n);l(n),o(!1),t&&t(e)}catch(e){l(n),o(!0)}}})},H=e=>{let{open:t,providerId:n,config:l,onClose:s,onSave:c}=e,[h,m]=i.useState(l);return i.useEffect(()=>{m(l)},[l]),(0,a.jsxs)(d.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"md",children:[(0,a.jsxs)(x.Z,{children:["Edit ",n.length>50?n.slice(0,50)+"...":n]}),(0,a.jsx)(u.Z,{children:Object.keys(h).map(e=>{let t;let n=h[e];return"number"==typeof n||"boolean"==typeof n||"string"==typeof n?(t="number"==typeof n?t=>m({...h,[e]:parseFloat(t.target.value)}):"boolean"==typeof n?t=>m({...h,[e]:"true"===t.target.value}):t=>{let n=t.target.value.trim();if(n.startsWith("{")||n.startsWith("["))try{m({...h,[e]:JSON.parse(n)})}catch(t){m({...h,[e]:n})}else"null"===n?m({...h,[e]:null}):"undefined"===n?m({...h,[e]:void 0}):m({...h,[e]:n})},(0,a.jsx)(o.Z,{my:2,children:(0,a.jsx)(C.Z,{label:e,value:n,onChange:t,fullWidth:!0,InputLabelProps:{shrink:!0},type:"number"==typeof n?"number":"text"})},e)):(0,a.jsx)(o.Z,{my:2,children:(0,a.jsx)(G,{label:e,defaultValue:JSON.stringify(n),onChange:t=>{m({...h,[e]:t})},fullWidth:!0,multiline:!0,minRows:2,InputLabelProps:{shrink:!0}})},e)})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:s,children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{c(h)},children:"Save"})]})]})};let M=[].concat(["replicate:replicate/flan-t5-small:69716ad8c34274043bf4a135b7315c7c569ec931d8f23d6826e249e1c142a264"].map(e=>({id:e,config:{temperature:.5,max_length:1024,repetition_penality:1}}))).concat(["replicate:replicate/codellama-7b-instruct:0103579e86fc75ba0d65912890fa19ef03c84a68554635319accf2e0ba93d3ae","replicate:replicate/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b","replicate:replicate/llama-2-70b-chat:2796ee9483c3fd7aa2e171d38f4ca12251a30609463dcfd4cd76703f22e96cdf"].map(e=>({id:e,config:{system_prompt:"",temperature:.75,top_p:.9,top_k:50,max_new_tokens:128,min_new_tokens:-1}}))).concat(["replicate:replicate/codellama-7b:6880b103613a9cd23950c5fd6c140197e519905bd0dd00e448c4858bdd06090a","replicate:replicate/codellama-13b-python:09b87c02dfa403e0c3289166dece62286b3bce49bae39a9c9204713cf94b8b7d","replicate:replicate/codellama-13b:1c914d844307b0588599b8393480a3ba917b660c7e9dfae681542b5325f228db","replicate:replicate/codellama-34b-python:9048743d22a7b19cd0abb018066809ea6af4f2b4717bef9aad3c5ae21ceac00d","replicate:replicate/codellama-34b:0666717e5ead8557dff55ee8f11924b5c0309f5f1ca52f64bb8eec405fdb38a7"].map(e=>({id:e,config:{temperature:.75,top_p:.9,top_k:50,max_new_tokens:128,min_new_tokens:-1}}))).concat(["replicate:a16z-infra/llama-2-7b-chat:7b0bfc9aff140d5b75bacbed23e91fd3c34b01a1e958d32132de6e0a19796e2c","replicate:a16z-infra/llama-2-13b-chat:2a7f981751ec7fdf87b5b91ad4db53683a98082e9ff7bfd12c8cd5ea85980a52"].map(e=>({id:e,config:{temperature:.95,top_p:.95,top_k:250,max_new_tokens:500,min_new_tokens:-1,repetition_penality:1,system_prompt:""}}))).concat(["replicate:mistralai/mistral-7b-v0.1","replicate:mistralai/mistral-7b-instruct-v0.2","replicate:mistralai/mixtral-8x7b-instruct-v0.1"].map(e=>({id:e,config:{temperature:.7,top_p:.9,top_k:-1,max_new_tokens:128,min_new_tokens:-1,repetition_penality:1.15,prompt_template:"{prompt}"}}))).concat(["anthropic:claude-1","anthropic:claude-1-100k","anthropic:claude-instant-1","anthropic:claude-instant-1-100k"].map(e=>({id:e,config:{max_tokens_to_sample:256,temperature:.5}}))).concat(["anthropic:messages:claude-instant-1.2","anthropic:messages:claude-2.0","anthropic:messages:claude-2.1","anthropic:messages:claude-3-haiku-20240307","anthropic:messages:claude-3-sonnet-20240229","anthropic:messages:claude-3-opus-20240229"].map(e=>({id:e,config:{max_tokens:1024,temperature:.5}}))).concat(["bedrock:anthropic.claude-instant-v1","bedrock:anthropic.claude-v1","bedrock:anthropic.claude-v2"].map(e=>({id:e,config:{max_tokens_to_sample:256,temperature:.5}}))).concat(["openai:gpt-3.5-turbo","openai:gpt-3.5-turbo-0301","openai:gpt-3.5-turbo-0613","openai:gpt-3.5-turbo-16k","openai:gpt-3.5-turbo-16k-0613","openai:gpt-4","openai:gpt-4-0314","openai:gpt-4-0613","openai:gpt-4-32k","openai:gpt-4-32k-0314"].map(e=>({id:e,config:{organization:"",temperature:.5,max_tokens:1024,top_p:1,frequency_penalty:0,presence_penalty:0,function_call:void 0,functions:void 0,stop:void 0}}))).concat(["azureopenai:gpt-3.5-turbo","azureopenai:gpt-3.5-turbo-0301","azureopenai:gpt-3.5-turbo-0613","azureopenai:gpt-3.5-turbo-16k","azureopenai:gpt-3.5-turbo-16k-0613","azureopenai:gpt-4","azureopenai:gpt-4-0314","azureopenai:gpt-4-0613","azureopenai:gpt-4-32k","azureopenai:gpt-4-32k-0314"].map(e=>({id:e,config:{temperature:.5,max_tokens:1024,top_p:1,frequency_penalty:0,presence_penalty:0,function_call:void 0,functions:void 0,stop:void 0}}))).concat(["vertex:chat-bison@001","vertex:chat-bison","vertex:chat-bison-32k","vertex:chat-bison-32k@001"].map(e=>({id:e,config:{context:void 0,examples:void 0,temperature:0,maxOutputTokens:1024,topP:.95,topK:40,safetySettings:void 0,stopSequence:void 0}}))).sort((e,t)=>e.id.localeCompare(t.id)),$={anthropic:"Anthropic",bedrock:"Amazon Web Services",azureopenai:"Azure",openai:"OpenAI",replicate:"Replicate"};var Q=e=>{let{providers:t,onChange:n}=e,[r,l]=i.useState(null),s=e=>"string"==typeof e?e:e.id||"Unknown provider",c=(e,t)=>"string"==typeof e?e:e.id||t,d=e=>{"string"==typeof e?alert("Cannot edit custom providers"):e.config?l(e):alert("There is no config for this provider")};return(0,a.jsxs)(o.Z,{mt:2,children:[(0,a.jsx)(B.Z,{multiple:!0,freeSolo:!0,options:M,value:t,groupBy:e=>(function(e){if(!e)return"Other";let t=e.split(":")[0];return $[t]||t})(e.id),onChange:(e,t)=>{n(t.map(e=>"string"==typeof e?{id:e}:e))},getOptionLabel:e=>{if(!e)return"";let t="";"string"==typeof e&&(t=e),e.id&&"string"==typeof e.id&&(t=e.id);let n=t.split(":");return n.length>1?n.length>2&&"anthropic"===n[0]?n[2]:n[1]:"Unknown provider"},renderTags:(e,t)=>e.map((e,n)=>{let a=s(e),r=c(e,n);return(0,i.createElement)(X.Z,{variant:"outlined",label:a,...t({index:n}),key:r,onClick:()=>d(e)})}),renderInput:e=>(0,a.jsx)(C.Z,{...e,variant:"outlined",placeholder:"Select LLM providers",helperText:t.length>0?"Click a provider to configure its settings.":null})}),r&&r.id&&(0,a.jsx)(H,{open:!!r,providerId:r.id,config:r.config,onClose:()=>l(null),onSave:e=>{if(r){let a=t.map(t=>t.id===r.id?{...t,config:e}:t);n(a),l(null)}}})]})},ee=n(2666),et=n.n(ee),en=n(4759);n(5341),n(7555);var ea=n(8339),ei=n(9963),er=n(1396),el=n.n(er);n(695);var es=()=>{let{env:e,setEnv:t,description:n,setDescription:l,providers:c,setProviders:d,prompts:p,setPrompts:u,testCases:h,setTestCases:x,defaultTest:m,setDefaultTest:f,evaluateOptions:g,setEvaluateOptions:v}=(0,j.o)(),[Z,b]=i.useState(""),[y,_]=i.useState(!0);i.useEffect(()=>{b(ea.default.dump({env:e,description:n,providers:c,prompts:p,tests:h,defaultTest:m,evaluateOptions:g}))},[e,n,c,p,h,m,g]);let C=e=>{t(e.env||{}),l(e.description||""),d(e.providers||[]),u(e.prompts||[]),x(e.tests||[]),f(e.defaultTest||{}),v(e.evaluateOptions||{})};return(0,a.jsxs)(o.Z,{mt:4,children:[(0,a.jsx)(s.Z,{variant:"h5",gutterBottom:!0,children:"Configuration"}),(0,a.jsxs)(s.Z,{variant:"body1",gutterBottom:!0,children:["This is the YAML config that defines the evaluation and is processed by promptfoo. See"," ",(0,a.jsx)(el(),{target:"_blank",href:"https://promptfoo.dev/docs/configuration/guide",children:"configuration docs"})," ","to learn more."]}),(0,a.jsx)(r.Z,{variant:"text",color:"primary",startIcon:y?(0,a.jsx)(R.Z,{}):(0,a.jsx)(ei.Z,{}),onClick:()=>{if(!y)try{let e=ea.default.load(Z,{json:!0});C(e)}catch(e){}_(!y)},children:y?"Edit YAML":"Save"}),(0,a.jsx)(et(),{autoCapitalize:"off",value:Z,onValueChange:e=>{y||b(e)},highlight:e=>(0,en.highlight)(e,en.languages.yaml),padding:10,style:{fontFamily:'"Fira code", "Fira Mono", monospace',fontSize:14},disabled:y,className:y?"":"glowing-border"})]})};n(284);var eo=n(7580);function ec(e){let{error:t,resetErrorBoundary:n}=e;return(0,a.jsxs)("div",{role:"alert",children:[(0,a.jsx)("p",{children:"Something went wrong:"}),(0,a.jsx)("pre",{children:t.message}),(0,a.jsx)("button",{onClick:n,children:"Try again"})]})}var ed=()=>{let[e,t]=(0,i.useState)(!1),{description:n,setDescription:f,providers:g,setProviders:v,prompts:b,setPrompts:y,testCases:_,setTestCases:C}=(0,j.o)();if((0,i.useEffect)(()=>{j.o.persist.rehydrate()},[]),eo.env.NEXT_PUBLIC_NO_BROWSING)return null;let k=(e=>{let t=/{{(\w+)}}/g,n=new Set;return e.forEach(e=>{let a;for(;null!==(a=t.exec(e));)n.add(a[1])}),Array.from(n)})(b);return(0,a.jsxs)(l.Z,{maxWidth:"lg",sx:{marginTop:"2rem"},children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h4",children:"Set up an evaluation"}),(0,a.jsxs)(c.Z,{direction:"row",spacing:2,children:[(0,a.jsx)(Z,{}),(0,a.jsx)(A,{}),(0,a.jsx)(r.Z,{variant:"outlined",color:"primary",onClick:()=>t(!0),children:"Reset"})]})]}),(0,a.jsx)(o.Z,{mt:4}),(0,a.jsx)(o.Z,{mt:2,children:(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{v([])},children:(0,a.jsxs)(c.Z,{direction:"column",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Providers"}),(0,a.jsx)(Q,{providers:g,onChange:v})]})})}),(0,a.jsx)(o.Z,{mt:4}),(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{y([])},children:(0,a.jsx)(F,{})}),(0,a.jsx)(o.Z,{mt:6}),(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{C([])},children:(0,a.jsx)(J,{varsList:k})}),(0,a.jsx)(es,{}),(0,a.jsxs)(d.Z,{open:e,onClose:()=>t(!1),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,a.jsx)(x.Z,{id:"alert-dialog-title",children:"Confirm Reset"}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(h.Z,{id:"alert-dialog-description",children:"Are you sure you want to reset all the fields? This action cannot be undone."})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:()=>t(!1),children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{f(""),v([]),y([]),C([]),t(!1)},autoFocus:!0,children:"Reset"})]})]})]})}},279:function(e,t,n){"use strict";n.d(t,{Ox:function(){return r},T8:function(){return i},eA:function(){return l}});var a=n(7580);let i=!a.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,r=!!a.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,l=""},1938:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var a=n(4660),i=n(4810);let r=(0,a.Ue)()((0,i.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},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}),setDefaultTest:t=>e({defaultTest:t}),setEvaluateOptions:t=>e({evaluateOptions:t}),setStateFromConfig:t=>{let n={};t.description&&(n.description=t.description||""),t.tests&&(n.testCases=t.tests),t.providers&&(n.providers=t.providers),t.prompts&&("string"==typeof t.prompts?n.prompts=[t.prompts]:Array.isArray(t.prompts)?n.prompts=t.prompts.filter(e=>!e.endsWith(".txt")&&!e.endsWith(".json")&&!e.endsWith(".yaml")):console.warn("Invalid prompts config",t.prompts)),e(n)},getTestSuite:()=>{let{description:e,testCases:n,providers:a,prompts:i,env:r}=t();return{env:r,description:e,providers:a,prompts:i,tests:n}}}),{name:"promptfoo",skipHydration:!0}))},2280:function(){},695:function(){},284:function(){},5320:function(e,t){"use strict";t.It=void 0,t.It=function(e){let t,n;let a={},i=[],r={};for(let[l,s]of Object.entries(e))l.startsWith("__expected")?""!==s.trim()&&i.push(function(e){if(e.startsWith("javascript:")||e.startsWith("fn:")||e.startsWith("eval:")){let t;e.startsWith("javascript:")&&(t=11),e.startsWith("fn:")&&(t=3),e.startsWith("eval:")&&(t=5);let n=e.slice(t).trim();return{type:"javascript",value:n}}if(e.startsWith("grade:")||e.startsWith("llm-rubric:"))return{type:"llm-rubric",value:e.slice(6)};if(e.startsWith("python:")){let t=e.slice(7).trim();return{type:"python",value:t}}let t=e.match(/^(not-)?(equals|contains-any|contains-all|icontains-any|icontains-all|contains-json|is-json|regex|icontains|contains|webhook|rouge-n|similar|starts-with|levenshtein|classifier|model-graded-factuality|factuality|model-graded-closedqa|answer-relevance|context-recall|context-relevance|context-faithfulness|is-valid-openai-function-call|is-valid-openai-tools-call|latency|perplexity|perplexity-score|cost)(?:\((\d+(?:\.\d+)?)\))?(?::([\s\S]*))?$/);if(t){let[e,n,a,i,r]=t,l=n?`not-${a}`:a,s=parseFloat(i);return"contains-any"===a||"contains-all"===a||"icontains-any"===a||"icontains-all"===a?{type:l,value:r.split(",").map(e=>e.trim())}:"contains-json"===a||"is-json"===a?{type:l,value:r}:"rouge-n"===a||"similar"===a||"starts-with"===a||"levenshtein"===a||"classifier"===a||"answer-relevance"===a||"context-recall"===a||"context-relevance"===a||"context-faithfulness"===a||"latency"===a||"perplexity"===a||"perplexity-score"===a||"cost"===a?{type:l,value:r,threshold:s||("similar"===a?.8:.75)}:{type:l,value:r}}return{type:"equals",value:e}}(s)):"__prefix"===l?r.prefix=s:"__suffix"===l?r.suffix=s:"__description"===l?n=s:"__providerOutput"===l?t=s:a[l]=s;return{vars:a,...t?{providerOutput:t}:{},assert:i,options:r,...n?{description:n}:{}}}}},function(e){e.O(0,[547,602,72,975,414,113,261,339,921,946,971,596,744],function(){return e(e.s=3515)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><link rel="preload" as="font" href="/_next/static/media/0e4fe491bf84089c-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/3a04115668d8070d-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/3a18fc8da1cdcd01-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/627622453ef56b0d-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/699512af39861afa-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/934c4b7cb736f2a3-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/51a17e8edcdfdbb2.css" data-precedence="next"/><link rel="preload" href="/_next/static/chunks/webpack-e02a742b401be2a0.js" as="script"/><link rel="preload" href="/_next/static/chunks/fd9d1056-a95b789c94c05ff6.js" as="script"/><link rel="preload" href="/_next/static/chunks/596-f3a131b7c336dd5d.js" as="script"/><link rel="preload" href="/_next/static/chunks/main-app-581ccf0003955b21.js" as="script"/><title>promptfoo</title><meta name="description" content="LLM testing and evaluation"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta property="og:image" content="https://www.promptfoo.dev/img/thumbnail.png"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://www.promptfoo.dev/img/thumbnail.png"/><meta name="next-size-adjust"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_c5054f"><div><style data-emotion="css jj2ztu">.css-jj2ztu{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}.css-jj2ztu>:not(style):not(style){margin:0;}.css-jj2ztu>:not(style)~:not(style){margin-left:16px;}</style><div class="MuiStack-root nav css-jj2ztu"><div class="logo MuiBox-root css-0"><img alt="Promptfoo logo" loading="lazy" width="25" height="25" decoding="async" data-nimg="1" style="color:transparent" src="/logo.svg"/> <span>promptfoo</span></div><a class="" href="/setup/">New Eval</a><a class="" href="/eval/">Evals</a><a class="" href="/prompts/">Prompts</a><a class="" href="/datasets/">Datasets</a><a class="" href="/progress/">Progress</a><div class="right-aligned"><div class="dark-mode-toggle"><style data-emotion="css vubbuv">.css-vubbuv{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="LightModeIcon"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"></path></svg></div></div></div><div><style data-emotion="css hltdia">.css-hltdia{width:100%;margin-left:auto;box-sizing:border-box;margin-right:auto;display:block;padding-left:16px;padding-right:16px;}@media (min-width:600px){.css-hltdia{padding-left:24px;padding-right:24px;}}@media (min-width:0px){.css-hltdia{max-width:444px;}}</style><main class="MuiContainer-root MuiContainer-maxWidthXs css-hltdia"><style data-emotion="css 1d79rw6">.css-1d79rw6{margin:0;font-family:inherit;font-weight:400;font-size:1.5rem;line-height:1.334;}</style><h1 class="MuiTypography-root MuiTypography-h5 css-1d79rw6">Sign in</h1><form><style data-emotion="css 1u0h3mu">.css-1u0h3mu{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;min-width:0;padding:0;margin:0;border:0;vertical-align:top;margin-top:16px;margin-bottom:8px;width:100%;}</style><div class="MuiFormControl-root MuiFormControl-marginNormal MuiFormControl-fullWidth MuiTextField-root css-1u0h3mu"><style data-emotion="css nd1nwr">.css-nd1nwr{display:block;transform-origin:top left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 24px);position:absolute;left:0;top:0;-webkit-transform:translate(14px, 16px) scale(1);-moz-transform:translate(14px, 16px) scale(1);-ms-transform:translate(14px, 16px) scale(1);transform:translate(14px, 16px) scale(1);-webkit-transition:color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,-webkit-transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;transition:color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;z-index:1;pointer-events:none;}</style><style data-emotion="css jzaigm">.css-jzaigm{color:rgba(0, 0, 0, 0.6);font-family:inherit;font-weight:400;font-size:1rem;line-height:1.4375em;padding:0;position:relative;display:block;transform-origin:top left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 24px);position:absolute;left:0;top:0;-webkit-transform:translate(14px, 16px) scale(1);-moz-transform:translate(14px, 16px) scale(1);-ms-transform:translate(14px, 16px) scale(1);transform:translate(14px, 16px) scale(1);-webkit-transition:color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,-webkit-transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;transition:color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;z-index:1;pointer-events:none;}.css-jzaigm.Mui-focused{color:#1976d2;}.css-jzaigm.Mui-disabled{color:rgba(0, 0, 0, 0.38);}.css-jzaigm.Mui-error{color:#d32f2f;}</style><label class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined MuiFormLabel-colorPrimary Mui-required MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined css-jzaigm" data-shrink="false" for="email" id="email-label">Email Address<style data-emotion="css sp68t1">.css-sp68t1.Mui-error{color:#d32f2f;}</style><span aria-hidden="true" class="MuiFormLabel-asterisk MuiInputLabel-asterisk css-sp68t1"> <!-- -->*</span></label><style data-emotion="css-global 1prfaxn">@-webkit-keyframes mui-auto-fill{from{display:block;}}@keyframes mui-auto-fill{from{display:block;}}@-webkit-keyframes mui-auto-fill-cancel{from{display:block;}}@keyframes mui-auto-fill-cancel{from{display:block;}}</style><style data-emotion="css 18bxsfn">.css-18bxsfn{font-family:inherit;font-weight:400;font-size:1rem;line-height:1.4375em;color:rgba(0, 0, 0, 0.87);box-sizing:border-box;position:relative;cursor:text;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;position:relative;border-radius:4px;}.css-18bxsfn.Mui-disabled{color:rgba(0, 0, 0, 0.38);cursor:default;}.css-18bxsfn:hover .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.87);}@media (hover: none){.css-18bxsfn:hover .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.23);}}.css-18bxsfn.Mui-focused .MuiOutlinedInput-notchedOutline{border-color:#1976d2;border-width:2px;}.css-18bxsfn.Mui-error .MuiOutlinedInput-notchedOutline{border-color:#d32f2f;}.css-18bxsfn.Mui-disabled .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.26);}</style><div class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-18bxsfn"><style data-emotion="css 1x5jdmq">.css-1x5jdmq{font:inherit;letter-spacing:inherit;color:currentColor;padding:4px 0 5px;border:0;box-sizing:content-box;background:none;height:1.4375em;margin:0;-webkit-tap-highlight-color:transparent;display:block;min-width:0;width:100%;-webkit-animation-name:mui-auto-fill-cancel;animation-name:mui-auto-fill-cancel;-webkit-animation-duration:10ms;animation-duration:10ms;padding:16.5px 14px;}.css-1x5jdmq::-webkit-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-1x5jdmq::-moz-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-1x5jdmq:-ms-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-1x5jdmq::-ms-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-1x5jdmq:focus{outline:0;}.css-1x5jdmq:invalid{box-shadow:none;}.css-1x5jdmq::-webkit-search-decoration{-webkit-appearance:none;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq::-webkit-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq::-moz-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:-ms-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq::-ms-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:focus::-webkit-input-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:focus::-moz-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:focus:-ms-input-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:focus::-ms-input-placeholder{opacity:0.42;}.css-1x5jdmq.Mui-disabled{opacity:1;-webkit-text-fill-color:rgba(0, 0, 0, 0.38);}.css-1x5jdmq:-webkit-autofill{-webkit-animation-duration:5000s;animation-duration:5000s;-webkit-animation-name:mui-auto-fill;animation-name:mui-auto-fill;}.css-1x5jdmq:-webkit-autofill{border-radius:inherit;}</style><input aria-invalid="false" autoComplete="email" autofocus="" id="email" required="" type="text" class="MuiInputBase-input MuiOutlinedInput-input css-1x5jdmq" name="email" value=""/><style data-emotion="css 19w1uun">.css-19w1uun{border-color:rgba(0, 0, 0, 0.23);}</style><style data-emotion="css igs3ac">.css-igs3ac{text-align:left;position:absolute;bottom:0;right:0;top:-5px;left:0;margin:0;padding:0 8px;pointer-events:none;border-radius:inherit;border-style:solid;border-width:1px;overflow:hidden;min-width:0%;border-color:rgba(0, 0, 0, 0.23);}</style><fieldset aria-hidden="true" class="MuiOutlinedInput-notchedOutline css-igs3ac"><style data-emotion="css yjsfm1">.css-yjsfm1{float:unset;width:auto;overflow:hidden;display:block;padding:0;height:11px;font-size:0.75em;visibility:hidden;max-width:0.01px;-webkit-transition:max-width 50ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;transition:max-width 50ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;white-space:nowrap;}.css-yjsfm1>span{padding-left:5px;padding-right:5px;display:inline-block;opacity:0;visibility:visible;}</style><legend class="css-yjsfm1"><span>Email Address<!-- --> <!-- -->*</span></legend></fieldset></div></div><div class="MuiFormControl-root MuiFormControl-marginNormal MuiFormControl-fullWidth MuiTextField-root css-1u0h3mu"><label class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined MuiFormLabel-colorPrimary Mui-required MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined css-jzaigm" data-shrink="false" for="password" id="password-label">Password<span aria-hidden="true" class="MuiFormLabel-asterisk MuiInputLabel-asterisk css-sp68t1"> <!-- -->*</span></label><style data-emotion="css-global 1prfaxn">@-webkit-keyframes mui-auto-fill{from{display:block;}}@keyframes mui-auto-fill{from{display:block;}}@-webkit-keyframes mui-auto-fill-cancel{from{display:block;}}@keyframes mui-auto-fill-cancel{from{display:block;}}</style><div class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-18bxsfn"><input aria-invalid="false" autoComplete="current-password" id="password" required="" type="password" class="MuiInputBase-input MuiOutlinedInput-input css-1x5jdmq" name="password" value=""/><fieldset aria-hidden="true" class="MuiOutlinedInput-notchedOutline css-igs3ac"><legend class="css-yjsfm1"><span>Password<!-- --> <!-- -->*</span></legend></fieldset></div></div><style data-emotion="css 1pz372j">.css-1pz372j{font-family:inherit;font-weight:500;font-size:0.875rem;line-height:1.75;text-transform:uppercase;min-width:64px;padding:6px 16px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:#fff;background-color:#1976d2;box-shadow:0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12);width:100%;margin-top:1em;}.css-1pz372j:hover{-webkit-text-decoration:none;text-decoration:none;background-color:#1565c0;box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);}@media (hover: none){.css-1pz372j:hover{background-color:#1976d2;}}.css-1pz372j:active{box-shadow:0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12);}.css-1pz372j.Mui-focusVisible{box-shadow:0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12);}.css-1pz372j.Mui-disabled{color:rgba(0, 0, 0, 0.26);box-shadow:none;background-color:rgba(0, 0, 0, 0.12);}</style><style data-emotion="css 1j0w7x1">.css-1j0w7x1{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;font-family:inherit;font-weight:500;font-size:0.875rem;line-height:1.75;text-transform:uppercase;min-width:64px;padding:6px 16px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:#fff;background-color:#1976d2;box-shadow:0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12);width:100%;margin-top:1em;}.css-1j0w7x1::-moz-focus-inner{border-style:none;}.css-1j0w7x1.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-1j0w7x1{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-1j0w7x1:hover{-webkit-text-decoration:none;text-decoration:none;background-color:#1565c0;box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);}@media (hover: none){.css-1j0w7x1:hover{background-color:#1976d2;}}.css-1j0w7x1:active{box-shadow:0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12);}.css-1j0w7x1.Mui-focusVisible{box-shadow:0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12);}.css-1j0w7x1.Mui-disabled{color:rgba(0, 0, 0, 0.26);box-shadow:none;background-color:rgba(0, 0, 0, 0.12);}</style><button class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-fullWidth MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-fullWidth css-1j0w7x1" tabindex="0" type="submit">Sign In</button><p>Don&#x27;t have an account yet? <a href="/auth/signup/">Sign up</a></p></form></main></div></div><script src="/_next/static/chunks/webpack-e02a742b401be2a0.js" async=""></script><script src="/_next/static/chunks/fd9d1056-a95b789c94c05ff6.js" async=""></script><script src="/_next/static/chunks/596-f3a131b7c336dd5d.js" async=""></script><script src="/_next/static/chunks/main-app-581ccf0003955b21.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/media/0e4fe491bf84089c-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/media/3a04115668d8070d-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n3:HL[\"/_next/static/media/3a18fc8da1cdcd01-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n4:HL[\"/_next/static/media/627622453ef56b0d-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n5:HL[\"/_next/static/media/699512af39861afa-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n6:HL[\"/_next/static/media/934c4b7cb736f2a3-s.p.woff2\",{\"as\":\"font\","])</script><script>self.__next_f.push([1,"\"type\":\"font/woff2\"}]\n7:HL[\"/_next/static/css/51a17e8edcdfdbb2.css\",{\"as\":\"style\"}]\n0:\"$L8\"\n"])</script><script>self.__next_f.push([1,"9:I{\"id\":7948,\"chunks\":[\"272:static/chunks/webpack-e02a742b401be2a0.js\",\"971:static/chunks/fd9d1056-a95b789c94c05ff6.js\",\"596:static/chunks/596-f3a131b7c336dd5d.js\"],\"name\":\"default\",\"async\":false}\nb:I{\"id\":6628,\"chunks\":[\"272:static/chunks/webpack-e02a742b401be2a0.js\",\"971:static/chunks/fd9d1056-a95b789c94c05ff6.js\",\"596:static/chunks/596-f3a131b7c336dd5d.js\"],\"name\":\"\",\"async\":false}\nc:I{\"id\":2112,\"chunks\":[\"547:static/chunks/547-00556ed98de9671b.js\",\"72:static/chunks/72-202cb66305c1995a.js\",\"680:static/c"])</script><script>self.__next_f.push([1,"hunks/680-aa07f4d4d0312894.js\",\"864:static/chunks/864-406abb9f68cff6a3.js\",\"185:static/chunks/app/layout-0afd14c99b2fc9eb.js\"],\"name\":\"PageShell\",\"async\":false}\nd:I{\"id\":7767,\"chunks\":[\"272:static/chunks/webpack-e02a742b401be2a0.js\",\"971:static/chunks/fd9d1056-a95b789c94c05ff6.js\",\"596:static/chunks/596-f3a131b7c336dd5d.js\"],\"name\":\"default\",\"async\":false}\ne:I{\"id\":7920,\"chunks\":[\"272:static/chunks/webpack-e02a742b401be2a0.js\",\"971:static/chunks/fd9d1056-a95b789c94c05ff6.js\",\"596:static/chunks/596-f3a131b7c"])</script><script>self.__next_f.push([1,"336dd5d.js\"],\"name\":\"default\",\"async\":false}\n10:I{\"id\":6722,\"chunks\":[\"547:static/chunks/547-00556ed98de9671b.js\",\"602:static/chunks/602-fce79bd3bd7891e9.js\",\"72:static/chunks/72-202cb66305c1995a.js\",\"975:static/chunks/975-41f6ad20b4031b30.js\",\"680:static/chunks/680-aa07f4d4d0312894.js\",\"716:static/chunks/app/auth/login/page-2daaaf4e1f6912b3.js\"],\"name\":\"\",\"async\":false}\n"])</script><script>self.__next_f.push([1,"8:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/51a17e8edcdfdbb2.css\",\"precedence\":\"next\"}]],[\"$\",\"$L9\",null,{\"buildId\":\"C1CVMf9gtZLc_4C6z7Oy8\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/auth/login/\",\"initialTree\":[\"\",{\"children\":[\"auth\",{\"children\":[\"login\",{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialHead\":\"$La\",\"globalErrorComponent\":\"$b\",\"children\":[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_c5054f\",\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"hasLoading\":false,\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":\"$undefined\",\"childProp\":{\"current\":[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"auth\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"hasLoading\":false,\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"childProp\":{\"current\":[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"auth\",\"children\",\"login\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"hasLoading\":false,\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"childProp\":{\"current\":[\"$Lf\",[\"$\",\"$L10\",null,{}],null],\"segment\":\"__PAGE__\"},\"styles\":[]}],\"segment\":\"login\"},\"styles\":[]}],\"segment\":\"auth\"},\"styles\":[]}]}]}]}],null]}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"1\",{\"children\":\"promptfoo\"}],[\"$\",\"meta\",\"2\",{\"name\":\"description\",\"content\":\"LLM testing and evaluation\"}],[\"$\",\"meta\",\"3\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"4\",{\"property\":\"og:image\",\"content\":\"https://www.promptfoo.dev/img/thumbnail.png\"}],[\"$\",\"meta\",\"5\",{\"name\":\"twitter:card\",\"content\":\"summary\"}],[\"$\",\"meta\",\"6\",{\"name\":\"twitter:image\",\"content\":\"https://www.promptfoo.dev/img/thumbnail.png\"}],[\"$\",\"meta\",\"7\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"f:null\n"])</script></body></html>
1
+ <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><link rel="preload" as="font" href="/_next/static/media/0e4fe491bf84089c-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/3a04115668d8070d-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/3a18fc8da1cdcd01-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/627622453ef56b0d-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/699512af39861afa-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="preload" as="font" href="/_next/static/media/934c4b7cb736f2a3-s.p.woff2" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/51a17e8edcdfdbb2.css" data-precedence="next"/><link rel="preload" href="/_next/static/chunks/webpack-e02a742b401be2a0.js" as="script"/><link rel="preload" href="/_next/static/chunks/fd9d1056-a95b789c94c05ff6.js" as="script"/><link rel="preload" href="/_next/static/chunks/596-f3a131b7c336dd5d.js" as="script"/><link rel="preload" href="/_next/static/chunks/main-app-581ccf0003955b21.js" as="script"/><title>promptfoo</title><meta name="description" content="LLM testing and evaluation"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta property="og:image" content="https://www.promptfoo.dev/img/thumbnail.png"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://www.promptfoo.dev/img/thumbnail.png"/><meta name="next-size-adjust"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_c5054f"><div><style data-emotion="css jj2ztu">.css-jj2ztu{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}.css-jj2ztu>:not(style):not(style){margin:0;}.css-jj2ztu>:not(style)~:not(style){margin-left:16px;}</style><div class="MuiStack-root nav css-jj2ztu"><div class="logo MuiBox-root css-0"><img alt="Promptfoo logo" loading="lazy" width="25" height="25" decoding="async" data-nimg="1" style="color:transparent" src="/logo.svg"/> <span>promptfoo</span></div><a class="" href="/setup/">New Eval</a><a class="" href="/eval/">Evals</a><a class="" href="/prompts/">Prompts</a><a class="" href="/datasets/">Datasets</a><a class="" href="/progress/">Progress</a><div class="right-aligned"><div class="dark-mode-toggle"><style data-emotion="css vubbuv">.css-vubbuv{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="LightModeIcon"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"></path></svg></div></div></div><div><style data-emotion="css hltdia">.css-hltdia{width:100%;margin-left:auto;box-sizing:border-box;margin-right:auto;display:block;padding-left:16px;padding-right:16px;}@media (min-width:600px){.css-hltdia{padding-left:24px;padding-right:24px;}}@media (min-width:0px){.css-hltdia{max-width:444px;}}</style><main class="MuiContainer-root MuiContainer-maxWidthXs css-hltdia"><style data-emotion="css 1d79rw6">.css-1d79rw6{margin:0;font-family:inherit;font-weight:400;font-size:1.5rem;line-height:1.334;}</style><h1 class="MuiTypography-root MuiTypography-h5 css-1d79rw6">Sign in</h1><form><style data-emotion="css 1u0h3mu">.css-1u0h3mu{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;min-width:0;padding:0;margin:0;border:0;vertical-align:top;margin-top:16px;margin-bottom:8px;width:100%;}</style><div class="MuiFormControl-root MuiFormControl-marginNormal MuiFormControl-fullWidth MuiTextField-root css-1u0h3mu"><style data-emotion="css nd1nwr">.css-nd1nwr{display:block;transform-origin:top left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 24px);position:absolute;left:0;top:0;-webkit-transform:translate(14px, 16px) scale(1);-moz-transform:translate(14px, 16px) scale(1);-ms-transform:translate(14px, 16px) scale(1);transform:translate(14px, 16px) scale(1);-webkit-transition:color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,-webkit-transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;transition:color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;z-index:1;pointer-events:none;}</style><style data-emotion="css jzaigm">.css-jzaigm{color:rgba(0, 0, 0, 0.6);font-family:inherit;font-weight:400;font-size:1rem;line-height:1.4375em;padding:0;position:relative;display:block;transform-origin:top left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 24px);position:absolute;left:0;top:0;-webkit-transform:translate(14px, 16px) scale(1);-moz-transform:translate(14px, 16px) scale(1);-ms-transform:translate(14px, 16px) scale(1);transform:translate(14px, 16px) scale(1);-webkit-transition:color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,-webkit-transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;transition:color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms,max-width 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;z-index:1;pointer-events:none;}.css-jzaigm.Mui-focused{color:#1976d2;}.css-jzaigm.Mui-disabled{color:rgba(0, 0, 0, 0.38);}.css-jzaigm.Mui-error{color:#d32f2f;}</style><label class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined MuiFormLabel-colorPrimary Mui-required MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined css-jzaigm" data-shrink="false" for="email" id="email-label">Email Address<style data-emotion="css sp68t1">.css-sp68t1.Mui-error{color:#d32f2f;}</style><span aria-hidden="true" class="MuiFormLabel-asterisk MuiInputLabel-asterisk css-sp68t1"> <!-- -->*</span></label><style data-emotion="css-global 1prfaxn">@-webkit-keyframes mui-auto-fill{from{display:block;}}@keyframes mui-auto-fill{from{display:block;}}@-webkit-keyframes mui-auto-fill-cancel{from{display:block;}}@keyframes mui-auto-fill-cancel{from{display:block;}}</style><style data-emotion="css 18bxsfn">.css-18bxsfn{font-family:inherit;font-weight:400;font-size:1rem;line-height:1.4375em;color:rgba(0, 0, 0, 0.87);box-sizing:border-box;position:relative;cursor:text;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;position:relative;border-radius:4px;}.css-18bxsfn.Mui-disabled{color:rgba(0, 0, 0, 0.38);cursor:default;}.css-18bxsfn:hover .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.87);}@media (hover: none){.css-18bxsfn:hover .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.23);}}.css-18bxsfn.Mui-focused .MuiOutlinedInput-notchedOutline{border-color:#1976d2;border-width:2px;}.css-18bxsfn.Mui-error .MuiOutlinedInput-notchedOutline{border-color:#d32f2f;}.css-18bxsfn.Mui-disabled .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.26);}</style><div class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-18bxsfn"><style data-emotion="css 1x5jdmq">.css-1x5jdmq{font:inherit;letter-spacing:inherit;color:currentColor;padding:4px 0 5px;border:0;box-sizing:content-box;background:none;height:1.4375em;margin:0;-webkit-tap-highlight-color:transparent;display:block;min-width:0;width:100%;-webkit-animation-name:mui-auto-fill-cancel;animation-name:mui-auto-fill-cancel;-webkit-animation-duration:10ms;animation-duration:10ms;padding:16.5px 14px;}.css-1x5jdmq::-webkit-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-1x5jdmq::-moz-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-1x5jdmq:-ms-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-1x5jdmq::-ms-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-1x5jdmq:focus{outline:0;}.css-1x5jdmq:invalid{box-shadow:none;}.css-1x5jdmq::-webkit-search-decoration{-webkit-appearance:none;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq::-webkit-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq::-moz-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:-ms-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq::-ms-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:focus::-webkit-input-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:focus::-moz-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:focus:-ms-input-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-1x5jdmq:focus::-ms-input-placeholder{opacity:0.42;}.css-1x5jdmq.Mui-disabled{opacity:1;-webkit-text-fill-color:rgba(0, 0, 0, 0.38);}.css-1x5jdmq:-webkit-autofill{-webkit-animation-duration:5000s;animation-duration:5000s;-webkit-animation-name:mui-auto-fill;animation-name:mui-auto-fill;}.css-1x5jdmq:-webkit-autofill{border-radius:inherit;}</style><input aria-invalid="false" autoComplete="email" autofocus="" id="email" required="" type="text" class="MuiInputBase-input MuiOutlinedInput-input css-1x5jdmq" name="email" value=""/><style data-emotion="css 19w1uun">.css-19w1uun{border-color:rgba(0, 0, 0, 0.23);}</style><style data-emotion="css igs3ac">.css-igs3ac{text-align:left;position:absolute;bottom:0;right:0;top:-5px;left:0;margin:0;padding:0 8px;pointer-events:none;border-radius:inherit;border-style:solid;border-width:1px;overflow:hidden;min-width:0%;border-color:rgba(0, 0, 0, 0.23);}</style><fieldset aria-hidden="true" class="MuiOutlinedInput-notchedOutline css-igs3ac"><style data-emotion="css yjsfm1">.css-yjsfm1{float:unset;width:auto;overflow:hidden;display:block;padding:0;height:11px;font-size:0.75em;visibility:hidden;max-width:0.01px;-webkit-transition:max-width 50ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;transition:max-width 50ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;white-space:nowrap;}.css-yjsfm1>span{padding-left:5px;padding-right:5px;display:inline-block;opacity:0;visibility:visible;}</style><legend class="css-yjsfm1"><span>Email Address<!-- --> <!-- -->*</span></legend></fieldset></div></div><div class="MuiFormControl-root MuiFormControl-marginNormal MuiFormControl-fullWidth MuiTextField-root css-1u0h3mu"><label class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined MuiFormLabel-colorPrimary Mui-required MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined css-jzaigm" data-shrink="false" for="password" id="password-label">Password<span aria-hidden="true" class="MuiFormLabel-asterisk MuiInputLabel-asterisk css-sp68t1"> <!-- -->*</span></label><style data-emotion="css-global 1prfaxn">@-webkit-keyframes mui-auto-fill{from{display:block;}}@keyframes mui-auto-fill{from{display:block;}}@-webkit-keyframes mui-auto-fill-cancel{from{display:block;}}@keyframes mui-auto-fill-cancel{from{display:block;}}</style><div class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-18bxsfn"><input aria-invalid="false" autoComplete="current-password" id="password" required="" type="password" class="MuiInputBase-input MuiOutlinedInput-input css-1x5jdmq" name="password" value=""/><fieldset aria-hidden="true" class="MuiOutlinedInput-notchedOutline css-igs3ac"><legend class="css-yjsfm1"><span>Password<!-- --> <!-- -->*</span></legend></fieldset></div></div><style data-emotion="css 1pz372j">.css-1pz372j{font-family:inherit;font-weight:500;font-size:0.875rem;line-height:1.75;text-transform:uppercase;min-width:64px;padding:6px 16px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:#fff;background-color:#1976d2;box-shadow:0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12);width:100%;margin-top:1em;}.css-1pz372j:hover{-webkit-text-decoration:none;text-decoration:none;background-color:#1565c0;box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);}@media (hover: none){.css-1pz372j:hover{background-color:#1976d2;}}.css-1pz372j:active{box-shadow:0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12);}.css-1pz372j.Mui-focusVisible{box-shadow:0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12);}.css-1pz372j.Mui-disabled{color:rgba(0, 0, 0, 0.26);box-shadow:none;background-color:rgba(0, 0, 0, 0.12);}</style><style data-emotion="css 1j0w7x1">.css-1j0w7x1{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;font-family:inherit;font-weight:500;font-size:0.875rem;line-height:1.75;text-transform:uppercase;min-width:64px;padding:6px 16px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:#fff;background-color:#1976d2;box-shadow:0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12);width:100%;margin-top:1em;}.css-1j0w7x1::-moz-focus-inner{border-style:none;}.css-1j0w7x1.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-1j0w7x1{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-1j0w7x1:hover{-webkit-text-decoration:none;text-decoration:none;background-color:#1565c0;box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);}@media (hover: none){.css-1j0w7x1:hover{background-color:#1976d2;}}.css-1j0w7x1:active{box-shadow:0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12);}.css-1j0w7x1.Mui-focusVisible{box-shadow:0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12);}.css-1j0w7x1.Mui-disabled{color:rgba(0, 0, 0, 0.26);box-shadow:none;background-color:rgba(0, 0, 0, 0.12);}</style><button class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-fullWidth MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-fullWidth css-1j0w7x1" tabindex="0" type="submit">Sign In</button><p>Don&#x27;t have an account yet? <a href="/auth/signup/">Sign up</a></p></form></main></div></div><script src="/_next/static/chunks/webpack-e02a742b401be2a0.js" async=""></script><script src="/_next/static/chunks/fd9d1056-a95b789c94c05ff6.js" async=""></script><script src="/_next/static/chunks/596-f3a131b7c336dd5d.js" async=""></script><script src="/_next/static/chunks/main-app-581ccf0003955b21.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/media/0e4fe491bf84089c-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/media/3a04115668d8070d-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n3:HL[\"/_next/static/media/3a18fc8da1cdcd01-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n4:HL[\"/_next/static/media/627622453ef56b0d-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n5:HL[\"/_next/static/media/699512af39861afa-s.p.woff2\",{\"as\":\"font\",\"type\":\"font/woff2\"}]\n6:HL[\"/_next/static/media/934c4b7cb736f2a3-s.p.woff2\",{\"as\":\"font\","])</script><script>self.__next_f.push([1,"\"type\":\"font/woff2\"}]\n7:HL[\"/_next/static/css/51a17e8edcdfdbb2.css\",{\"as\":\"style\"}]\n0:\"$L8\"\n"])</script><script>self.__next_f.push([1,"9:I{\"id\":7948,\"chunks\":[\"272:static/chunks/webpack-e02a742b401be2a0.js\",\"971:static/chunks/fd9d1056-a95b789c94c05ff6.js\",\"596:static/chunks/596-f3a131b7c336dd5d.js\"],\"name\":\"default\",\"async\":false}\nb:I{\"id\":6628,\"chunks\":[\"272:static/chunks/webpack-e02a742b401be2a0.js\",\"971:static/chunks/fd9d1056-a95b789c94c05ff6.js\",\"596:static/chunks/596-f3a131b7c336dd5d.js\"],\"name\":\"\",\"async\":false}\nc:I{\"id\":2112,\"chunks\":[\"547:static/chunks/547-00556ed98de9671b.js\",\"72:static/chunks/72-202cb66305c1995a.js\",\"680:static/c"])</script><script>self.__next_f.push([1,"hunks/680-aa07f4d4d0312894.js\",\"864:static/chunks/864-406abb9f68cff6a3.js\",\"185:static/chunks/app/layout-0afd14c99b2fc9eb.js\"],\"name\":\"PageShell\",\"async\":false}\nd:I{\"id\":7767,\"chunks\":[\"272:static/chunks/webpack-e02a742b401be2a0.js\",\"971:static/chunks/fd9d1056-a95b789c94c05ff6.js\",\"596:static/chunks/596-f3a131b7c336dd5d.js\"],\"name\":\"default\",\"async\":false}\ne:I{\"id\":7920,\"chunks\":[\"272:static/chunks/webpack-e02a742b401be2a0.js\",\"971:static/chunks/fd9d1056-a95b789c94c05ff6.js\",\"596:static/chunks/596-f3a131b7c"])</script><script>self.__next_f.push([1,"336dd5d.js\"],\"name\":\"default\",\"async\":false}\n10:I{\"id\":6722,\"chunks\":[\"547:static/chunks/547-00556ed98de9671b.js\",\"602:static/chunks/602-fce79bd3bd7891e9.js\",\"72:static/chunks/72-202cb66305c1995a.js\",\"975:static/chunks/975-41f6ad20b4031b30.js\",\"680:static/chunks/680-aa07f4d4d0312894.js\",\"716:static/chunks/app/auth/login/page-2daaaf4e1f6912b3.js\"],\"name\":\"\",\"async\":false}\n"])</script><script>self.__next_f.push([1,"8:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/51a17e8edcdfdbb2.css\",\"precedence\":\"next\"}]],[\"$\",\"$L9\",null,{\"buildId\":\"3HpbHMqtYmi39VCixO04u\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/auth/login/\",\"initialTree\":[\"\",{\"children\":[\"auth\",{\"children\":[\"login\",{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialHead\":\"$La\",\"globalErrorComponent\":\"$b\",\"children\":[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_c5054f\",\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"hasLoading\":false,\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":\"$undefined\",\"childProp\":{\"current\":[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"auth\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"hasLoading\":false,\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"childProp\":{\"current\":[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"auth\",\"children\",\"login\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"hasLoading\":false,\"template\":[\"$\",\"$Le\",null,{}],\"templateStyles\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"childProp\":{\"current\":[\"$Lf\",[\"$\",\"$L10\",null,{}],null],\"segment\":\"__PAGE__\"},\"styles\":[]}],\"segment\":\"login\"},\"styles\":[]}],\"segment\":\"auth\"},\"styles\":[]}]}]}]}],null]}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"1\",{\"children\":\"promptfoo\"}],[\"$\",\"meta\",\"2\",{\"name\":\"description\",\"content\":\"LLM testing and evaluation\"}],[\"$\",\"meta\",\"3\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"4\",{\"property\":\"og:image\",\"content\":\"https://www.promptfoo.dev/img/thumbnail.png\"}],[\"$\",\"meta\",\"5\",{\"name\":\"twitter:card\",\"content\":\"summary\"}],[\"$\",\"meta\",\"6\",{\"name\":\"twitter:image\",\"content\":\"https://www.promptfoo.dev/img/thumbnail.png\"}],[\"$\",\"meta\",\"7\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"f:null\n"])</script></body></html>
@@ -5,7 +5,7 @@
5
5
  5:HL["/_next/static/media/699512af39861afa-s.p.woff2",{"as":"font","type":"font/woff2"}]
6
6
  6:HL["/_next/static/media/934c4b7cb736f2a3-s.p.woff2",{"as":"font","type":"font/woff2"}]
7
7
  7:HL["/_next/static/css/51a17e8edcdfdbb2.css",{"as":"style"}]
8
- 0:["C1CVMf9gtZLc_4C6z7Oy8",[[["",{"children":["auth",{"children":["login",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],"$L8",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/51a17e8edcdfdbb2.css","precedence":"next"}]],"$L9"]]]]
8
+ 0:["3HpbHMqtYmi39VCixO04u",[[["",{"children":["auth",{"children":["login",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],"$L8",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/51a17e8edcdfdbb2.css","precedence":"next"}]],"$L9"]]]]
9
9
  a:I{"id":2112,"chunks":["547:static/chunks/547-00556ed98de9671b.js","72:static/chunks/72-202cb66305c1995a.js","680:static/chunks/680-aa07f4d4d0312894.js","864:static/chunks/864-406abb9f68cff6a3.js","185:static/chunks/app/layout-0afd14c99b2fc9eb.js"],"name":"PageShell","async":false}
10
10
  b:I{"id":7767,"chunks":["272:static/chunks/webpack-e02a742b401be2a0.js","971:static/chunks/fd9d1056-a95b789c94c05ff6.js","596:static/chunks/596-f3a131b7c336dd5d.js"],"name":"default","async":false}
11
11
  c:I{"id":7920,"chunks":["272:static/chunks/webpack-e02a742b401be2a0.js","971:static/chunks/fd9d1056-a95b789c94c05ff6.js","596:static/chunks/596-f3a131b7c336dd5d.js"],"name":"default","async":false}