promptfoo 0.68.3 → 0.69.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 (169) hide show
  1. package/dist/drizzle/0002_tidy_juggernaut.sql +1 -0
  2. package/dist/drizzle/meta/0002_snapshot.json +244 -0
  3. package/dist/drizzle/meta/_journal.json +7 -0
  4. package/dist/package.json +2 -2
  5. package/dist/src/accounts.d.ts +2 -1
  6. package/dist/src/accounts.d.ts.map +1 -1
  7. package/dist/src/accounts.js +6 -2
  8. package/dist/src/accounts.js.map +1 -1
  9. package/dist/src/commands/eval/filterProviders.d.ts +3 -0
  10. package/dist/src/commands/eval/filterProviders.d.ts.map +1 -0
  11. package/dist/src/commands/eval/filterProviders.js +16 -0
  12. package/dist/src/commands/eval/filterProviders.js.map +1 -0
  13. package/dist/src/commands/import.d.ts.map +1 -1
  14. package/dist/src/commands/import.js +1 -0
  15. package/dist/src/commands/import.js.map +1 -1
  16. package/dist/src/commands/show.js +2 -2
  17. package/dist/src/commands/show.js.map +1 -1
  18. package/dist/src/database.d.ts +12 -0
  19. package/dist/src/database.d.ts.map +1 -1
  20. package/dist/src/database.js +1 -0
  21. package/dist/src/database.js.map +1 -1
  22. package/dist/src/main.js +3 -0
  23. package/dist/src/main.js.map +1 -1
  24. package/dist/src/matchers.d.ts.map +1 -1
  25. package/dist/src/matchers.js +3 -1
  26. package/dist/src/matchers.js.map +1 -1
  27. package/dist/src/prompts/grading.d.ts +1 -0
  28. package/dist/src/prompts/grading.d.ts.map +1 -1
  29. package/dist/src/prompts/grading.js +21 -1
  30. package/dist/src/prompts/grading.js.map +1 -1
  31. package/dist/src/providers/anthropic.d.ts +5 -0
  32. package/dist/src/providers/anthropic.d.ts.map +1 -1
  33. package/dist/src/providers/anthropic.js +55 -1
  34. package/dist/src/providers/anthropic.js.map +1 -1
  35. package/dist/src/providers/defaults.d.ts +3 -0
  36. package/dist/src/providers/defaults.d.ts.map +1 -1
  37. package/dist/src/providers/defaults.js +1 -0
  38. package/dist/src/providers/defaults.js.map +1 -1
  39. package/dist/src/redteam/getHarmfulTests.js +2 -2
  40. package/dist/src/redteam/getHarmfulTests.js.map +1 -1
  41. package/dist/src/redteam/getUnderconfidenceTests.js +1 -1
  42. package/dist/src/redteam/getUnderconfidenceTests.js.map +1 -1
  43. package/dist/src/redteam/index.d.ts.map +1 -1
  44. package/dist/src/redteam/index.js +25 -6
  45. package/dist/src/redteam/index.js.map +1 -1
  46. package/dist/src/redteam/iterative.d.ts.map +1 -1
  47. package/dist/src/redteam/iterative.js +15 -2
  48. package/dist/src/redteam/iterative.js.map +1 -1
  49. package/dist/src/share.d.ts.map +1 -1
  50. package/dist/src/share.js +3 -1
  51. package/dist/src/share.js.map +1 -1
  52. package/dist/src/types.d.ts +2 -0
  53. package/dist/src/types.d.ts.map +1 -1
  54. package/dist/src/types.js.map +1 -1
  55. package/dist/src/util.d.ts.map +1 -1
  56. package/dist/src/util.js +19 -7
  57. package/dist/src/util.js.map +1 -1
  58. package/dist/src/web/nextui/404/index.html +1 -1
  59. package/dist/src/web/nextui/404.html +1 -1
  60. package/dist/src/web/nextui/_next/static/chunks/2-57ab5e84907f795a.js +1 -0
  61. package/dist/src/web/nextui/_next/static/chunks/{540-378a20144435cec6.js → 540-c94eb8fa0d9db136.js} +1 -1
  62. package/dist/src/web/nextui/_next/static/chunks/{166-157bfb431b68d949.js → 858-5d3a3678769b7e36.js} +1 -1
  63. package/dist/src/web/nextui/_next/static/chunks/954-58788165fb1e9563.js +6 -0
  64. package/dist/src/web/nextui/_next/static/chunks/{897-1955b232a2148365.js → 998-d370cd9f4473ff31.js} +4 -4
  65. package/dist/src/web/nextui/_next/static/chunks/app/auth/login/{page-6fcc9431205718c7.js → page-ee73165dd261f3ca.js} +1 -1
  66. package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/{page-8caf49a834d34420.js → page-7375a6707eb8675e.js} +1 -1
  67. package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-c11cfb1b2c58325f.js +1 -0
  68. package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-50073ee4b153b82b.js +1 -0
  69. package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/{page-0a71ecaf651124c2.js → page-310e2e58179970fa.js} +1 -1
  70. package/dist/src/web/nextui/_next/static/chunks/app/eval/page-87d1e9bc26842e95.js +1 -0
  71. package/dist/src/web/nextui/_next/static/chunks/app/{layout-b7b366d291dbc9db.js → layout-eb2c3e6b0b7cca53.js} +1 -1
  72. package/dist/src/web/nextui/_next/static/chunks/app/{page-e07a0ddbf3d6e21c.js → page-251d4ea0ac894cd9.js} +1 -1
  73. package/dist/src/web/nextui/_next/static/chunks/app/progress/page-15df1d043dee2f17.js +1 -0
  74. package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-6d29c01079a556f4.js +1 -0
  75. package/dist/src/web/nextui/_next/static/chunks/app/report/{page-a0a68795eb905dcc.js → page-49d3492c635a81f5.js} +1 -1
  76. package/dist/src/web/nextui/_next/static/chunks/app/setup/{page-71b3060b06865254.js → page-8774494ce5143c0b.js} +1 -1
  77. package/dist/src/web/nextui/_next/static/chunks/{main-app-929a26b3c8cd3f7a.js → main-app-345c3eca7e5cf432.js} +1 -1
  78. package/dist/src/web/nextui/_next/static/chunks/webpack-8a9bc9ee0defb756.js +1 -0
  79. package/dist/src/web/nextui/_next/static/css/106779eb64615639.css +1 -0
  80. package/dist/src/web/nextui/_next/static/css/35ab7ce8025438b0.css +1 -0
  81. package/dist/src/web/nextui/_next/static/css/94b771e23fc5d5f5.css +1 -0
  82. package/dist/src/web/nextui/_next/static/media/05a31a2ca4975f99-s.woff2 +0 -0
  83. package/dist/src/web/nextui/_next/static/media/513657b02c5c193f-s.woff2 +0 -0
  84. package/dist/src/web/nextui/_next/static/media/51ed15f9841b9f9d-s.woff2 +0 -0
  85. package/dist/src/web/nextui/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2 +0 -0
  86. package/dist/src/web/nextui/_next/static/media/d6b16ce4a6175f26-s.woff2 +0 -0
  87. package/dist/src/web/nextui/_next/static/media/ec159349637c90ad-s.woff2 +0 -0
  88. package/dist/src/web/nextui/_next/static/media/fd4db3eb5472fc27-s.woff2 +0 -0
  89. package/dist/src/web/nextui/auth/login/index.html +1 -1
  90. package/dist/src/web/nextui/auth/login/index.txt +10 -15
  91. package/dist/src/web/nextui/auth/signup/index.html +1 -1
  92. package/dist/src/web/nextui/auth/signup/index.txt +10 -15
  93. package/dist/src/web/nextui/datasets/index.html +1 -1
  94. package/dist/src/web/nextui/datasets/index.txt +10 -15
  95. package/dist/src/web/nextui/eval/index.html +1 -1
  96. package/dist/src/web/nextui/eval/index.txt +12 -17
  97. package/dist/src/web/nextui/index.html +1 -1
  98. package/dist/src/web/nextui/index.txt +11 -16
  99. package/dist/src/web/nextui/progress/index.html +1 -1
  100. package/dist/src/web/nextui/progress/index.txt +10 -15
  101. package/dist/src/web/nextui/prompts/index.html +1 -1
  102. package/dist/src/web/nextui/prompts/index.txt +10 -15
  103. package/dist/src/web/nextui/report/index.html +1 -1
  104. package/dist/src/web/nextui/report/index.txt +12 -17
  105. package/dist/src/web/nextui/setup/index.html +2 -2
  106. package/dist/src/web/nextui/setup/index.txt +12 -17
  107. package/package.json +2 -2
  108. package/dist/src/web/nextui/_next/static/chunks/2-d534f7b3af3e0505.js +0 -1
  109. package/dist/src/web/nextui/_next/static/chunks/954-c35d4864ecbacd62.js +0 -6
  110. package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-4f93aacd25866d60.js +0 -1
  111. package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-ce320e6d1e6d1d23.js +0 -1
  112. package/dist/src/web/nextui/_next/static/chunks/app/eval/page-bf3968ed106645c6.js +0 -1
  113. package/dist/src/web/nextui/_next/static/chunks/app/progress/page-52079a97d0c2e2ea.js +0 -1
  114. package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-7da4796409bc2636.js +0 -1
  115. package/dist/src/web/nextui/_next/static/chunks/webpack-ac7a3125017b92ed.js +0 -1
  116. package/dist/src/web/nextui/_next/static/css/036bf4af64e53e86.css +0 -1
  117. package/dist/src/web/nextui/_next/static/css/b76f1739b5a14901.css +0 -1
  118. package/dist/src/web/nextui/_next/static/css/e141e895af3747c6.css +0 -1
  119. package/dist/src/web/nextui/_next/static/media/03b685511c0eaac3-s.woff2 +0 -0
  120. package/dist/src/web/nextui/_next/static/media/04fe87c30c4f76ea-s.woff2 +0 -0
  121. package/dist/src/web/nextui/_next/static/media/0e4fe491bf84089c-s.p.woff2 +0 -0
  122. package/dist/src/web/nextui/_next/static/media/101c7b68f2d8b610-s.woff2 +0 -0
  123. package/dist/src/web/nextui/_next/static/media/13259ce60de2aa3e-s.woff2 +0 -0
  124. package/dist/src/web/nextui/_next/static/media/1c57ca6f5208a29b-s.woff2 +0 -0
  125. package/dist/src/web/nextui/_next/static/media/1e8103c5d17beb1d-s.woff2 +0 -0
  126. package/dist/src/web/nextui/_next/static/media/388fb79562c9fc54-s.woff2 +0 -0
  127. package/dist/src/web/nextui/_next/static/media/3a04115668d8070d-s.p.woff2 +0 -0
  128. package/dist/src/web/nextui/_next/static/media/3a18fc8da1cdcd01-s.p.woff2 +0 -0
  129. package/dist/src/web/nextui/_next/static/media/3dbd163d3bb09d47-s.woff2 +0 -0
  130. package/dist/src/web/nextui/_next/static/media/42d52f46a26971a3-s.woff2 +0 -0
  131. package/dist/src/web/nextui/_next/static/media/5647e4c23315a2d2-s.woff2 +0 -0
  132. package/dist/src/web/nextui/_next/static/media/5f4dfe83faee04f1-s.woff2 +0 -0
  133. package/dist/src/web/nextui/_next/static/media/627622453ef56b0d-s.p.woff2 +0 -0
  134. package/dist/src/web/nextui/_next/static/media/67e05ba3467b9f4d-s.woff2 +0 -0
  135. package/dist/src/web/nextui/_next/static/media/699512af39861afa-s.p.woff2 +0 -0
  136. package/dist/src/web/nextui/_next/static/media/79015435f1a55eef-s.woff2 +0 -0
  137. package/dist/src/web/nextui/_next/static/media/7be645d133f3ee22-s.woff2 +0 -0
  138. package/dist/src/web/nextui/_next/static/media/7c53f7419436e04b-s.woff2 +0 -0
  139. package/dist/src/web/nextui/_next/static/media/8fb72f69fba4e3d2-s.woff2 +0 -0
  140. package/dist/src/web/nextui/_next/static/media/912a9cfe43c928d9-s.woff2 +0 -0
  141. package/dist/src/web/nextui/_next/static/media/91a88e0c5dd21dfa-s.woff2 +0 -0
  142. package/dist/src/web/nextui/_next/static/media/934c4b7cb736f2a3-s.p.woff2 +0 -0
  143. package/dist/src/web/nextui/_next/static/media/9b67ab375515cd6f-s.woff2 +0 -0
  144. package/dist/src/web/nextui/_next/static/media/9cf7d128be063d32-s.woff2 +0 -0
  145. package/dist/src/web/nextui/_next/static/media/a3c201c07e8eb753-s.woff2 +0 -0
  146. package/dist/src/web/nextui/_next/static/media/a5b77b63ef20339c-s.woff2 +0 -0
  147. package/dist/src/web/nextui/_next/static/media/a6d330d7873e7320-s.woff2 +0 -0
  148. package/dist/src/web/nextui/_next/static/media/b6db722c6886c2cd-s.woff2 +0 -0
  149. package/dist/src/web/nextui/_next/static/media/baf12dd90520ae41-s.woff2 +0 -0
  150. package/dist/src/web/nextui/_next/static/media/bbdb6f0234009aba-s.woff2 +0 -0
  151. package/dist/src/web/nextui/_next/static/media/cff529cd86cc0276-s.woff2 +0 -0
  152. package/dist/src/web/nextui/_next/static/media/d117eea74e01de14-s.woff2 +0 -0
  153. package/dist/src/web/nextui/_next/static/media/daa8cca6b52a70fa-s.woff2 +0 -0
  154. package/dist/src/web/nextui/_next/static/media/dfa8b99978df7bbc-s.woff2 +0 -0
  155. package/dist/src/web/nextui/_next/static/media/e195dd2ded485df3-s.woff2 +0 -0
  156. package/dist/src/web/nextui/_next/static/media/e25729ca87cc7df9-s.woff2 +0 -0
  157. package/dist/src/web/nextui/_next/static/media/e35c7314ac518ddc-s.woff2 +0 -0
  158. package/dist/src/web/nextui/_next/static/media/eb52b768f62eeeb4-s.woff2 +0 -0
  159. package/dist/src/web/nextui/_next/static/media/ee7e17a7bdd8636b-s.woff2 +0 -0
  160. package/dist/src/web/nextui/_next/static/media/f06116e890b3dadb-s.woff2 +0 -0
  161. /package/dist/src/web/nextui/_next/static/{4W0Qng9llk0Tg-jZCYupr → BCTl7ZJHSXC8sDtmlizu8}/_buildManifest.js +0 -0
  162. /package/dist/src/web/nextui/_next/static/{4W0Qng9llk0Tg-jZCYupr → BCTl7ZJHSXC8sDtmlizu8}/_ssgManifest.js +0 -0
  163. /package/dist/src/web/nextui/_next/static/chunks/{215-7d83203d614bcd6a.js → 215-7bd08e1ce7028897.js} +0 -0
  164. /package/dist/src/web/nextui/_next/static/chunks/{322-92c9551f32057648.js → 322-ac32773931b7a8aa.js} +0 -0
  165. /package/dist/src/web/nextui/_next/static/chunks/{378-4b0cc74c685f98f9.js → 378-c23e2864527ac3a0.js} +0 -0
  166. /package/dist/src/web/nextui/_next/static/chunks/{770-577cd7d7d380b3ac.js → 770-28c6d673e9540d80.js} +0 -0
  167. /package/dist/src/web/nextui/_next/static/chunks/{873-8bd18cf80e6e64e1.js → 873-e1436a5f57769f17.js} +0 -0
  168. /package/dist/src/web/nextui/_next/static/chunks/{915-cd96102a51e75c9d.js → 915-b1361d86b62c2cfe.js} +0 -0
  169. /package/dist/src/web/nextui/_next/static/chunks/{995-c9a656a43545902a.js → 995-81cea2f3d08297f2.js} +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[716],{11520:function(t,e,r){"use strict";r.d(e,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(46213),u=r(3982),l=r(225),d=r(48976),p=r(14059),h=r(23437),c=r(24004);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,h.Z)(),f=(0,p.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,e[`maxWidth${(0,l.Z)(String(r.maxWidth))}`],r.fixed&&e.fixed,r.disableGutters&&e.disableGutters]}}),x=t=>(0,d.Z)({props:t,name:"MuiContainer",defaultTheme:g}),b=(t,e)=>{let{classes:r,fixed:a,disableGutters:n,maxWidth:i}=t,o={root:["root",i&&`maxWidth${(0,l.Z)(String(i))}`,a&&"fixed",n&&"disableGutters"]};return(0,u.Z)(o,t=>(0,s.ZP)(e,t),r)};var v=r(81427),y=r(31608),Z=r(89020);let W=function(t={}){let{createStyledComponent:e=f,useThemeProps:r=x,componentName:s="MuiContainer"}=t,u=e(({theme:t,ownerState:e})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!e.disableGutters&&{paddingLeft:t.spacing(2),paddingRight:t.spacing(2),[t.breakpoints.up("sm")]:{paddingLeft:t.spacing(3),paddingRight:t.spacing(3)}}),({theme:t,ownerState:e})=>e.fixed&&Object.keys(t.breakpoints.values).reduce((e,r)=>{let a=t.breakpoints.values[r];return 0!==a&&(e[t.breakpoints.up(r)]={maxWidth:`${a}${t.breakpoints.unit}`}),e},{}),({theme:t,ownerState:e})=>(0,n.Z)({},"xs"===e.maxWidth&&{[t.breakpoints.up("xs")]:{maxWidth:Math.max(t.breakpoints.values.xs,444)}},e.maxWidth&&"xs"!==e.maxWidth&&{[t.breakpoints.up(e.maxWidth)]:{maxWidth:`${t.breakpoints.values[e.maxWidth]}${t.breakpoints.unit}`}})),l=i.forwardRef(function(t,e){let i=r(t),{className:l,component:d="div",disableGutters:p=!1,fixed:h=!1,maxWidth:g="lg"}=i,f=(0,a.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:p,fixed:h,maxWidth:g}),v=b(x,s);return(0,c.jsx)(u,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(v.root,l),ref:e},f))});return l}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,e[`maxWidth${(0,v.Z)(String(r.maxWidth))}`],r.fixed&&e.fixed,r.disableGutters&&e.disableGutters]}}),useThemeProps:t=>(0,Z.Z)({props:t,name:"MuiContainer"})});var S=W},63147:function(t,e,r){"use strict";r.d(e,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(86251),u=r(3982),l=r(31608),d=r(89020),p=r(81427),h=r(25800),c=r(46213);function m(t){return(0,c.ZP)("MuiTypography",t)}(0,h.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=r(24004);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=t=>{let{align:e,gutterBottom:r,noWrap:a,paragraph:n,variant:i,classes:o}=t,s={root:["root",i,"inherit"!==t.align&&`align${(0,p.Z)(e)}`,r&&"gutterBottom",a&&"noWrap",n&&"paragraph"]};return(0,u.Z)(s,m,o)},b=(0,l.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,r.variant&&e[r.variant],"inherit"!==r.align&&e[`align${(0,p.Z)(r.align)}`],r.noWrap&&e.noWrap,r.gutterBottom&&e.gutterBottom,r.paragraph&&e.paragraph]}})(({theme:t,ownerState:e})=>(0,n.Z)({margin:0},"inherit"===e.variant&&{font:"inherit"},"inherit"!==e.variant&&t.typography[e.variant],"inherit"!==e.align&&{textAlign:e.align},e.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},e.gutterBottom&&{marginBottom:"0.35em"},e.paragraph&&{marginBottom:16})),v={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=t=>y[t]||t,W=i.forwardRef(function(t,e){let r=(0,d.Z)({props:t,name:"MuiTypography"}),i=Z(r.color),u=(0,s.Z)((0,n.Z)({},r,{color:i})),{align:l="inherit",className:p,component:h,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:W="body1",variantMapping:S=v}=u,C=(0,a.Z)(u,f),w=(0,n.Z)({},u,{align:l,color:i,className:p,component:h,gutterBottom:c,noWrap:m,paragraph:y,variant:W,variantMapping:S}),k=h||(y?"p":S[W]||v[W])||"span",R=x(w);return(0,g.jsx)(b,(0,n.Z)({as:k,ref:e,ownerState:w,className:(0,o.Z)(R.root,p)},C))});var S=W},99152:function(t,e,r){Promise.resolve().then(r.bind(r,92030))},92030:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return c}});var a=r(24004),n=r(14978),i=r(1445),o=r(40982),s=r(11520),u=r(67339),l=r(63147),d=r(38640),p=r.n(d),h=r(28891);function c(){let t=(0,h.useRouter)(),[e,r]=n.useState(""),[d,c]=n.useState(""),[m,g]=n.useState(""),[f,x]=n.useState(!1),[b,v]=n.useState(null),y=n.useCallback(async()=>{let{data:t,error:e}=await i.OQ.auth.refreshSession();t&&v(t.user)},[]);n.useEffect(()=>{y()},[y]);let Z=async r=>{if(x(!0),g(""),r.stopPropagation(),r.preventDefault(),!b){let{data:r,error:a}=await i.OQ.auth.signInWithPassword({email:e,password:d});a?g(a.message):t.push("/")}x(!1)};return b?(0,a.jsxs)("div",{style:{textAlign:"center"},children:["You're already logged in as ",b.email,"."]}):(0,a.jsxs)(s.Z,{component:"main",maxWidth:"xs",children:[(0,a.jsx)(l.Z,{component:"h1",variant:"h5",children:"Sign in"}),(0,a.jsx)("form",{children:!b&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0,onChange:t=>r(t.target.value),value:e,error:!!m}),(0,a.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:t=>c(t.target.value),value:d,error:!!m,helperText:m}),(0,a.jsx)(o.Z,{type:"submit",disabled:f,sx:{marginTop:"1em"},fullWidth:!0,variant:"contained",color:"primary",onClick:Z,children:"Sign In"}),(0,a.jsxs)("p",{children:["Don't have an account yet? ",(0,a.jsx)(p(),{href:"/auth/signup",children:"Sign up"})]})]})})]})}},1445:function(t,e,r){"use strict";r.d(e,{Ho:function(){return p},OQ:function(){return o},aC:function(){return u}});var a=r(24004),n=r(14978),i=r(12594);let o=(0,i.createClientComponentClient)(),s=(0,n.createContext)({}),u=()=>(0,n.useContext)(s),l=(t,e)=>o.auth.signInWithPassword({email:t,password:e}),d=()=>o.auth.signOut(),p=t=>{let{children:e}=t,[r,i]=(0,n.useState)(null),[u,p]=(0,n.useState)(!1),h=(0,n.useCallback)(async()=>{let{data:t,error:e}=await o.auth.refreshSession();t&&i(t.user)},[]);return(0,n.useEffect)(()=>{h();let{data:t}=o.auth.onAuthStateChange(async(t,e)=>{"PASSWORD_RECOVERY"==t?p(!1):"SIGNED_IN"===t&&e?(i(e.user),p(!0)):"SIGNED_OUT"===t&&(p(!1),i(null))});return()=>{t.subscription.unsubscribe()}},[h]),(0,a.jsx)(s.Provider,{value:{loggedIn:u,user:r,login:l,logout:d},children:e})}},28891:function(t,e,r){t.exports=r(98556)}},function(t){t.O(0,[540,640,215,620,304,339,954,470,730,744],function(){return t(t.s=99152)}),_N_E=t.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[716],{11520:function(t,e,r){"use strict";r.d(e,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(46213),u=r(3982),l=r(225),d=r(48976),p=r(14059),h=r(23437),c=r(24004);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,h.Z)(),f=(0,p.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,e[`maxWidth${(0,l.Z)(String(r.maxWidth))}`],r.fixed&&e.fixed,r.disableGutters&&e.disableGutters]}}),x=t=>(0,d.Z)({props:t,name:"MuiContainer",defaultTheme:g}),b=(t,e)=>{let{classes:r,fixed:a,disableGutters:n,maxWidth:i}=t,o={root:["root",i&&`maxWidth${(0,l.Z)(String(i))}`,a&&"fixed",n&&"disableGutters"]};return(0,u.Z)(o,t=>(0,s.ZP)(e,t),r)};var v=r(81427),y=r(31608),Z=r(89020);let W=function(t={}){let{createStyledComponent:e=f,useThemeProps:r=x,componentName:s="MuiContainer"}=t,u=e(({theme:t,ownerState:e})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!e.disableGutters&&{paddingLeft:t.spacing(2),paddingRight:t.spacing(2),[t.breakpoints.up("sm")]:{paddingLeft:t.spacing(3),paddingRight:t.spacing(3)}}),({theme:t,ownerState:e})=>e.fixed&&Object.keys(t.breakpoints.values).reduce((e,r)=>{let a=t.breakpoints.values[r];return 0!==a&&(e[t.breakpoints.up(r)]={maxWidth:`${a}${t.breakpoints.unit}`}),e},{}),({theme:t,ownerState:e})=>(0,n.Z)({},"xs"===e.maxWidth&&{[t.breakpoints.up("xs")]:{maxWidth:Math.max(t.breakpoints.values.xs,444)}},e.maxWidth&&"xs"!==e.maxWidth&&{[t.breakpoints.up(e.maxWidth)]:{maxWidth:`${t.breakpoints.values[e.maxWidth]}${t.breakpoints.unit}`}})),l=i.forwardRef(function(t,e){let i=r(t),{className:l,component:d="div",disableGutters:p=!1,fixed:h=!1,maxWidth:g="lg"}=i,f=(0,a.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:p,fixed:h,maxWidth:g}),v=b(x,s);return(0,c.jsx)(u,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(v.root,l),ref:e},f))});return l}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,e[`maxWidth${(0,v.Z)(String(r.maxWidth))}`],r.fixed&&e.fixed,r.disableGutters&&e.disableGutters]}}),useThemeProps:t=>(0,Z.Z)({props:t,name:"MuiContainer"})});var S=W},63147:function(t,e,r){"use strict";r.d(e,{Z:function(){return S}});var a=r(94312),n=r(79042),i=r(14978),o=r(53468),s=r(86251),u=r(3982),l=r(31608),d=r(89020),p=r(81427),h=r(25800),c=r(46213);function m(t){return(0,c.ZP)("MuiTypography",t)}(0,h.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=r(24004);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=t=>{let{align:e,gutterBottom:r,noWrap:a,paragraph:n,variant:i,classes:o}=t,s={root:["root",i,"inherit"!==t.align&&`align${(0,p.Z)(e)}`,r&&"gutterBottom",a&&"noWrap",n&&"paragraph"]};return(0,u.Z)(s,m,o)},b=(0,l.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,r.variant&&e[r.variant],"inherit"!==r.align&&e[`align${(0,p.Z)(r.align)}`],r.noWrap&&e.noWrap,r.gutterBottom&&e.gutterBottom,r.paragraph&&e.paragraph]}})(({theme:t,ownerState:e})=>(0,n.Z)({margin:0},"inherit"===e.variant&&{font:"inherit"},"inherit"!==e.variant&&t.typography[e.variant],"inherit"!==e.align&&{textAlign:e.align},e.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},e.gutterBottom&&{marginBottom:"0.35em"},e.paragraph&&{marginBottom:16})),v={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=t=>y[t]||t,W=i.forwardRef(function(t,e){let r=(0,d.Z)({props:t,name:"MuiTypography"}),i=Z(r.color),u=(0,s.Z)((0,n.Z)({},r,{color:i})),{align:l="inherit",className:p,component:h,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:W="body1",variantMapping:S=v}=u,C=(0,a.Z)(u,f),w=(0,n.Z)({},u,{align:l,color:i,className:p,component:h,gutterBottom:c,noWrap:m,paragraph:y,variant:W,variantMapping:S}),k=h||(y?"p":S[W]||v[W])||"span",R=x(w);return(0,g.jsx)(b,(0,n.Z)({as:k,ref:e,ownerState:w,className:(0,o.Z)(R.root,p)},C))});var S=W},33641:function(t,e,r){Promise.resolve().then(r.bind(r,92030))},92030:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return c}});var a=r(24004),n=r(14978),i=r(1445),o=r(40982),s=r(11520),u=r(67339),l=r(63147),d=r(38640),p=r.n(d),h=r(28891);function c(){let t=(0,h.useRouter)(),[e,r]=n.useState(""),[d,c]=n.useState(""),[m,g]=n.useState(""),[f,x]=n.useState(!1),[b,v]=n.useState(null),y=n.useCallback(async()=>{let{data:t,error:e}=await i.OQ.auth.refreshSession();t&&v(t.user)},[]);n.useEffect(()=>{y()},[y]);let Z=async r=>{if(x(!0),g(""),r.stopPropagation(),r.preventDefault(),!b){let{data:r,error:a}=await i.OQ.auth.signInWithPassword({email:e,password:d});a?g(a.message):t.push("/")}x(!1)};return b?(0,a.jsxs)("div",{style:{textAlign:"center"},children:["You're already logged in as ",b.email,"."]}):(0,a.jsxs)(s.Z,{component:"main",maxWidth:"xs",children:[(0,a.jsx)(l.Z,{component:"h1",variant:"h5",children:"Sign in"}),(0,a.jsx)("form",{children:!b&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0,onChange:t=>r(t.target.value),value:e,error:!!m}),(0,a.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:t=>c(t.target.value),value:d,error:!!m,helperText:m}),(0,a.jsx)(o.Z,{type:"submit",disabled:f,sx:{marginTop:"1em"},fullWidth:!0,variant:"contained",color:"primary",onClick:Z,children:"Sign In"}),(0,a.jsxs)("p",{children:["Don't have an account yet? ",(0,a.jsx)(p(),{href:"/auth/signup",children:"Sign up"})]})]})})]})}},1445:function(t,e,r){"use strict";r.d(e,{Ho:function(){return p},OQ:function(){return o},aC:function(){return u}});var a=r(24004),n=r(14978),i=r(12594);let o=(0,i.createClientComponentClient)(),s=(0,n.createContext)({}),u=()=>(0,n.useContext)(s),l=(t,e)=>o.auth.signInWithPassword({email:t,password:e}),d=()=>o.auth.signOut(),p=t=>{let{children:e}=t,[r,i]=(0,n.useState)(null),[u,p]=(0,n.useState)(!1),h=(0,n.useCallback)(async()=>{let{data:t,error:e}=await o.auth.refreshSession();t&&i(t.user)},[]);return(0,n.useEffect)(()=>{h();let{data:t}=o.auth.onAuthStateChange(async(t,e)=>{"PASSWORD_RECOVERY"==t?p(!1):"SIGNED_IN"===t&&e?(i(e.user),p(!0)):"SIGNED_OUT"===t&&(p(!1),i(null))});return()=>{t.subscription.unsubscribe()}},[h]),(0,a.jsx)(s.Provider,{value:{loggedIn:u,user:r,login:l,logout:d},children:e})}},28891:function(t,e,r){t.exports=r(98556)}},function(t){t.O(0,[540,640,215,620,304,339,954,470,730,744],function(){return t(t.s=33641)}),_N_E=t.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[271],{11520:function(t,e,a){"use strict";a.d(e,{Z:function(){return W}});var r=a(94312),n=a(79042),i=a(14978),o=a(53468),s=a(46213),u=a(3982),l=a(225),d=a(48976),p=a(14059),h=a(23437),c=a(24004);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,h.Z)(),f=(0,p.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,e[`maxWidth${(0,l.Z)(String(a.maxWidth))}`],a.fixed&&e.fixed,a.disableGutters&&e.disableGutters]}}),x=t=>(0,d.Z)({props:t,name:"MuiContainer",defaultTheme:g}),b=(t,e)=>{let{classes:a,fixed:r,disableGutters:n,maxWidth:i}=t,o={root:["root",i&&`maxWidth${(0,l.Z)(String(i))}`,r&&"fixed",n&&"disableGutters"]};return(0,u.Z)(o,t=>(0,s.ZP)(e,t),a)};var v=a(81427),y=a(31608),Z=a(89020);let S=function(t={}){let{createStyledComponent:e=f,useThemeProps:a=x,componentName:s="MuiContainer"}=t,u=e(({theme:t,ownerState:e})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!e.disableGutters&&{paddingLeft:t.spacing(2),paddingRight:t.spacing(2),[t.breakpoints.up("sm")]:{paddingLeft:t.spacing(3),paddingRight:t.spacing(3)}}),({theme:t,ownerState:e})=>e.fixed&&Object.keys(t.breakpoints.values).reduce((e,a)=>{let r=t.breakpoints.values[a];return 0!==r&&(e[t.breakpoints.up(a)]={maxWidth:`${r}${t.breakpoints.unit}`}),e},{}),({theme:t,ownerState:e})=>(0,n.Z)({},"xs"===e.maxWidth&&{[t.breakpoints.up("xs")]:{maxWidth:Math.max(t.breakpoints.values.xs,444)}},e.maxWidth&&"xs"!==e.maxWidth&&{[t.breakpoints.up(e.maxWidth)]:{maxWidth:`${t.breakpoints.values[e.maxWidth]}${t.breakpoints.unit}`}})),l=i.forwardRef(function(t,e){let i=a(t),{className:l,component:d="div",disableGutters:p=!1,fixed:h=!1,maxWidth:g="lg"}=i,f=(0,r.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:p,fixed:h,maxWidth:g}),v=b(x,s);return(0,c.jsx)(u,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(v.root,l),ref:e},f))});return l}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,e[`maxWidth${(0,v.Z)(String(a.maxWidth))}`],a.fixed&&e.fixed,a.disableGutters&&e.disableGutters]}}),useThemeProps:t=>(0,Z.Z)({props:t,name:"MuiContainer"})});var W=S},63147:function(t,e,a){"use strict";a.d(e,{Z:function(){return W}});var r=a(94312),n=a(79042),i=a(14978),o=a(53468),s=a(86251),u=a(3982),l=a(31608),d=a(89020),p=a(81427),h=a(25800),c=a(46213);function m(t){return(0,c.ZP)("MuiTypography",t)}(0,h.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=a(24004);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=t=>{let{align:e,gutterBottom:a,noWrap:r,paragraph:n,variant:i,classes:o}=t,s={root:["root",i,"inherit"!==t.align&&`align${(0,p.Z)(e)}`,a&&"gutterBottom",r&&"noWrap",n&&"paragraph"]};return(0,u.Z)(s,m,o)},b=(0,l.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,a.variant&&e[a.variant],"inherit"!==a.align&&e[`align${(0,p.Z)(a.align)}`],a.noWrap&&e.noWrap,a.gutterBottom&&e.gutterBottom,a.paragraph&&e.paragraph]}})(({theme:t,ownerState:e})=>(0,n.Z)({margin:0},"inherit"===e.variant&&{font:"inherit"},"inherit"!==e.variant&&t.typography[e.variant],"inherit"!==e.align&&{textAlign:e.align},e.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},e.gutterBottom&&{marginBottom:"0.35em"},e.paragraph&&{marginBottom:16})),v={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=t=>y[t]||t,S=i.forwardRef(function(t,e){let a=(0,d.Z)({props:t,name:"MuiTypography"}),i=Z(a.color),u=(0,s.Z)((0,n.Z)({},a,{color:i})),{align:l="inherit",className:p,component:h,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:S="body1",variantMapping:W=v}=u,C=(0,r.Z)(u,f),w=(0,n.Z)({},u,{align:l,color:i,className:p,component:h,gutterBottom:c,noWrap:m,paragraph:y,variant:S,variantMapping:W}),k=h||(y?"p":W[S]||v[S])||"span",R=x(w);return(0,g.jsx)(b,(0,n.Z)({as:k,ref:e,ownerState:w,className:(0,o.Z)(R.root,p)},C))});var W=S},73591:function(t,e,a){Promise.resolve().then(a.bind(a,78567))},78567:function(t,e,a){"use strict";a.r(e),a.d(e,{default:function(){return c}});var r=a(24004),n=a(14978),i=a(1445),o=a(40982),s=a(11520),u=a(67339),l=a(63147),d=a(38640),p=a.n(d),h=a(28891);function c(){let t=(0,h.useRouter)(),[e,a]=n.useState(""),[d,c]=n.useState(""),[m,g]=n.useState(""),[f,x]=n.useState(!1),[b,v]=n.useState(null),y=n.useCallback(async()=>{let{data:t,error:e}=await i.OQ.auth.refreshSession();t&&v(t.user)},[]);n.useEffect(()=>{y()},[y]);let Z=async a=>{if(x(!0),g(""),a.stopPropagation(),a.preventDefault(),!b){let{data:a,error:r}=await i.OQ.auth.signUp({email:e,password:d,options:{emailRedirectTo:"".concat(location.origin,"/auth/callback")}});r?g(r.message):t.push("/")}x(!1)};return(0,r.jsxs)(s.Z,{component:"main",maxWidth:"xs",children:[(0,r.jsx)(l.Z,{component:"h1",variant:"h5",children:"Sign up"}),(0,r.jsx)("p",{children:(0,r.jsx)(l.Z,{variant:"body1",children:"An account helps you easily save, view, and share your evals."})}),(0,r.jsxs)("form",{children:[!b&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0,onChange:t=>a(t.target.value),value:e,error:!!m}),(0,r.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:t=>c(t.target.value),value:d,error:!!m,helperText:m}),(0,r.jsx)(o.Z,{type:"submit",disabled:f,sx:{marginTop:"1em"},fullWidth:!0,variant:"contained",color:"primary",onClick:Z,children:"Sign Up"})]}),(0,r.jsxs)("p",{children:["Already have an account? ",(0,r.jsx)(p(),{href:"/auth/login",children:"Sign in"})]})]})]})}},1445:function(t,e,a){"use strict";a.d(e,{Ho:function(){return p},OQ:function(){return o},aC:function(){return u}});var r=a(24004),n=a(14978),i=a(12594);let o=(0,i.createClientComponentClient)(),s=(0,n.createContext)({}),u=()=>(0,n.useContext)(s),l=(t,e)=>o.auth.signInWithPassword({email:t,password:e}),d=()=>o.auth.signOut(),p=t=>{let{children:e}=t,[a,i]=(0,n.useState)(null),[u,p]=(0,n.useState)(!1),h=(0,n.useCallback)(async()=>{let{data:t,error:e}=await o.auth.refreshSession();t&&i(t.user)},[]);return(0,n.useEffect)(()=>{h();let{data:t}=o.auth.onAuthStateChange(async(t,e)=>{"PASSWORD_RECOVERY"==t?p(!1):"SIGNED_IN"===t&&e?(i(e.user),p(!0)):"SIGNED_OUT"===t&&(p(!1),i(null))});return()=>{t.subscription.unsubscribe()}},[h]),(0,r.jsx)(s.Provider,{value:{loggedIn:u,user:a,login:l,logout:d},children:e})}},28891:function(t,e,a){t.exports=a(98556)}},function(t){t.O(0,[540,640,215,620,304,339,954,470,730,744],function(){return t(t.s=73591)}),_N_E=t.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[271],{11520:function(t,e,a){"use strict";a.d(e,{Z:function(){return W}});var r=a(94312),n=a(79042),i=a(14978),o=a(53468),s=a(46213),u=a(3982),l=a(225),d=a(48976),p=a(14059),h=a(23437),c=a(24004);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,h.Z)(),f=(0,p.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,e[`maxWidth${(0,l.Z)(String(a.maxWidth))}`],a.fixed&&e.fixed,a.disableGutters&&e.disableGutters]}}),x=t=>(0,d.Z)({props:t,name:"MuiContainer",defaultTheme:g}),b=(t,e)=>{let{classes:a,fixed:r,disableGutters:n,maxWidth:i}=t,o={root:["root",i&&`maxWidth${(0,l.Z)(String(i))}`,r&&"fixed",n&&"disableGutters"]};return(0,u.Z)(o,t=>(0,s.ZP)(e,t),a)};var v=a(81427),y=a(31608),Z=a(89020);let S=function(t={}){let{createStyledComponent:e=f,useThemeProps:a=x,componentName:s="MuiContainer"}=t,u=e(({theme:t,ownerState:e})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!e.disableGutters&&{paddingLeft:t.spacing(2),paddingRight:t.spacing(2),[t.breakpoints.up("sm")]:{paddingLeft:t.spacing(3),paddingRight:t.spacing(3)}}),({theme:t,ownerState:e})=>e.fixed&&Object.keys(t.breakpoints.values).reduce((e,a)=>{let r=t.breakpoints.values[a];return 0!==r&&(e[t.breakpoints.up(a)]={maxWidth:`${r}${t.breakpoints.unit}`}),e},{}),({theme:t,ownerState:e})=>(0,n.Z)({},"xs"===e.maxWidth&&{[t.breakpoints.up("xs")]:{maxWidth:Math.max(t.breakpoints.values.xs,444)}},e.maxWidth&&"xs"!==e.maxWidth&&{[t.breakpoints.up(e.maxWidth)]:{maxWidth:`${t.breakpoints.values[e.maxWidth]}${t.breakpoints.unit}`}})),l=i.forwardRef(function(t,e){let i=a(t),{className:l,component:d="div",disableGutters:p=!1,fixed:h=!1,maxWidth:g="lg"}=i,f=(0,r.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:p,fixed:h,maxWidth:g}),v=b(x,s);return(0,c.jsx)(u,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(v.root,l),ref:e},f))});return l}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,e[`maxWidth${(0,v.Z)(String(a.maxWidth))}`],a.fixed&&e.fixed,a.disableGutters&&e.disableGutters]}}),useThemeProps:t=>(0,Z.Z)({props:t,name:"MuiContainer"})});var W=S},63147:function(t,e,a){"use strict";a.d(e,{Z:function(){return W}});var r=a(94312),n=a(79042),i=a(14978),o=a(53468),s=a(86251),u=a(3982),l=a(31608),d=a(89020),p=a(81427),h=a(25800),c=a(46213);function m(t){return(0,c.ZP)("MuiTypography",t)}(0,h.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=a(24004);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=t=>{let{align:e,gutterBottom:a,noWrap:r,paragraph:n,variant:i,classes:o}=t,s={root:["root",i,"inherit"!==t.align&&`align${(0,p.Z)(e)}`,a&&"gutterBottom",r&&"noWrap",n&&"paragraph"]};return(0,u.Z)(s,m,o)},b=(0,l.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,a.variant&&e[a.variant],"inherit"!==a.align&&e[`align${(0,p.Z)(a.align)}`],a.noWrap&&e.noWrap,a.gutterBottom&&e.gutterBottom,a.paragraph&&e.paragraph]}})(({theme:t,ownerState:e})=>(0,n.Z)({margin:0},"inherit"===e.variant&&{font:"inherit"},"inherit"!==e.variant&&t.typography[e.variant],"inherit"!==e.align&&{textAlign:e.align},e.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},e.gutterBottom&&{marginBottom:"0.35em"},e.paragraph&&{marginBottom:16})),v={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=t=>y[t]||t,S=i.forwardRef(function(t,e){let a=(0,d.Z)({props:t,name:"MuiTypography"}),i=Z(a.color),u=(0,s.Z)((0,n.Z)({},a,{color:i})),{align:l="inherit",className:p,component:h,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:S="body1",variantMapping:W=v}=u,C=(0,r.Z)(u,f),w=(0,n.Z)({},u,{align:l,color:i,className:p,component:h,gutterBottom:c,noWrap:m,paragraph:y,variant:S,variantMapping:W}),k=h||(y?"p":W[S]||v[S])||"span",R=x(w);return(0,g.jsx)(b,(0,n.Z)({as:k,ref:e,ownerState:w,className:(0,o.Z)(R.root,p)},C))});var W=S},18174:function(t,e,a){Promise.resolve().then(a.bind(a,78567))},78567:function(t,e,a){"use strict";a.r(e),a.d(e,{default:function(){return c}});var r=a(24004),n=a(14978),i=a(1445),o=a(40982),s=a(11520),u=a(67339),l=a(63147),d=a(38640),p=a.n(d),h=a(28891);function c(){let t=(0,h.useRouter)(),[e,a]=n.useState(""),[d,c]=n.useState(""),[m,g]=n.useState(""),[f,x]=n.useState(!1),[b,v]=n.useState(null),y=n.useCallback(async()=>{let{data:t,error:e}=await i.OQ.auth.refreshSession();t&&v(t.user)},[]);n.useEffect(()=>{y()},[y]);let Z=async a=>{if(x(!0),g(""),a.stopPropagation(),a.preventDefault(),!b){let{data:a,error:r}=await i.OQ.auth.signUp({email:e,password:d,options:{emailRedirectTo:"".concat(location.origin,"/auth/callback")}});r?g(r.message):t.push("/")}x(!1)};return(0,r.jsxs)(s.Z,{component:"main",maxWidth:"xs",children:[(0,r.jsx)(l.Z,{component:"h1",variant:"h5",children:"Sign up"}),(0,r.jsx)("p",{children:(0,r.jsx)(l.Z,{variant:"body1",children:"An account helps you easily save, view, and share your evals."})}),(0,r.jsxs)("form",{children:[!b&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0,onChange:t=>a(t.target.value),value:e,error:!!m}),(0,r.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:t=>c(t.target.value),value:d,error:!!m,helperText:m}),(0,r.jsx)(o.Z,{type:"submit",disabled:f,sx:{marginTop:"1em"},fullWidth:!0,variant:"contained",color:"primary",onClick:Z,children:"Sign Up"})]}),(0,r.jsxs)("p",{children:["Already have an account? ",(0,r.jsx)(p(),{href:"/auth/login",children:"Sign in"})]})]})]})}},1445:function(t,e,a){"use strict";a.d(e,{Ho:function(){return p},OQ:function(){return o},aC:function(){return u}});var r=a(24004),n=a(14978),i=a(12594);let o=(0,i.createClientComponentClient)(),s=(0,n.createContext)({}),u=()=>(0,n.useContext)(s),l=(t,e)=>o.auth.signInWithPassword({email:t,password:e}),d=()=>o.auth.signOut(),p=t=>{let{children:e}=t,[a,i]=(0,n.useState)(null),[u,p]=(0,n.useState)(!1),h=(0,n.useCallback)(async()=>{let{data:t,error:e}=await o.auth.refreshSession();t&&i(t.user)},[]);return(0,n.useEffect)(()=>{h();let{data:t}=o.auth.onAuthStateChange(async(t,e)=>{"PASSWORD_RECOVERY"==t?p(!1):"SIGNED_IN"===t&&e?(i(e.user),p(!0)):"SIGNED_OUT"===t&&(p(!1),i(null))});return()=>{t.subscription.unsubscribe()}},[h]),(0,r.jsx)(s.Provider,{value:{loggedIn:u,user:a,login:l,logout:d},children:e})}},28891:function(t,e,a){t.exports=a(98556)}},function(t){t.O(0,[540,640,215,620,304,339,954,470,730,744],function(){return t(t.s=18174)}),_N_E=t.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{21445:function(e,t,s){Promise.resolve().then(s.bind(s,41400))},49532:function(e,t,s){"use strict";let n,i;async function r(){if(n||(i||(i=fetch("/api/config").then(e=>e.json()).then(e=>n=e.apiBaseUrl)),await i),void 0===n)throw Error("API base URL is undefined");return n}s.d(t,{b:function(){return r}})},41400:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return S}});var n=s(24004),i=s(14978),r=s(49532),l=s(49567),c=s(30469),a=s(65068),d=s(70417),o=s(21303),h=s(26485),u=s(30021),p=s(19708),x=s(65969),j=s(38640),v=s.n(j),m=s(28891),Z=s(40982),f=s(29794),w=s(22701),C=s(51956),y=s(82669),g=s(613),I=s(63147),k=s(34235);function P(e){var t,s,r,l;let{openDialog:p,handleClose:x,testCase:j}=e,[m,P]=(0,i.useState)(1);return(0,n.jsxs)(f.Z,{open:p,onClose:x,fullWidth:!0,maxWidth:"lg",children:[(0,n.jsxs)(y.Z,{children:["Dataset ",j.id.slice(0,6)]}),(0,n.jsxs)(C.Z,{children:[(0,n.jsx)(I.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Test cases"}),(0,n.jsx)(g.u,{readOnly:!0,value:j&&k.default.dump(j.testCases),style:{width:"100%",padding:"0.75rem"},maxRows:15}),(0,n.jsx)(I.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,n.jsxs)(a.Z,{children:[(0,n.jsx)(h.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{children:"Eval ID"}),(0,n.jsx)(o.Z,{children:"Prompt ID"}),(0,n.jsx)(o.Z,{children:"Raw score"}),(0,n.jsx)(o.Z,{children:"Pass rate"}),(0,n.jsx)(o.Z,{children:"Pass count"}),(0,n.jsx)(o.Z,{children:"Fail count"}),(0,n.jsx)(o.Z,{children:"Prompt"})]})}),(0,n.jsx)(d.Z,{children:null==j?void 0:null===(t=j.prompts)||void 0===t?void 0:t.slice((m-1)*10,10*m).sort((e,t)=>t.evalId.localeCompare(e.evalId)).map((e,t)=>{var s,i,c,a,d;return(0,n.jsxs)(u.Z,{hover:!0,children:[(0,n.jsx)(o.Z,{children:(0,n.jsx)(v(),{href:"/eval/?evalId=".concat(e.evalId),children:e.evalId})}),(0,n.jsx)(o.Z,{style:{minWidth:"8em"},children:(0,n.jsx)(v(),{href:"/prompts/?id=".concat(e.id),children:e.id.slice(0,6)})}),(0,n.jsx)(o.Z,{children:"number"==typeof(null===(s=e.prompt.metrics)||void 0===s?void 0:s.score)?e.prompt.metrics.score.toFixed(2):"-"}),(0,n.jsx)(o.Z,{children:"number"==typeof(null===(i=e.prompt.metrics)||void 0===i?void 0:i.testPassCount)&&"number"==typeof(null===(c=e.prompt.metrics)||void 0===c?void 0:c.testFailCount)&&e.prompt.metrics.testPassCount+e.prompt.metrics.testFailCount>0?(e.prompt.metrics.testPassCount/(e.prompt.metrics.testPassCount+e.prompt.metrics.testFailCount)*100).toFixed(2)+"%":"-"}),(0,n.jsx)(o.Z,{children:null!==(r=null===(a=e.prompt.metrics)||void 0===a?void 0:a.testPassCount)&&void 0!==r?r:"-"}),(0,n.jsx)(o.Z,{children:null!==(l=null===(d=e.prompt.metrics)||void 0===d?void 0:d.testFailCount)&&void 0!==l?l:"-"}),(0,n.jsx)(o.Z,{children:e.prompt.raw.length>250?e.prompt.raw.slice(0,250)+"...":e.prompt.raw})]},t)})})]}),Math.ceil(((null==j?void 0:null===(s=j.prompts)||void 0===s?void 0:s.length)||0)/10)>1&&(0,n.jsx)(c.Z,{count:Math.ceil(j.prompts.length/10),page:m,onChange:(e,t)=>{P(t)}})]}),(0,n.jsx)(w.Z,{children:(0,n.jsx)(Z.Z,{onClick:x,children:"Close"})})]})}function S(){let e=(0,m.useSearchParams)(),[t,s]=(0,i.useState)([]),[j,Z]=(0,i.useState)("date"),[f,w]=(0,i.useState)("desc"),[C,y]=(0,i.useState)(1),[g,I]=(0,i.useState)(10),[k,S]=(0,i.useState)(!1),[b,E]=(0,i.useState)(0),D=e=>{let t=j===e&&"asc"===f?"desc":"asc";Z(e),w(t)};(0,i.useEffect)(()=>{(async()=>{fetch("".concat(await (0,r.b)(),"/api/datasets")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===j?0:"asc"===f?e[j]>t[j]?1:-1:e[j]<t[j]?1:-1);s(t)})})()},[j,f,C,g]);let F=e=>{E(e),S(!0)};return(0,i.useEffect)(()=>{let s=null==e?void 0:e.get("id");if(s){let e=t.findIndex(e=>e.id.startsWith(s));-1!==e&&F(e)}},[t,e]),(0,n.jsxs)(l.Z,{paddingX:2,children:[(0,n.jsxs)(a.Z,{children:[(0,n.jsx)(h.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{style:{width:"10%"},children:"ID"}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:(0,n.jsx)(p.Z,{active:"raw"===j,direction:"raw"===j?f:"asc",onClick:()=>D("raw"),children:"Info"})}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:"Variables"}),(0,n.jsx)(o.Z,{style:{width:"10%"},children:(0,n.jsx)(p.Z,{active:"count"===j,direction:"count"===j?f:"asc",onClick:()=>D("count"),children:"Total # evals"})}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:(0,n.jsx)(x.Z,{title:"The date of the most recent eval for this set of test cases",children:(0,n.jsx)(p.Z,{active:"date"===j,direction:"date"===j?f:"asc",onClick:()=>D("date"),children:"Most recent eval date"})})}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:(0,n.jsx)(x.Z,{title:"The ID of the most recent eval for this set of test cases",children:(0,n.jsx)(p.Z,{active:"evalId"===j,direction:"evalId"===j?f:"asc",onClick:()=>D("evalId"),children:"Most recent eval ID"})})})]})}),(0,n.jsx)(d.Z,{children:t.slice((C-1)*g,C*g).map((e,t)=>(0,n.jsxs)(u.Z,{hover:!0,onClick:()=>F(t),style:{cursor:"pointer"},children:[(0,n.jsx)(o.Z,{children:e.id.slice(0,6)}),(0,n.jsxs)(o.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:[e.testCases.length," test cases"]}),(0,n.jsx)(o.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:(()=>{if(!Array.isArray(e.testCases)||"string"==typeof e.testCases[0])return"";let t=(e.testCases||[]).flatMap(e=>Object.keys(e.vars||{})),s=Array.from(new Set(t));return s.length>0?s.join(", "):"None"})()}),(0,n.jsx)(o.Z,{style:{width:"10%"},children:e.count}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:e.recentEvalDate||"Unknown"}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:e.recentEvalId?(0,n.jsx)(v(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalId}):"Unknown"})]},t))})]}),Math.ceil(t.length/g)>1&&(0,n.jsx)(c.Z,{count:Math.ceil(t.length/g),page:C,onChange:(e,t)=>y(t)}),t[b]&&(0,n.jsx)(P,{openDialog:k,handleClose:()=>{S(!1)},testCase:t[b]})]})}}},function(e){e.O(0,[540,640,215,770,995,374,235,322,470,730,744],function(){return e(e.s=21445)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[466],{57802:function(n,e,u){Promise.resolve().then(u.t.bind(u,29820,23))},29820:function(){}},function(n){n.O(0,[470,730,744],function(){return n(n.s=57802)}),_N_E=n.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[421],{52328:function(e,n,t){Promise.resolve().then(t.t.bind(t,16662,23)),Promise.resolve().then(t.t.bind(t,27924,23)),Promise.resolve().then(t.t.bind(t,30910,23)),Promise.resolve().then(t.t.bind(t,81885,23)),Promise.resolve().then(t.bind(t,72002)),Promise.resolve().then(t.t.bind(t,29820,23))},81885:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(69278),t(14978);let r=t(66995);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},29820:function(){}},function(e){e.O(0,[583,540,640,215,620,770,304,339,995,954,378,374,235,873,631,106,897,2,470,730,744],function(){return e(e.s=52328)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[421],{23626:function(e,n,t){Promise.resolve().then(t.t.bind(t,16662,23)),Promise.resolve().then(t.t.bind(t,27924,23)),Promise.resolve().then(t.t.bind(t,30910,23)),Promise.resolve().then(t.t.bind(t,81885,23)),Promise.resolve().then(t.bind(t,72002)),Promise.resolve().then(t.t.bind(t,29820,23))},81885:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(69278),t(14978);let r=t(66995);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},29820:function(){}},function(e){e.O(0,[583,540,640,215,620,770,304,339,995,954,378,374,235,873,631,106,998,2,470,730,744],function(){return e(e.s=23626)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[11],{61377:function(e,n,s){Promise.resolve().then(s.t.bind(s,63512,23)),Promise.resolve().then(s.bind(s,72002))}},function(e){e.O(0,[583,540,640,215,620,770,304,339,995,954,378,374,235,873,631,106,998,2,470,730,744],function(){return e(e.s=61377)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{26428:function(e,t,n){Promise.resolve().then(n.bind(n,30224)),Promise.resolve().then(n.t.bind(n,82988,23)),Promise.resolve().then(n.t.bind(n,5100,23))},30224:function(e,t,n){"use strict";n.r(t),n.d(t,{PageShell:function(){return T}});var r=n(24004),s=n(14978),o=n(52428),i=n(32414),a=n(38640),l=n.n(a),u=n(28891),c=n(95707),d=n(80378);function h(e){let{darkMode:t,onToggleDarkMode:n}=e;return(0,r.jsx)("div",{className:"dark-mode-toggle",onClick:n,children:t?(0,r.jsx)(c.Z,{}):(0,r.jsx)(d.Z,{})})}n(32854);var f=n(1445),m=n(31657),x=n(77656),g=n(36273),j=n(96976);function p(){let{user:e,logout:t}=(0,f.aC)(),[n,o]=s.useState(null),i=()=>{o(null)},a=async()=>{null==t||t(),i()};return e?(0,r.jsxs)("div",{children:[(0,r.jsx)(x.Z,{edge:"end","aria-label":"account of current user","aria-controls":"menu-appbar","aria-haspopup":"true",onClick:e=>{o(e.currentTarget)},color:"inherit",children:(0,r.jsx)(m.Z,{sx:{width:"1em",height:"1em",bgcolor:"#1976d2"}})}),(0,r.jsxs)(g.Z,{id:"menu-appbar",anchorEl:n,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!n,onClose:i,children:[(0,r.jsxs)(j.Z,{disabled:!0,children:["Logged in as ",e.email]}),(0,r.jsx)(j.Z,{onClick:a,children:"Logout"})]})]}):(0,r.jsx)(l(),{href:"/auth/signup/",children:(0,r.jsx)(x.Z,{edge:"end","aria-label":"User not logged in","aria-controls":"menu-appbar","aria-haspopup":"true",color:"inherit",children:(0,r.jsx)(m.Z,{sx:{width:"1em",height:"1em"}})})})}var v=n(49567),b=n(47051),E=n.n(b);function _(){return(0,r.jsxs)(v.Z,{className:"logo",children:[(0,r.jsx)(E(),{width:25,height:25,src:"/logo.svg",alt:"Promptfoo logo"})," ",(0,r.jsx)("span",{children:"promptfoo"})]})}n(17328),n(5008);var k=n(77580);function N(e){let{href:t,label:n}=e,s=(0,u.usePathname)()||"";return(0,r.jsx)(l(),{href:t,className:s.startsWith(t)?"active":"",children:n})}function O(e){let{darkMode:t,onToggleDarkMode:n}=e;return k.env.NEXT_PUBLIC_NO_BROWSING?(0,r.jsxs)(i.Z,{direction:"row",spacing:2,className:"nav",children:[(0,r.jsx)(_,{}),(0,r.jsx)(h,{darkMode:t,onToggleDarkMode:n})]}):(0,r.jsxs)(i.Z,{direction:"row",spacing:2,className:"nav",children:[(0,r.jsx)(_,{}),(0,r.jsx)(N,{href:"/setup",label:"New Eval"}),(0,r.jsx)(N,{href:"/eval",label:"Evals"}),(0,r.jsx)(N,{href:"/prompts",label:"Prompts"}),(0,r.jsx)(N,{href:"/datasets",label:"Datasets"}),(0,r.jsx)(N,{href:"/progress",label:"Progress"}),(0,r.jsxs)("div",{className:"right-aligned",children:[o.Ox?(0,r.jsx)(p,{}):null,(0,r.jsx)(h,{darkMode:t,onToggleDarkMode:n})]})]})}var C=n(51867),P=n(61191),S=n(38127);function Z(e){let{children:t}=e;return(0,r.jsx)("div",{children:t})}function T(e){let{children:t}=e,n=(0,S.Z)("(prefers-color-scheme: dark)"),[o,i]=s.useState(n),a=s.useMemo(()=>(0,C.Z)({typography:{fontFamily:"inherit"},palette:{mode:o||n?"dark":"light"}}),[o,n]);return s.useEffect(()=>{n&&document.documentElement.setAttribute("data-theme","dark")},[n]),(0,r.jsx)(s.StrictMode,{children:(0,r.jsx)(P.Z,{theme:a,children:(0,r.jsx)(f.Ho,{children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(O,{darkMode:o,onToggleDarkMode:()=>{i(!o),o?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme","dark")}}),(0,r.jsx)("div",{children:t})]})})})})}n(70894)},52428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return o},T8:function(){return s},eA:function(){return i}});var r=n(77580);let s=!r.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,o=!!r.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,i=""},1445:function(e,t,n){"use strict";n.d(t,{Ho:function(){return d},OQ:function(){return i},aC:function(){return l}});var r=n(24004),s=n(14978),o=n(12594);let i=(0,o.createClientComponentClient)(),a=(0,s.createContext)({}),l=()=>(0,s.useContext)(a),u=(e,t)=>i.auth.signInWithPassword({email:e,password:t}),c=()=>i.auth.signOut(),d=e=>{let{children:t}=e,[n,o]=(0,s.useState)(null),[l,d]=(0,s.useState)(!1),h=(0,s.useCallback)(async()=>{let{data:e,error:t}=await i.auth.refreshSession();e&&o(e.user)},[]);return(0,s.useEffect)(()=>{h();let{data:e}=i.auth.onAuthStateChange(async(e,t)=>{"PASSWORD_RECOVERY"==e?d(!1):"SIGNED_IN"===e&&t?(o(t.user),d(!0)):"SIGNED_OUT"===e&&(d(!1),o(null))});return()=>{e.subscription.unsubscribe()}},[h]),(0,r.jsx)(a.Provider,{value:{loggedIn:l,user:n,login:u,logout:c},children:t})}},32854:function(){},17328:function(){},5008:function(){},70894:function(){},5100:function(){}},function(e){e.O(0,[540,640,620,954,166,470,730,744],function(){return e(e.s=26428)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{56452:function(e,t,n){Promise.resolve().then(n.bind(n,30224)),Promise.resolve().then(n.t.bind(n,65246,23)),Promise.resolve().then(n.t.bind(n,5100,23))},30224:function(e,t,n){"use strict";n.r(t),n.d(t,{PageShell:function(){return T}});var r=n(24004),s=n(14978),o=n(52428),i=n(32414),a=n(38640),l=n.n(a),u=n(28891),c=n(95707),d=n(80378);function h(e){let{darkMode:t,onToggleDarkMode:n}=e;return(0,r.jsx)("div",{className:"dark-mode-toggle",onClick:n,children:t?(0,r.jsx)(c.Z,{}):(0,r.jsx)(d.Z,{})})}n(32854);var f=n(1445),m=n(31657),x=n(77656),g=n(36273),j=n(96976);function p(){let{user:e,logout:t}=(0,f.aC)(),[n,o]=s.useState(null),i=()=>{o(null)},a=async()=>{null==t||t(),i()};return e?(0,r.jsxs)("div",{children:[(0,r.jsx)(x.Z,{edge:"end","aria-label":"account of current user","aria-controls":"menu-appbar","aria-haspopup":"true",onClick:e=>{o(e.currentTarget)},color:"inherit",children:(0,r.jsx)(m.Z,{sx:{width:"1em",height:"1em",bgcolor:"#1976d2"}})}),(0,r.jsxs)(g.Z,{id:"menu-appbar",anchorEl:n,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!n,onClose:i,children:[(0,r.jsxs)(j.Z,{disabled:!0,children:["Logged in as ",e.email]}),(0,r.jsx)(j.Z,{onClick:a,children:"Logout"})]})]}):(0,r.jsx)(l(),{href:"/auth/signup/",children:(0,r.jsx)(x.Z,{edge:"end","aria-label":"User not logged in","aria-controls":"menu-appbar","aria-haspopup":"true",color:"inherit",children:(0,r.jsx)(m.Z,{sx:{width:"1em",height:"1em"}})})})}var v=n(49567),b=n(47051),E=n.n(b);function _(){return(0,r.jsxs)(v.Z,{className:"logo",children:[(0,r.jsx)(E(),{width:25,height:25,src:"/logo.svg",alt:"Promptfoo logo"})," ",(0,r.jsx)("span",{children:"promptfoo"})]})}n(17328),n(5008);var k=n(77580);function N(e){let{href:t,label:n}=e,s=(0,u.usePathname)()||"";return(0,r.jsx)(l(),{href:t,className:s.startsWith(t)?"active":"",children:n})}function O(e){let{darkMode:t,onToggleDarkMode:n}=e;return k.env.NEXT_PUBLIC_NO_BROWSING?(0,r.jsxs)(i.Z,{direction:"row",spacing:2,className:"nav",children:[(0,r.jsx)(_,{}),(0,r.jsx)(h,{darkMode:t,onToggleDarkMode:n})]}):(0,r.jsxs)(i.Z,{direction:"row",spacing:2,className:"nav",children:[(0,r.jsx)(_,{}),(0,r.jsx)(N,{href:"/setup",label:"New Eval"}),(0,r.jsx)(N,{href:"/eval",label:"Evals"}),(0,r.jsx)(N,{href:"/prompts",label:"Prompts"}),(0,r.jsx)(N,{href:"/datasets",label:"Datasets"}),(0,r.jsx)(N,{href:"/progress",label:"Progress"}),(0,r.jsxs)("div",{className:"right-aligned",children:[o.Ox?(0,r.jsx)(p,{}):null,(0,r.jsx)(h,{darkMode:t,onToggleDarkMode:n})]})]})}var C=n(51867),P=n(61191),S=n(38127);function Z(e){let{children:t}=e;return(0,r.jsx)("div",{children:t})}function T(e){let{children:t}=e,n=(0,S.Z)("(prefers-color-scheme: dark)"),[o,i]=s.useState(n),a=s.useMemo(()=>(0,C.Z)({typography:{fontFamily:"inherit"},palette:{mode:o||n?"dark":"light"}}),[o,n]);return s.useEffect(()=>{n&&document.documentElement.setAttribute("data-theme","dark")},[n]),(0,r.jsx)(s.StrictMode,{children:(0,r.jsx)(P.Z,{theme:a,children:(0,r.jsx)(f.Ho,{children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(O,{darkMode:o,onToggleDarkMode:()=>{i(!o),o?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme","dark")}}),(0,r.jsx)("div",{children:t})]})})})})}n(70894)},52428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return o},T8:function(){return s},eA:function(){return i}});var r=n(77580);let s=!r.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,o=!!r.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,i=""},1445:function(e,t,n){"use strict";n.d(t,{Ho:function(){return d},OQ:function(){return i},aC:function(){return l}});var r=n(24004),s=n(14978),o=n(12594);let i=(0,o.createClientComponentClient)(),a=(0,s.createContext)({}),l=()=>(0,s.useContext)(a),u=(e,t)=>i.auth.signInWithPassword({email:e,password:t}),c=()=>i.auth.signOut(),d=e=>{let{children:t}=e,[n,o]=(0,s.useState)(null),[l,d]=(0,s.useState)(!1),h=(0,s.useCallback)(async()=>{let{data:e,error:t}=await i.auth.refreshSession();e&&o(e.user)},[]);return(0,s.useEffect)(()=>{h();let{data:e}=i.auth.onAuthStateChange(async(e,t)=>{"PASSWORD_RECOVERY"==e?d(!1):"SIGNED_IN"===e&&t?(o(t.user),d(!0)):"SIGNED_OUT"===e&&(d(!1),o(null))});return()=>{e.subscription.unsubscribe()}},[h]),(0,r.jsx)(a.Provider,{value:{loggedIn:l,user:n,login:u,logout:c},children:t})}},32854:function(){},17328:function(){},5008:function(){},70894:function(){},5100:function(){}},function(e){e.O(0,[540,640,620,954,858,470,730,744],function(){return e(e.s=56452)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{89364:function(e,n,t){Promise.resolve().then(t.t.bind(t,16662,23)),Promise.resolve().then(t.t.bind(t,27924,23)),Promise.resolve().then(t.t.bind(t,30910,23)),Promise.resolve().then(t.t.bind(t,81885,23)),Promise.resolve().then(t.t.bind(t,48607,23))},81885:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(69278),t(14978);let r=t(66995);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},48607:function(){}},function(e){e.O(0,[470,730,744],function(){return e(e.s=89364)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{17633:function(e,n,t){Promise.resolve().then(t.t.bind(t,16662,23)),Promise.resolve().then(t.t.bind(t,27924,23)),Promise.resolve().then(t.t.bind(t,30910,23)),Promise.resolve().then(t.t.bind(t,81885,23)),Promise.resolve().then(t.t.bind(t,48607,23))},81885:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(69278),t(14978);let r=t(66995);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},48607:function(){}},function(e){e.O(0,[470,730,744],function(){return e(e.s=17633)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[92],{48931:function(e,t,i){"use strict";var a=i(71851);t.Z=void 0;var r=a(i(99570)),n=i(24004);t.Z=(0,r.default)((0,n.jsx)("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}),"Download")},96212:function(e,t,i){"use strict";i.d(t,{f:function(){return n}});var a=i(25800),r=i(46213);function n(e){return(0,r.ZP)("MuiListItemIcon",e)}let o=(0,a.Z)("MuiListItemIcon",["root","alignItemsFlexStart"]);t.Z=o},53975:function(e,t,i){"use strict";i.d(t,{L:function(){return n}});var a=i(25800),r=i(46213);function n(e){return(0,r.ZP)("MuiListItemText",e)}let o=(0,a.Z)("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);t.Z=o},96976:function(e,t,i){"use strict";i.d(t,{Z:function(){return M}});var a=i(94312),r=i(79042),n=i(14978),o=i(53468),s=i(3982),l=i(13477),d=i(31608),c=i(11874),u=i(89020),p=i(11112),v=i(30151),m=i(16656),h=i(41776),x=i(25800);let Z=(0,x.Z)("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);var f=i(96212),g=i(53975),C=i(46213);function I(e){return(0,C.ZP)("MuiMenuItem",e)}let j=(0,x.Z)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var b=i(24004);let y=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],P=e=>{let{disabled:t,dense:i,divider:a,disableGutters:n,selected:o,classes:l}=e,d=(0,s.Z)({root:["root",i&&"dense",t&&"disabled",!n&&"gutters",a&&"divider",o&&"selected"]},I,l);return(0,r.Z)({},l,d)},w=(0,d.ZP)(v.Z,{shouldForwardProp:e=>(0,c.Z)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:i}=e;return[t.root,i.dense&&t.dense,i.divider&&t.divider,!i.disableGutters&&t.gutters]}})(({theme:e,ownerState:t})=>(0,r.Z)({},e.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!t.disableGutters&&{paddingLeft:16,paddingRight:16},t.divider&&{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${j.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${j.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${j.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${j.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${j.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${Z.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${Z.inset}`]:{marginLeft:52},[`& .${g.Z.root}`]:{marginTop:0,marginBottom:0},[`& .${g.Z.inset}`]:{paddingLeft:36},[`& .${f.Z.root}`]:{minWidth:36}},!t.dense&&{[e.breakpoints.up("sm")]:{minHeight:"auto"}},t.dense&&(0,r.Z)({minHeight:32,paddingTop:4,paddingBottom:4},e.typography.body2,{[`& .${f.Z.root} svg`]:{fontSize:"1.25rem"}}))),k=n.forwardRef(function(e,t){let i;let s=(0,u.Z)({props:e,name:"MuiMenuItem"}),{autoFocus:l=!1,component:d="li",dense:c=!1,divider:v=!1,disableGutters:x=!1,focusVisibleClassName:Z,role:f="menuitem",tabIndex:g,className:C}=s,I=(0,a.Z)(s,y),j=n.useContext(p.Z),k=n.useMemo(()=>({dense:c||j.dense||!1,disableGutters:x}),[j.dense,c,x]),M=n.useRef(null);(0,m.Z)(()=>{l&&M.current&&M.current.focus()},[l]);let F=(0,r.Z)({},s,{dense:k.dense,divider:v,disableGutters:x}),S=P(s),$=(0,h.Z)(M,t);return s.disabled||(i=void 0!==g?g:-1),(0,b.jsx)(p.Z.Provider,{value:k,children:(0,b.jsx)(w,(0,r.Z)({ref:$,role:f,tabIndex:i,component:d,focusVisibleClassName:(0,o.Z)(S.focusVisible,Z),className:(0,o.Z)(S.root,C)},I,{ownerState:F,classes:S}))})});var M=k},9147:function(e,t,i){Promise.resolve().then(i.bind(i,19259))},19259:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return I}});var a=i(24004),r=i(14978),n=i(48931),o=i(68873),s=i(49567),l=i(40982),d=i(36273),c=i(96976),u=i(30469),p=i(65068),v=i(70417),m=i(21303),h=i(26485),x=i(30021),Z=i(19708),f=i(67339),g=i(38640),C=i.n(g);function I(){let[e,t]=(0,r.useState)([]),[i,g]=(0,r.useState)(null),[I,j]=(0,r.useState)("asc"),[b,y]=(0,r.useState)(null),[P,w]=r.useState(1),[k,M]=(0,r.useState)({evalId:"",datasetId:"",provider:"",promptId:""}),F=!!b;(0,r.useEffect)(()=>{(async()=>{let e=await fetch("/api/progress"),i=await e.json();i&&i.data&&t(i.data)})()},[]);let S=e=>{let t=i===e&&"asc"===I;g(e),j(t?"desc":"asc")},$=e=>(null==e?void 0:e.testPassCount)!=null&&(null==e?void 0:e.testFailCount)!=null?(e.testPassCount/(e.testPassCount+e.testFailCount)*100).toFixed(2):"-",O=e=>{var t,i,a,r,n;let o=e.map(e=>{var o,s,l,d,c,u;return[null!==(t=e.evalId)&&void 0!==t?t:"",null!==(i=null===(o=e.datasetId)||void 0===o?void 0:o.slice(0,6))&&void 0!==i?i:"",null!==(a=e.provider)&&void 0!==a?a:"",(null!==(r=null===(s=e.promptId)||void 0===s?void 0:s.slice(0,6))&&void 0!==r?r:"")+" "+(null!==(n=e.raw)&&void 0!==n?n:""),$(e.metrics),(null===(l=e.metrics)||void 0===l?void 0:l.testPassCount)==null?"-":"".concat(e.metrics.testPassCount),(null===(d=e.metrics)||void 0===d?void 0:d.testFailCount)==null?"-":"".concat(e.metrics.testFailCount),(null===(c=e.metrics)||void 0===c?void 0:c.score)==null?"-":null===(u=e.metrics.score)||void 0===u?void 0:u.toFixed(2)]});return[["Eval","Dataset","Provider","Prompt","Pass Rate %","Pass Count","Fail Count","Raw score"]].concat(o).map(e=>e.map(e=>null!=e?e:"").join(",")).join("\n")},R=t=>{let i="json"===t?JSON.stringify(e):O(e),a=new Blob([i],{type:"text/".concat(t,";charset=utf-8;")}),r=document.createElement("a");r.href=URL.createObjectURL(a),r.download="cols_export.".concat(t),r.click(),URL.revokeObjectURL(r.href),y(null)},L=r.useMemo(()=>e.filter(e=>{var t,i,a,r;return(!k.evalId||(null===(t=e.evalId)||void 0===t?void 0:t.includes(k.evalId)))&&(!k.datasetId||(null===(i=e.datasetId)||void 0===i?void 0:i.startsWith(k.datasetId)))&&(!k.provider||(null===(a=e.provider)||void 0===a?void 0:a.includes(k.provider)))&&(!k.promptId||(null===(r=e.promptId)||void 0===r?void 0:r.startsWith(k.promptId)))}),[e,k]),D=r.useMemo(()=>L.sort((e,t)=>{if(!i)return 0;if("passRate"===i){let i=parseFloat($(e.metrics)),a=parseFloat($(t.metrics));return"asc"===I?i-a:a-i}if(i in e&&i in t){let a=e[i]||"",r=t[i]||"";return"asc"===I?a.toString().localeCompare(r.toString()):r.toString().localeCompare(a.toString())}return 0}),[L,i,I]),E=r.useMemo(()=>Array.from(new Set(e.map(e=>e.evalId))),[e]),V=r.useMemo(()=>Array.from(new Set(e.map(e=>e.datasetId))),[e]),N=r.useMemo(()=>Array.from(new Set(e.map(e=>e.provider))),[e]),z=r.useMemo(()=>Array.from(new Set(e.map(e=>e.promptId))),[e]);return(0,a.jsxs)(s.Z,{paddingX:2,children:[(0,a.jsxs)(s.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,a.jsx)("h2",{children:"Progress summary"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.Z,{id:"export-button","aria-controls":F?"export-menu":void 0,"aria-haspopup":"true","aria-expanded":F?"true":void 0,onClick:e=>{y(e.currentTarget)},startIcon:(0,a.jsx)(n.Z,{}),children:"Export"}),(0,a.jsxs)(d.Z,{id:"export-menu",anchorEl:b,open:F,onClose:()=>{y(null)},MenuListProps:{"aria-labelledby":"export-button"},children:[(0,a.jsx)(c.Z,{onClick:()=>R("csv"),children:"CSV"}),(0,a.jsx)(c.Z,{onClick:()=>R("json"),children:"JSON"})]})]})]}),(0,a.jsx)(s.Z,{children:"This page shows performance metrics for recent evals."}),(0,a.jsxs)(s.Z,{display:"flex",flexDirection:"row",gap:2,mt:2,children:[(0,a.jsx)(o.Z,{options:E,value:k.evalId,onChange:(e,t)=>{M({...k,evalId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Eval ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:V,value:k.datasetId,onChange:(e,t)=>{M({...k,datasetId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Dataset ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:N,value:k.provider,onChange:(e,t)=>{M({...k,provider:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Provider",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:z,value:k.promptId,onChange:(e,t)=>{M({...k,promptId:t||""})},renderInput:e=>(0,a.jsx)(f.Z,{...e,label:"Prompt ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(h.Z,{children:(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"evalId"===i,direction:"evalId"===i?I:"asc",onClick:()=>S("evalId"),children:"Eval"})}),(0,a.jsx)(m.Z,{children:"Dataset"}),(0,a.jsx)(m.Z,{children:"Provider"}),(0,a.jsx)(m.Z,{children:"Prompt"}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"passRate"===i,direction:"passRate"===i?I:"asc",onClick:()=>S("passRate"),children:"Pass Rate %"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"testPassCount"===i,direction:"testPassCount"===i?I:"asc",onClick:()=>S("testPassCount"),children:"Pass Count"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"testFailCount"===i,direction:"testFailCount"===i?I:"asc",onClick:()=>S("testFailCount"),children:"Fail Count"})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(Z.Z,{active:"score"===i,direction:"score"===i?I:"asc",onClick:()=>S("score"),children:"Raw score"})})]})}),(0,a.jsx)(v.Z,{children:D.slice((P-1)*25,25*P).map((e,t)=>{var i,r,n,o,s,l;return(0,a.jsxs)(x.Z,{hover:!0,onClick:()=>M({...k,evalId:e.evalId,datasetId:e.datasetId||"",promptId:e.promptId||"",provider:e.provider}),children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(C(),{href:"/eval?evalId=".concat(e.evalId),onClick:e=>e.stopPropagation(),children:e.evalId})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(C(),{href:"/datasets?id=".concat(e.datasetId),onClick:e=>e.stopPropagation(),children:null===(i=e.datasetId)||void 0===i?void 0:i.slice(0,6)})}),(0,a.jsx)(m.Z,{children:e.provider}),(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)(C(),{href:"/prompts?id=".concat(e.promptId),onClick:e=>e.stopPropagation(),children:["[",null===(r=e.promptId)||void 0===r?void 0:r.slice(0,6),"]"]})," ",e.raw]}),(0,a.jsx)(m.Z,{children:$(e.metrics)}),(0,a.jsx)(m.Z,{children:(null===(n=e.metrics)||void 0===n?void 0:n.testPassCount)==null?"-":"".concat(e.metrics.testPassCount)}),(0,a.jsx)(m.Z,{children:(null===(o=e.metrics)||void 0===o?void 0:o.testFailCount)==null?"-":"".concat(e.metrics.testFailCount)}),(0,a.jsx)(m.Z,{children:(null===(s=e.metrics)||void 0===s?void 0:s.score)==null?"-":null===(l=e.metrics.score)||void 0===l?void 0:l.toFixed(2)})]},t)})})]}),Math.ceil(L.length/25)>1&&(0,a.jsx)(u.Z,{count:Math.ceil(D.length/25),page:P,onChange:(e,t)=>w(t),sx:{pt:2,pb:4,display:"flex",justifyContent:"center"}})]})}}},function(e){e.O(0,[540,640,215,620,770,304,339,378,873,322,470,730,744],function(){return e(e.s=9147)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[794],{30744:function(e,t,i){Promise.resolve().then(i.bind(i,73730))},49532:function(e,t,i){"use strict";let n,s;async function l(){if(n||(s||(s=fetch("/api/config").then(e=>e.json()).then(e=>n=e.apiBaseUrl)),await s),void 0===n)throw Error("API base URL is undefined");return n}i.d(t,{b:function(){return l}})},73730:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return I}});var n=i(24004),s=i(14978),l=i(49532),r=i(49567),c=i(30469),d=i(65068),a=i(70417),o=i(21303),h=i(26485),u=i(30021),x=i(19708),j=i(65969),Z=i(38640),v=i.n(Z),p=i(28891),f=i(40982),m=i(29794),w=i(22701),y=i(51956),C=i(82669),g=i(613),E=i(63147),k=e=>{var t;let{openDialog:i,handleClose:s,selectedPrompt:l}=e;return(0,n.jsxs)(m.Z,{open:i,onClose:s,fullWidth:!0,maxWidth:"lg",children:[(0,n.jsxs)(C.Z,{children:["Prompt ",l.id.slice(0,6)]}),(0,n.jsxs)(y.Z,{children:[(0,n.jsx)(E.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Prompt"}),(0,n.jsx)(g.u,{readOnly:!0,value:null==l?void 0:null===(t=l.prompt)||void 0===t?void 0:t.raw,style:{width:"100%",padding:"0.75rem"},maxRows:50}),(0,n.jsx)(E.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(h.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{children:"Eval ID"}),(0,n.jsx)(o.Z,{children:"Dataset ID"}),(0,n.jsx)(o.Z,{children:"Raw score"}),(0,n.jsx)(o.Z,{children:"Pass rate"}),(0,n.jsx)(o.Z,{children:"Pass count"}),(0,n.jsx)(o.Z,{children:"Fail count"})]})}),(0,n.jsx)(a.Z,{children:null==l?void 0:l.evals.sort((e,t)=>t.id.localeCompare(e.id)).map(e=>{var t,i,s,l,r,c,d;let a=null!==(r=null===(t=e.metrics)||void 0===t?void 0:t.testPassCount)&&void 0!==r?r:0,h=null!==(c=null===(i=e.metrics)||void 0===i?void 0:i.testFailCount)&&void 0!==c?c:0,x=a+h>0?(a/(a+h)*100).toFixed(2)+"%":"-";return(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{children:(0,n.jsx)(v(),{href:"/eval/?evalId=".concat(e.id),children:e.id})}),(0,n.jsx)(o.Z,{children:(0,n.jsx)(v(),{href:"/datasets/?id=".concat(e.datasetId),children:e.datasetId.slice(0,6)})}),(0,n.jsx)(o.Z,{children:null!==(d=null===(l=e.metrics)||void 0===l?void 0:null===(s=l.score)||void 0===s?void 0:s.toFixed(2))&&void 0!==d?d:"-"}),(0,n.jsx)(o.Z,{children:x}),(0,n.jsx)(o.Z,{children:a}),(0,n.jsx)(o.Z,{children:h})]},"eval-".concat(e.id))})})]})]}),(0,n.jsx)(w.Z,{children:(0,n.jsx)(f.Z,{onClick:s,children:"Close"})})]})};function I(){let e=(0,p.useSearchParams)(),[t,i]=(0,s.useState)([]),[Z,f]=(0,s.useState)("date"),[m,w]=(0,s.useState)("desc"),[y,C]=(0,s.useState)(1),[g,E]=(0,s.useState)(10),[I,P]=(0,s.useState)(!1),[S,D]=(0,s.useState)(0),b=e=>{let t=Z===e&&"asc"===m?"desc":"asc";f(e),w(t)};(0,s.useEffect)(()=>{(async()=>{fetch("".concat(await (0,l.b)(),"/api/prompts")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===Z?0:"asc"===m?e[Z]>t[Z]?1:-1:e[Z]<t[Z]?1:-1);i(t)})})()},[Z,m]);let _=e=>{P(!0),D(e)};return(0,s.useEffect)(()=>{let i=null==e?void 0:e.get("id");if(i){let e=t.findIndex(e=>e.id.startsWith(i));-1!==e&&_(e)}},[t,e]),(0,n.jsxs)(r.Z,{paddingX:2,children:[(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(h.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(o.Z,{style:{width:"10%"},children:"ID"}),(0,n.jsx)(o.Z,{style:{width:"60%"},children:(0,n.jsx)(x.Z,{active:"raw"===Z,direction:"raw"===Z?m:"asc",onClick:()=>b("raw"),children:"Prompt"})}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:(0,n.jsx)(j.Z,{title:"The date of the most recent eval for this prompt",children:(0,n.jsx)(x.Z,{active:"date"===Z,direction:"date"===Z?m:"asc",onClick:()=>b("date"),children:"Most recent eval"})})}),(0,n.jsx)(o.Z,{style:{width:"10%"},children:(0,n.jsx)(x.Z,{active:"count"===Z,direction:"count"===Z?m:"asc",onClick:()=>b("count"),children:"# Evals"})})]})}),(0,n.jsx)(a.Z,{children:t.slice((y-1)*g,y*g).map((e,t)=>(0,n.jsxs)(u.Z,{hover:!0,children:[(0,n.jsx)(o.Z,{style:{width:"10%"},children:e.id.slice(0,6)}),(0,n.jsx)(o.Z,{style:{width:"60%",whiteSpace:"pre-wrap",cursor:"pointer"},onClick:()=>_(t),children:e.prompt.raw.length>500?e.prompt.raw.slice(0,500)+"...":e.prompt.raw}),(0,n.jsx)(o.Z,{style:{width:"20%"},children:e.recentEvalDate?(0,n.jsx)(v(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalDate}):"Unknown"}),(0,n.jsx)(o.Z,{style:{width:"10%"},children:e.count})]},t))})]}),Math.ceil(t.length/g)>1&&(0,n.jsx)(c.Z,{count:Math.ceil(t.length/g),page:y,onChange:(e,t)=>C(t)}),t[S]&&(0,n.jsx)(k,{openDialog:I,handleClose:()=>{P(!1)},selectedPrompt:t[S]})]})}}},function(e){e.O(0,[540,640,215,770,995,374,322,470,730,744],function(){return e(e.s=30744)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[420],{92892:function(e,i,t){Promise.resolve().then(t.bind(t,37493))},49532:function(e,i,t){"use strict";let a,r;async function s(){if(a||(r||(r=fetch("/api/config").then(e=>e.json()).then(e=>a=e.apiBaseUrl)),await r),void 0===a)throw Error("API base URL is undefined");return a}t.d(i,{b:function(){return s}})},37493:function(e,i,t){"use strict";t.r(i),t.d(i,{default:function(){return G}});var a,r,s=t(24004),n=t(14978),l=t(49532),o=t(885),c=t(11520),m=t(93650),u=t(63147),h=t(80661),d=t(49578);let p={"Brand Risk":["competitors","politics","excessive-agency","hallucination","overreliance","harmful:graphic-content","harmful:indiscriminate-weapons","harmful:misinformation-disinformation","harmful:non-violent-crime","harmful:radicalization","harmful:unsafe-practices"],"Legal Risk":["harmful:child-exploitation","harmful:copyright-violations","harmful:cybercrime","harmful:illegal-activities","harmful:illegal-drugs","harmful:intellectual-property","harmful:privacy","harmful:sex-crime","harmful:sexual-content","harmful:specialized-advice","harmful:violent-crime","harmful:self-harm","contracts"],"Malicious Attacks":["harmful:harassment-bullying","harmful:hate","harmful:insults","harmful:profanity","hijacking","jailbreak","pii","prompt-injection"]},f={"Brand Risk":"Risks that can affect the brand reputation and trustworthiness.","Legal Risk":"Risks that can lead to legal consequences or violations.","Malicious Attacks":"Risks involving malicious activities targeting the system or users."},g={"excessive-agency":"Model taking excessive initiative or misunderstanding its capabilities.","harmful:child-exploitation":"Content exploiting or harming children.","harmful:copyright-violations":"Content violating copyright laws.","harmful:cybercrime":"Content related to cybercriminal activities.","harmful:graphic-content":"Displaying graphic or violent content.","harmful:harassment-bullying":"Content that harasses or bullies individuals.","harmful:hate":"Content that promotes hate or discrimination.","harmful:illegal-activities":"Content promoting illegal activities.","harmful:illegal-drugs":"Content related to illegal drug use or trade.","harmful:indiscriminate-weapons":"Content related to weapons without context.","harmful:insults":"Content that insults or demeans individuals.","harmful:intellectual-property":"Content violating intellectual property rights.","harmful:misinformation-disinformation":"Spreading false or misleading information.","harmful:non-violent-crime":"Content related to non-violent criminal activities.","harmful:privacy":"Content violating privacy rights.","harmful:profanity":"Content containing profane or inappropriate language.","harmful:radicalization":"Content that promotes radical or extremist views.","harmful:self-harm":"Content that encourages self-harm or suicide.","harmful:sex-crime":"Content related to sexual crimes.","harmful:sexual-content":"Explicit or inappropriate sexual content.","harmful:specialized-advice":"Providing advice in specialized fields without expertise.","harmful:unsafe-practices":"Content promoting unsafe or harmful practices.","harmful:violent-crime":"Content related to violent criminal activities.","prompt-injection":"Malicious inputs designed to manipulate the model's behavior.",competitors:"Competitor mentions and endorsements",contracts:"Enters business or legal commitments without supervision.",hallucination:"Model generating false or misleading information.",hijacking:"Unauthorized or off-topic resource use.",jailbreak:"Bypassing security measures or restrictions.",overreliance:"Model susceptible to relying on an incorrect user assumption or input.",pii:"Exposure or misuse of personally identifiable information.",politics:"Makes political statements."};(a=r||(r={})).Critical="Critical",a.High="High",a.Medium="Medium",a.Low="Low";let v={"excessive-agency":r.Medium,"harmful:child-exploitation":r.Critical,"harmful:copyright-violations":r.Medium,"harmful:cybercrime":r.High,"harmful:graphic-content":r.Medium,"harmful:harassment-bullying":r.High,"harmful:hate":r.Critical,"harmful:illegal-activities":r.High,"harmful:illegal-drugs":r.High,"harmful:indiscriminate-weapons":r.Medium,"harmful:insults":r.Low,"harmful:intellectual-property":r.Medium,"harmful:misinformation-disinformation":r.Medium,"harmful:non-violent-crime":r.Medium,"harmful:privacy":r.High,"harmful:profanity":r.Low,"harmful:radicalization":r.High,"harmful:self-harm":r.Critical,"harmful:sex-crime":r.Critical,"harmful:sexual-content":r.High,"harmful:specialized-advice":r.High,"harmful:unsafe-practices":r.Low,"harmful:violent-crime":r.Critical,"prompt-injection":r.Medium,competitors:r.Low,contracts:r.Medium,hallucination:r.Medium,hijacking:r.High,jailbreak:r.Medium,overreliance:r.Low,pii:r.High,politics:r.Low},x=Object.entries(p).reduce((e,i)=>{let[t,a]=i;return a.forEach(i=>{e[i]=t}),e},{});Object.keys(x);let y={"excessive-agency":"ExcessiveAgency","harmful:child-exploitation":"Child Exploitation","harmful:copyright-violations":"Copyright Violations","harmful:cybercrime":"Cybercrime","harmful:graphic-content":"Graphic Content","harmful:harassment-bullying":"Harassment & Bullying","harmful:hate":"Hate","harmful:illegal-activities":"Illegal Activities","harmful:illegal-drugs":"Illegal Drugs","harmful:indiscriminate-weapons":"Indiscriminate Weapons","harmful:insults":"Insults","harmful:intellectual-property":"Intellectual Property","harmful:misinformation-disinformation":"Misinformation & Disinformation","harmful:non-violent-crime":"Non-Violent Crime","harmful:privacy":"Privacy","harmful:profanity":"Profanity","harmful:radicalization":"Radicalization","harmful:self-harm":"Self-Harm","harmful:sex-crime":"Sex Crimes","harmful:sexual-content":"Sexual Content","harmful:specialized-advice":"Specialized Advice","harmful:unsafe-practices":"Other Unsafe Practices","harmful:violent-crime":"Violent Crimes","prompt-injection":"Harmful/Injection",competitors:"CompetitorEndorsement",contracts:"ContractualCommitment",hallucination:"Hallucination",hijacking:"Hijacking",jailbreak:"Harmful/Iterative",overreliance:"Overreliance",pii:"PIILeak",politics:"PoliticalStatement"},j=Object.entries(y).reduce((e,i)=>{let[t,a]=i;return e[a]=t,e},{}),b={"excessive-agency":"Excessive Agency","prompt-injection":"Prompt Injection",competitors:"Competitor Endorsements",contracts:"Unsupervised Contracts",jailbreak:"Jailbreak",pii:"PII Leaks",politics:"Political Opinions"};t(4309);var w=e=>{let{categoryStats:i}=e,t=[r.Critical,r.High,r.Medium,r.Low],a=t.reduce((e,t)=>(e[t]=Object.keys(i).reduce((e,i)=>v[i]===t?e+1:e,0),e),{});return(0,s.jsx)(m.ZP,{container:!0,spacing:2,mb:4,children:t.map(e=>(0,s.jsx)(m.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,s.jsx)(h.Z,{className:"card-".concat(e.toLowerCase()),children:(0,s.jsxs)(d.Z,{onClick:()=>window.location.hash="#table",children:[(0,s.jsx)(u.Z,{variant:"body2",component:"div",children:e}),(0,s.jsxs)(u.Z,{variant:"h6",color:"text.primary",children:[a[e]," issues"]})]})})},e))})},Z=t(32414),C=t(63362),k=t(18845),R=t(49567),P=t(47908),A=t(85912),M=t(94941),N=t(65969),L=t(70587);t(46553);var I=e=>{let{title:i,subtitle:t,progressValue:a,numTestsPassed:r,numTestsFailed:n,testTypes:l}=e;return(0,s.jsx)(h.Z,{children:(0,s.jsx)(d.Z,{className:"risk-card-container",children:(0,s.jsxs)(m.ZP,{container:!0,spacing:3,children:[(0,s.jsxs)(m.ZP,{item:!0,xs:12,md:6,style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[(0,s.jsx)(u.Z,{variant:"h5",className:"risk-card-title",children:i}),(0,s.jsx)(u.Z,{variant:"subtitle1",color:"textSecondary",mb:2,children:t}),(0,s.jsx)(R.Z,{sx:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:100,height:100},children:(0,s.jsx)(L.a,{value:a,max:100,thickness:10,arc:{startAngle:-90,endAngle:90,color:"primary.main"},text:"".concat(Math.round(a),"%"),sx:{width:"100%",height:"100%"}})}),(0,s.jsxs)(u.Z,{variant:"h6",className:"risk-card-issues",children:[n," failed probes"]}),(0,s.jsxs)(u.Z,{variant:"subtitle1",color:"textSecondary",className:"risk-card-tests-passed",children:[r,"/",r+n," passed"]})]}),(0,s.jsx)(m.ZP,{item:!0,xs:6,md:4,children:(0,s.jsx)(P.Z,{dense:!0,children:l.map((e,i)=>(0,s.jsx)(N.Z,{title:g[e.name],placement:"left",arrow:!0,children:(0,s.jsxs)(A.ZP,{className:"risk-card-list-item",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId"),a=y[e.name];window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(a,"|metric=").concat(a,")")))},style:{cursor:"pointer"},children:[(0,s.jsx)(M.Z,{primary:b[e.name]||y[e.name],primaryTypographyProps:{variant:"body2"}}),e.passed?(0,s.jsx)(k.Z,{className:"risk-card-icon-passed"}):(0,s.jsx)(C.Z,{className:"risk-card-icon-failed"})]})},i))})})]})})})};t(32991);var F=e=>{let{categoryStats:i}=e,t=Object.keys(p).map(e=>({name:e,passed:p[e].every(e=>{var t,a;return(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)})}));return(0,s.jsx)(Z.Z,{spacing:4,children:t.map((e,t)=>{let a=e.name,r=p[a],n=r.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.pass)||0)},0),l=r.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.total)||0)},0);return(0,s.jsx)(I,{title:e.name,subtitle:f[a],progressValue:n/l*100,numTestsPassed:n,numTestsFailed:l-n,testTypes:r.map(e=>{var t,a;return{name:e,passed:(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)}})},t)})})},H=t(40982),S=t(37803),z=t(65068),E=t(70417),U=t(21303),D=t(61451),O=t(26485),W=t(38592),B=t(30021),T=t(19708),V=t(28891);t(93091);let _=e=>{let i=[];for(let[t,a]of Object.entries(p))for(let t of a)i.push({pluginName:t,type:y[t]||t,description:g[t]||"",passRate:e[t]?(e[t].pass/e[t].total*100).toFixed(1)+"%":"N/A",passRateWithFilter:e[t]?(e[t].passWithFilter/e[t].total*100).toFixed(1)+"%":"N/A",severity:v[t]||"Unknown"});return i.sort((e,i)=>"N/A"===e.passRate?1:"N/A"===i.passRate?-1:parseFloat(e.passRate)-parseFloat(i.passRate))};var q=e=>{let{evalId:i,categoryStats:t}=e;(0,V.useRouter)();let a=_(t).filter(e=>"N/A"!==e.passRate),[r,l]=n.useState(0),[o,c]=n.useState(10),[m,h]=n.useState("asc"),[d,p]=n.useState("default"),f=e=>{let i=d===e&&"asc"===m;h(i?"desc":"asc"),p(e)};return(0,s.jsxs)(R.Z,{children:[(0,s.jsx)(u.Z,{variant:"h6",gutterBottom:!0,id:"table",children:"Vulnerabilities and Mitigations"}),(0,s.jsxs)(D.Z,{component:S.Z,children:[(0,s.jsxs)(z.Z,{children:[(0,s.jsx)(O.Z,{children:(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(U.Z,{children:"Type"}),(0,s.jsx)(U.Z,{children:"Description"}),(0,s.jsx)(U.Z,{children:(0,s.jsx)(T.Z,{active:"passRate"===d,direction:"passRate"===d?m:"asc",onClick:()=>f("passRate"),children:"Pass rate"})}),(0,s.jsx)(U.Z,{children:(0,s.jsx)(T.Z,{active:"severity"===d,direction:"severity"===d?m:"asc",onClick:()=>f("severity"),children:"Severity"})}),(0,s.jsx)(U.Z,{children:"Actions"})]})}),(0,s.jsx)(E.Z,{children:a.sort((e,i)=>{if("passRate"===d)return"N/A"===e.passRate?1:"N/A"===i.passRate?-1:"asc"===m?parseFloat(e.passRate)-parseFloat(i.passRate):parseFloat(i.passRate)-parseFloat(e.passRate);if("severity"===d){if("N/A"===e.passRate)return 1;if("N/A"===i.passRate)return -1;let t={Critical:4,High:3,Medium:2,Low:1};return"asc"===m?t[e.severity]-t[i.severity]:t[i.severity]-t[e.severity]}{let t={Critical:4,High:3,Medium:2,Low:1};return e.severity===i.severity?parseFloat(e.passRate)-parseFloat(i.passRate):t[i.severity]-t[e.severity]}}).slice(r*o,r*o+o).map((e,i)=>{let t="";if("N/A"!==e.passRate){let i=parseFloat(e.passRate);t=i>=75?"pass-high":i>=50?"pass-medium":"pass-low"}return(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(U.Z,{children:b[e.pluginName]||e.type}),(0,s.jsx)(U.Z,{children:e.description}),(0,s.jsxs)(U.Z,{className:t,children:[e.passRate," (",e.passRateWithFilter!==e.passRate?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("strong",{children:[e.passRateWithFilter," with mitigation"]})}):e.passRateWithFilter,")"]}),(0,s.jsx)(U.Z,{className:"vuln-".concat(e.severity.toLowerCase()),children:e.severity}),(0,s.jsxs)(U.Z,{style:{minWidth:270},children:[(0,s.jsx)(H.Z,{variant:"contained",size:"small",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId");window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(e.type,"|metric=").concat(e.type,")")))},children:"View logs"}),(0,s.jsx)(N.Z,{title:"Temporarily disabled while in beta, click to contact us to enable",children:(0,s.jsx)(H.Z,{variant:"contained",size:"small",color:"inherit",style:{marginLeft:8},onClick:()=>{window.location.href="mailto:inquiries@promptfoo.dev?subject=Promptfoo%20automatic%20vulnerability%20mitigation&body=Hello%20Promptfoo%20Team,%0D%0A%0D%0AI%20am%20interested%20in%20learning%20more%20about%20the%20automatic%20vulnerability%20mitigation%20beta.%20Please%20provide%20me%20with%20more%20details.%0D%0A%0D%0A"},children:"Apply mitigation"})})]})]},i)})})]}),a.length>o&&(0,s.jsx)(W.Z,{rowsPerPageOptions:[10,25,50],component:"div",count:a.length,rowsPerPage:o,page:r,onPageChange:(e,i)=>{l(i)},onRowsPerPageChange:e=>{c(parseInt(e.target.value,10)),l(0)}})]})]})};t(67667);var G=()=>{let[e,i]=n.useState(null),[t,a]=n.useState(null);if(n.useEffect(()=>{let e=async e=>{let i=await fetch("".concat(await (0,l.b)(),"/api/results/").concat(e),{cache:"no-store"}),t=await i.json();a(t.data)},t=new URLSearchParams(window.location.search);if(!t)return;let r=t.get("evalId");r&&(i(r),e(r))},[]),!t||!e)return(0,s.jsx)("div",{children:"Loading..."});let r=t.results.table.head.prompts[0],h=t.results.table.body,d=t.results.results.reduce((e,i)=>{var t,a,r,s;let n=i.vars.harmCategory,l=(null===(a=i.gradingResult)||void 0===a?void 0:null===(t=a.componentResults)||void 0===t?void 0:t.map(e=>{var i;return null===(i=e.assertion)||void 0===i?void 0:i.metric}))||[],o=[n,...l].filter(e=>e);for(let t of o){let a=j[t];if(!a){console.log("Unknown harm category:",t);break}let n=i.success;e[a]=e[a]||{pass:0,total:0,passWithFilter:0},e[a].total++,n?(e[a].pass++,e[a].passWithFilter++):(null===(s=i.gradingResult)||void 0===s?void 0:null===(r=s.componentResults)||void 0===r?void 0:r.some(e=>{var i;let t=(null===(i=e.assertion)||void 0===i?void 0:i.type)==="moderation",a=!e.pass;return t&&a}))&&e[a].passWithFilter++}return e},{});return(0,s.jsx)(c.Z,{children:(0,s.jsxs)(m.ZP,{container:!0,direction:"column",spacing:1,pt:6,pb:8,children:[(0,s.jsxs)(m.ZP,{item:!0,className:"report-header",children:[(0,s.jsxs)(u.Z,{variant:"h4",children:[(0,s.jsx)("strong",{children:"LLM Risk Assessment"}),t.config.description&&": ".concat(t.config.description)]}),(0,s.jsx)(u.Z,{variant:"subtitle1",mb:2,children:new Date(t.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),(0,s.jsxs)(u.Z,{variant:"body1",gutterBottom:!0,className:"report-details",children:[(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Model:"})," ",r.provider]})}),(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Dataset:"})," ",h.length," probes"]})}),(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Prompt:"}),' "',r.raw.length>20?"".concat(r.raw.substring(0,20),"..."):r.raw,'"']})})]})]}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(w,{categoryStats:d})}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(F,{categoryStats:d})}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(q,{evalId:e,categoryStats:d})})]})})}},4309:function(){},67667:function(){},46553:function(){},32991:function(){},93091:function(){}},function(e){e.O(0,[540,215,620,770,304,995,378,915,470,730,744],function(){return e(e.s=92892)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[420],{61464:function(e,i,t){Promise.resolve().then(t.bind(t,37493))},49532:function(e,i,t){"use strict";let a,r;async function s(){if(a||(r||(r=fetch("/api/config").then(e=>e.json()).then(e=>a=e.apiBaseUrl)),await r),void 0===a)throw Error("API base URL is undefined");return a}t.d(i,{b:function(){return s}})},37493:function(e,i,t){"use strict";t.r(i),t.d(i,{default:function(){return G}});var a,r,s=t(24004),n=t(14978),l=t(49532),o=t(885),c=t(11520),m=t(93650),u=t(63147),h=t(80661),d=t(49578);let p={"Brand Risk":["competitors","politics","excessive-agency","hallucination","overreliance","harmful:graphic-content","harmful:indiscriminate-weapons","harmful:misinformation-disinformation","harmful:non-violent-crime","harmful:radicalization","harmful:unsafe-practices"],"Legal Risk":["harmful:child-exploitation","harmful:copyright-violations","harmful:cybercrime","harmful:illegal-activities","harmful:illegal-drugs","harmful:intellectual-property","harmful:privacy","harmful:sex-crime","harmful:sexual-content","harmful:specialized-advice","harmful:violent-crime","harmful:self-harm","contracts"],"Malicious Attacks":["harmful:harassment-bullying","harmful:hate","harmful:insults","harmful:profanity","hijacking","jailbreak","pii","prompt-injection"]},f={"Brand Risk":"Risks that can affect the brand reputation and trustworthiness.","Legal Risk":"Risks that can lead to legal consequences or violations.","Malicious Attacks":"Risks involving malicious activities targeting the system or users."},g={"excessive-agency":"Model taking excessive initiative or misunderstanding its capabilities.","harmful:child-exploitation":"Content exploiting or harming children.","harmful:copyright-violations":"Content violating copyright laws.","harmful:cybercrime":"Content related to cybercriminal activities.","harmful:graphic-content":"Displaying graphic or violent content.","harmful:harassment-bullying":"Content that harasses or bullies individuals.","harmful:hate":"Content that promotes hate or discrimination.","harmful:illegal-activities":"Content promoting illegal activities.","harmful:illegal-drugs":"Content related to illegal drug use or trade.","harmful:indiscriminate-weapons":"Content related to weapons without context.","harmful:insults":"Content that insults or demeans individuals.","harmful:intellectual-property":"Content violating intellectual property rights.","harmful:misinformation-disinformation":"Spreading false or misleading information.","harmful:non-violent-crime":"Content related to non-violent criminal activities.","harmful:privacy":"Content violating privacy rights.","harmful:profanity":"Content containing profane or inappropriate language.","harmful:radicalization":"Content that promotes radical or extremist views.","harmful:self-harm":"Content that encourages self-harm or suicide.","harmful:sex-crime":"Content related to sexual crimes.","harmful:sexual-content":"Explicit or inappropriate sexual content.","harmful:specialized-advice":"Providing advice in specialized fields without expertise.","harmful:unsafe-practices":"Content promoting unsafe or harmful practices.","harmful:violent-crime":"Content related to violent criminal activities.","prompt-injection":"Malicious inputs designed to manipulate the model's behavior.",competitors:"Competitor mentions and endorsements",contracts:"Enters business or legal commitments without supervision.",hallucination:"Model generating false or misleading information.",hijacking:"Unauthorized or off-topic resource use.",jailbreak:"Bypassing security measures or restrictions.",overreliance:"Model susceptible to relying on an incorrect user assumption or input.",pii:"Exposure or misuse of personally identifiable information.",politics:"Makes political statements."};(a=r||(r={})).Critical="Critical",a.High="High",a.Medium="Medium",a.Low="Low";let v={"excessive-agency":r.Medium,"harmful:child-exploitation":r.Critical,"harmful:copyright-violations":r.Medium,"harmful:cybercrime":r.High,"harmful:graphic-content":r.Medium,"harmful:harassment-bullying":r.High,"harmful:hate":r.Critical,"harmful:illegal-activities":r.High,"harmful:illegal-drugs":r.High,"harmful:indiscriminate-weapons":r.Medium,"harmful:insults":r.Low,"harmful:intellectual-property":r.Medium,"harmful:misinformation-disinformation":r.Medium,"harmful:non-violent-crime":r.Medium,"harmful:privacy":r.High,"harmful:profanity":r.Low,"harmful:radicalization":r.High,"harmful:self-harm":r.Critical,"harmful:sex-crime":r.Critical,"harmful:sexual-content":r.High,"harmful:specialized-advice":r.High,"harmful:unsafe-practices":r.Low,"harmful:violent-crime":r.Critical,"prompt-injection":r.Medium,competitors:r.Low,contracts:r.Medium,hallucination:r.Medium,hijacking:r.High,jailbreak:r.Medium,overreliance:r.Low,pii:r.High,politics:r.Low},x=Object.entries(p).reduce((e,i)=>{let[t,a]=i;return a.forEach(i=>{e[i]=t}),e},{});Object.keys(x);let y={"excessive-agency":"ExcessiveAgency","harmful:child-exploitation":"Child Exploitation","harmful:copyright-violations":"Copyright Violations","harmful:cybercrime":"Cybercrime","harmful:graphic-content":"Graphic Content","harmful:harassment-bullying":"Harassment & Bullying","harmful:hate":"Hate","harmful:illegal-activities":"Illegal Activities","harmful:illegal-drugs":"Illegal Drugs","harmful:indiscriminate-weapons":"Indiscriminate Weapons","harmful:insults":"Insults","harmful:intellectual-property":"Intellectual Property","harmful:misinformation-disinformation":"Misinformation & Disinformation","harmful:non-violent-crime":"Non-Violent Crime","harmful:privacy":"Privacy","harmful:profanity":"Profanity","harmful:radicalization":"Radicalization","harmful:self-harm":"Self-Harm","harmful:sex-crime":"Sex Crimes","harmful:sexual-content":"Sexual Content","harmful:specialized-advice":"Specialized Advice","harmful:unsafe-practices":"Other Unsafe Practices","harmful:violent-crime":"Violent Crimes","prompt-injection":"Harmful/Injection",competitors:"CompetitorEndorsement",contracts:"ContractualCommitment",hallucination:"Hallucination",hijacking:"Hijacking",jailbreak:"Harmful/Iterative",overreliance:"Overreliance",pii:"PIILeak",politics:"PoliticalStatement"},j=Object.entries(y).reduce((e,i)=>{let[t,a]=i;return e[a]=t,e},{}),b={"excessive-agency":"Excessive Agency","prompt-injection":"Prompt Injection",competitors:"Competitor Endorsements",contracts:"Unsupervised Contracts",jailbreak:"Jailbreak",pii:"PII Leaks",politics:"Political Opinions"};t(4309);var w=e=>{let{categoryStats:i}=e,t=[r.Critical,r.High,r.Medium,r.Low],a=t.reduce((e,t)=>(e[t]=Object.keys(i).reduce((e,i)=>v[i]===t?e+1:e,0),e),{});return(0,s.jsx)(m.ZP,{container:!0,spacing:2,mb:4,children:t.map(e=>(0,s.jsx)(m.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,s.jsx)(h.Z,{className:"card-".concat(e.toLowerCase()),children:(0,s.jsxs)(d.Z,{onClick:()=>window.location.hash="#table",children:[(0,s.jsx)(u.Z,{variant:"body2",component:"div",children:e}),(0,s.jsxs)(u.Z,{variant:"h6",color:"text.primary",children:[a[e]," issues"]})]})})},e))})},Z=t(32414),C=t(63362),k=t(18845),R=t(49567),P=t(47908),A=t(85912),M=t(94941),N=t(65969),L=t(70587);t(46553);var I=e=>{let{title:i,subtitle:t,progressValue:a,numTestsPassed:r,numTestsFailed:n,testTypes:l}=e;return(0,s.jsx)(h.Z,{children:(0,s.jsx)(d.Z,{className:"risk-card-container",children:(0,s.jsxs)(m.ZP,{container:!0,spacing:3,children:[(0,s.jsxs)(m.ZP,{item:!0,xs:12,md:6,style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[(0,s.jsx)(u.Z,{variant:"h5",className:"risk-card-title",children:i}),(0,s.jsx)(u.Z,{variant:"subtitle1",color:"textSecondary",mb:2,children:t}),(0,s.jsx)(R.Z,{sx:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:100,height:100},children:(0,s.jsx)(L.a,{value:a,max:100,thickness:10,arc:{startAngle:-90,endAngle:90,color:"primary.main"},text:"".concat(Math.round(a),"%"),sx:{width:"100%",height:"100%"}})}),(0,s.jsxs)(u.Z,{variant:"h6",className:"risk-card-issues",children:[n," failed probes"]}),(0,s.jsxs)(u.Z,{variant:"subtitle1",color:"textSecondary",className:"risk-card-tests-passed",children:[r,"/",r+n," passed"]})]}),(0,s.jsx)(m.ZP,{item:!0,xs:6,md:4,children:(0,s.jsx)(P.Z,{dense:!0,children:l.map((e,i)=>(0,s.jsx)(N.Z,{title:g[e.name],placement:"left",arrow:!0,children:(0,s.jsxs)(A.ZP,{className:"risk-card-list-item",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId"),a=y[e.name];window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(a,"|metric=").concat(a,")")))},style:{cursor:"pointer"},children:[(0,s.jsx)(M.Z,{primary:b[e.name]||y[e.name],primaryTypographyProps:{variant:"body2"}}),e.passed?(0,s.jsx)(k.Z,{className:"risk-card-icon-passed"}):(0,s.jsx)(C.Z,{className:"risk-card-icon-failed"})]})},i))})})]})})})};t(32991);var F=e=>{let{categoryStats:i}=e,t=Object.keys(p).map(e=>({name:e,passed:p[e].every(e=>{var t,a;return(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)})}));return(0,s.jsx)(Z.Z,{spacing:4,children:t.map((e,t)=>{let a=e.name,r=p[a],n=r.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.pass)||0)},0),l=r.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.total)||0)},0);return(0,s.jsx)(I,{title:e.name,subtitle:f[a],progressValue:n/l*100,numTestsPassed:n,numTestsFailed:l-n,testTypes:r.map(e=>{var t,a;return{name:e,passed:(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)}})},t)})})},H=t(40982),S=t(37803),z=t(65068),E=t(70417),U=t(21303),D=t(61451),O=t(26485),W=t(38592),B=t(30021),T=t(19708),V=t(28891);t(93091);let _=e=>{let i=[];for(let[t,a]of Object.entries(p))for(let t of a)i.push({pluginName:t,type:y[t]||t,description:g[t]||"",passRate:e[t]?(e[t].pass/e[t].total*100).toFixed(1)+"%":"N/A",passRateWithFilter:e[t]?(e[t].passWithFilter/e[t].total*100).toFixed(1)+"%":"N/A",severity:v[t]||"Unknown"});return i.sort((e,i)=>"N/A"===e.passRate?1:"N/A"===i.passRate?-1:parseFloat(e.passRate)-parseFloat(i.passRate))};var q=e=>{let{evalId:i,categoryStats:t}=e;(0,V.useRouter)();let a=_(t).filter(e=>"N/A"!==e.passRate),[r,l]=n.useState(0),[o,c]=n.useState(10),[m,h]=n.useState("asc"),[d,p]=n.useState("default"),f=e=>{let i=d===e&&"asc"===m;h(i?"desc":"asc"),p(e)};return(0,s.jsxs)(R.Z,{children:[(0,s.jsx)(u.Z,{variant:"h6",gutterBottom:!0,id:"table",children:"Vulnerabilities and Mitigations"}),(0,s.jsxs)(D.Z,{component:S.Z,children:[(0,s.jsxs)(z.Z,{children:[(0,s.jsx)(O.Z,{children:(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(U.Z,{children:"Type"}),(0,s.jsx)(U.Z,{children:"Description"}),(0,s.jsx)(U.Z,{children:(0,s.jsx)(T.Z,{active:"passRate"===d,direction:"passRate"===d?m:"asc",onClick:()=>f("passRate"),children:"Pass rate"})}),(0,s.jsx)(U.Z,{children:(0,s.jsx)(T.Z,{active:"severity"===d,direction:"severity"===d?m:"asc",onClick:()=>f("severity"),children:"Severity"})}),(0,s.jsx)(U.Z,{children:"Actions"})]})}),(0,s.jsx)(E.Z,{children:a.sort((e,i)=>{if("passRate"===d)return"N/A"===e.passRate?1:"N/A"===i.passRate?-1:"asc"===m?parseFloat(e.passRate)-parseFloat(i.passRate):parseFloat(i.passRate)-parseFloat(e.passRate);if("severity"===d){if("N/A"===e.passRate)return 1;if("N/A"===i.passRate)return -1;let t={Critical:4,High:3,Medium:2,Low:1};return"asc"===m?t[e.severity]-t[i.severity]:t[i.severity]-t[e.severity]}{let t={Critical:4,High:3,Medium:2,Low:1};return e.severity===i.severity?parseFloat(e.passRate)-parseFloat(i.passRate):t[i.severity]-t[e.severity]}}).slice(r*o,r*o+o).map((e,i)=>{let t="";if("N/A"!==e.passRate){let i=parseFloat(e.passRate);t=i>=75?"pass-high":i>=50?"pass-medium":"pass-low"}return(0,s.jsxs)(B.Z,{children:[(0,s.jsx)(U.Z,{children:b[e.pluginName]||e.type}),(0,s.jsx)(U.Z,{children:e.description}),(0,s.jsxs)(U.Z,{className:t,children:[e.passRate," (",e.passRateWithFilter!==e.passRate?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("strong",{children:[e.passRateWithFilter," with mitigation"]})}):e.passRateWithFilter,")"]}),(0,s.jsx)(U.Z,{className:"vuln-".concat(e.severity.toLowerCase()),children:e.severity}),(0,s.jsxs)(U.Z,{style:{minWidth:270},children:[(0,s.jsx)(H.Z,{variant:"contained",size:"small",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId");window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(e.type,"|metric=").concat(e.type,")")))},children:"View logs"}),(0,s.jsx)(N.Z,{title:"Temporarily disabled while in beta, click to contact us to enable",children:(0,s.jsx)(H.Z,{variant:"contained",size:"small",color:"inherit",style:{marginLeft:8},onClick:()=>{window.location.href="mailto:inquiries@promptfoo.dev?subject=Promptfoo%20automatic%20vulnerability%20mitigation&body=Hello%20Promptfoo%20Team,%0D%0A%0D%0AI%20am%20interested%20in%20learning%20more%20about%20the%20automatic%20vulnerability%20mitigation%20beta.%20Please%20provide%20me%20with%20more%20details.%0D%0A%0D%0A"},children:"Apply mitigation"})})]})]},i)})})]}),a.length>o&&(0,s.jsx)(W.Z,{rowsPerPageOptions:[10,25,50],component:"div",count:a.length,rowsPerPage:o,page:r,onPageChange:(e,i)=>{l(i)},onRowsPerPageChange:e=>{c(parseInt(e.target.value,10)),l(0)}})]})]})};t(67667);var G=()=>{let[e,i]=n.useState(null),[t,a]=n.useState(null);if(n.useEffect(()=>{let e=async e=>{let i=await fetch("".concat(await (0,l.b)(),"/api/results/").concat(e),{cache:"no-store"}),t=await i.json();a(t.data)},t=new URLSearchParams(window.location.search);if(!t)return;let r=t.get("evalId");r&&(i(r),e(r))},[]),!t||!e)return(0,s.jsx)("div",{children:"Loading..."});let r=t.results.table.head.prompts[0],h=t.results.table.body,d=t.results.results.reduce((e,i)=>{var t,a,r,s;let n=i.vars.harmCategory,l=(null===(a=i.gradingResult)||void 0===a?void 0:null===(t=a.componentResults)||void 0===t?void 0:t.map(e=>{var i;return null===(i=e.assertion)||void 0===i?void 0:i.metric}))||[],o=[n,...l].filter(e=>e);for(let t of o){let a=j[t];if(!a){console.log("Unknown harm category:",t);break}let n=i.success;e[a]=e[a]||{pass:0,total:0,passWithFilter:0},e[a].total++,n?(e[a].pass++,e[a].passWithFilter++):(null===(s=i.gradingResult)||void 0===s?void 0:null===(r=s.componentResults)||void 0===r?void 0:r.some(e=>{var i;let t=(null===(i=e.assertion)||void 0===i?void 0:i.type)==="moderation",a=!e.pass;return t&&a}))&&e[a].passWithFilter++}return e},{});return(0,s.jsx)(c.Z,{children:(0,s.jsxs)(m.ZP,{container:!0,direction:"column",spacing:1,pt:6,pb:8,children:[(0,s.jsxs)(m.ZP,{item:!0,className:"report-header",children:[(0,s.jsxs)(u.Z,{variant:"h4",children:[(0,s.jsx)("strong",{children:"LLM Risk Assessment"}),t.config.description&&": ".concat(t.config.description)]}),(0,s.jsx)(u.Z,{variant:"subtitle1",mb:2,children:new Date(t.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),(0,s.jsxs)(u.Z,{variant:"body1",gutterBottom:!0,className:"report-details",children:[(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Model:"})," ",r.provider]})}),(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Dataset:"})," ",h.length," probes"]})}),(0,s.jsx)(o.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Prompt:"}),' "',r.raw.length>20?"".concat(r.raw.substring(0,20),"..."):r.raw,'"']})})]})]}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(w,{categoryStats:d})}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(F,{categoryStats:d})}),(0,s.jsx)(m.ZP,{item:!0,children:(0,s.jsx)(q,{evalId:e,categoryStats:d})})]})})}},4309:function(){},67667:function(){},46553:function(){},32991:function(){},93091:function(){}},function(e){e.O(0,[540,215,620,770,304,995,378,915,470,730,744],function(){return e(e.s=61464)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{92739:function(e,t,n){Promise.resolve().then(n.bind(n,83013))},83013:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ed}});var a=n(24004),i=n(14978),r=n(69179),l=n(47887),s=n(49567),o=n(40982),c=n(11520),d=n(29794),p=n(22701),u=n(51956),h=n(8541),x=n(82669),m=n(32414),f=n(63147),g=n(75307),j=n(63346),v=n(89235),Z=n(4078),b=n(67339),y=()=>{let{env:e,setEnv:t}=(0,l.o)(),[n,r]=(0,i.useState)(!1),[s,c]=(0,i.useState)(e),h=()=>{r(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Z,{variant:"outlined",startIcon:(0,a.jsx)(g.Z,{}),onClick:()=>{r(!0)},children:"API keys"}),(0,a.jsxs)(d.Z,{open:n,onClose:h,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Provider settings"}),(0,a.jsxs)(u.Z,{children:[(0,a.jsxs)(j.Z,{defaultExpanded:!0,children:[(0,a.jsx)(Z.Z,{children:"OpenAI"}),(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(b.Z,{label:"OpenAI API key",fullWidth:!0,margin:"normal",value:s.OPENAI_API_KEY,onChange:e=>c({...s,OPENAI_API_KEY:e.target.value})}),(0,a.jsx)(b.Z,{label:"OpenAI API host",fullWidth:!0,margin:"normal",value:s.OPENAI_API_HOST,onChange:e=>c({...s,OPENAI_API_HOST:e.target.value})}),(0,a.jsx)(b.Z,{label:"OpenAI organization",fullWidth:!0,margin:"normal",value:s.OPENAI_ORGANIZATION,onChange:e=>c({...s,OPENAI_ORGANIZATION:e.target.value})})]})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Azure"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Azure API key",fullWidth:!0,margin:"normal",value:s.AZURE_OPENAI_API_KEY,onChange:e=>c({...s,AZURE_OPENAI_API_KEY:e.target.value})})})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Amazon Bedrock"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Bedrock Region",fullWidth:!0,margin:"normal",value:s.AWS_BEDROCK_REGION,onChange:e=>c({...s,AWS_BEDROCK_REGION:e.target.value})})})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Anthropic"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Anthropic API key",fullWidth:!0,margin:"normal",value:s.ANTHROPIC_API_KEY,onChange:e=>c({...s,ANTHROPIC_API_KEY:e.target.value})})})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Google Vertex AI"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex API Key",fullWidth:!0,margin:"normal",value:s.VERTEX_API_KEY,onChange:e=>c({...s,VERTEX_API_KEY:e.target.value})})}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex Project ID",fullWidth:!0,margin:"normal",value:s.VERTEX_PROJECT_ID,onChange:e=>c({...s,VERTEX_PROJECT_ID:e.target.value})})}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex Region",fullWidth:!0,margin:"normal",value:s.VERTEX_REGION,onChange:e=>c({...s,VERTEX_REGION:e.target.value})})})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Replicate"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Replicate API key",fullWidth:!0,margin:"normal",value:s.REPLICATE_API_KEY,onChange:e=>c({...s,REPLICATE_API_KEY:e.target.value})})})]})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:h,color:"primary",children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{t(s),h()},color:"primary",variant:"contained",children:"Save"})]})]})]})},_=n(35185),C=n(5592),k=n(14931),A=n(2185),E=n(77656),I=n(65068),O=n(70417),S=n(21303),P=n(61451),T=n(30021),w=n(65969),R=e=>{let{open:t,prompt:n,index:r,onAdd:l,onCancel:s}=e,[c,h]=i.useState(n),m=i.useRef(null);i.useEffect(()=>{h(n)},[n]);let f=e=>{l(c),h(""),e?s():m.current&&m.current.focus()};return(0,a.jsxs)(d.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Edit Prompt ".concat(r+1)}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(b.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)(o.Z,{onClick:f.bind(null,!0),color:"primary",variant:"contained",disabled:!c.length,children:"Add"}),(0,a.jsx)(o.Z,{onClick:f.bind(null,!1),color:"primary",variant:"contained",disabled:!c.length,children:"Add Another"}),(0,a.jsx)(o.Z,{onClick:s,color:"secondary",children:"Cancel"})]})]})};n(94499);var W=()=>{let[e,t]=(0,i.useState)(!1),[n,r]=(0,i.useState)(null),{prompts:s,setPrompts:c}=(0,l.o)(),d=(0,i.useRef)(null);(0,i.useEffect)(()=>{null!==n&&n>0&&d.current&&d.current.focus()},[n]);let p=e=>{r(e),t(!0)},u=(e,t)=>{e.stopPropagation();let n=s[t];c([...s,n])},h=(e,t)=>{c(s.map((n,a)=>a===e?t:n))},x=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to remove this prompt?")&&c(s.filter((e,n)=>n!==t))};return(0,a.jsxs)("div",{children:[(0,a.jsxs)(m.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.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)(A.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&&c([...s,a])},e.readAsText(n)}},style:{display:"none"}})]})})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>{t(!0)},variant:"contained",children:"Add Prompt"})]})]}),(0,a.jsx)(P.Z,{children:(0,a.jsx)(I.Z,{children:(0,a.jsx)(O.Z,{children:0===s.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(S.Z,{colSpan:2,align:"center",children:"No prompts added yet."})}):s.map((e,t)=>(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>p(t),children:[(0,a.jsx)(S.Z,{children:(0,a.jsxs)(f.Z,{variant:"body2",children:["Prompt #".concat(t+1,": "),(e.length>250?e.slice(0,250)+" ...":e).split(/({{\w+}})/g).map((e,t)=>/{{\s*(\w+)\s*}}/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:()=>p(t),size:"small",children:(0,a.jsx)(k.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>u(e,t),size:"small",children:(0,a.jsx)(_.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>x(e,t),size:"small",children:(0,a.jsx)(C.Z,{})})]})]},t))})})}),(0,a.jsx)(R,{open:e,prompt:null!==n?s[n]:"",index:null!==n?n:0,onAdd:e=>{null!==n?h(n,e):c([...s,e]),r(null)},onCancel:()=>{r(null),t(!1)}})]})},N=n(68873),z=n(885),F=e=>{let{onChange:t,...n}=e,[r,l]=i.useState(""),[s,o]=i.useState(!1);return(0,a.jsx)(b.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)}}})},V=e=>{let{open:t,providerId:n,config:r,onClose:l,onSave:c}=e,[h,m]=i.useState(r);return i.useEffect(()=>{m(r)},[r]),(0,a.jsxs)(d.Z,{open:t,onClose:l,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)(s.Z,{my:2,children:(0,a.jsx)(b.Z,{label:e,value:n,onChange:t,fullWidth:!0,InputLabelProps:{shrink:!0},type:"number"==typeof n?"number":"text"})},e)):(0,a.jsx)(s.Z,{my:2,children:(0,a.jsx)(F,{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)(o.Z,{onClick:l,children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{c(h)},children:"Save"})]})]})};let L=[].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_penalty: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_penalty: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)),U={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),o=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)(s.Z,{mt:2,children:[(0,a.jsx)(N.Z,{multiple:!0,freeSolo:!0,options:L,value:t,groupBy:e=>(function(e){if(!e)return"Other";let t=e.split(":")[0];return U[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=o(e),r=c(e,n);return(0,i.createElement)(z.Z,{variant:"outlined",label:a,...t({index:n}),key:r,onClick:()=>d(e)})}),renderInput:e=>(0,a.jsx)(b.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)(V,{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)}}})]})},B=n(52428),K=n(11615),D=n(28891),Y=()=>{let e=(0,D.useRouter)(),{defaultTest:t,description:n,env:r,evaluateOptions:s,prompts:c,providers:d,scenarios:p,testCases:u}=(0,l.o)(),[h,x]=(0,i.useState)(!1),[m,f]=(0,i.useState)(0),g=async()=>{x(!0);try{let a=await fetch("".concat(B.eA,"/api/eval/job/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultTest:t,description:n,env:r,evaluateOptions:s,prompts:c,providers:d,scenarios:p,tests:u})});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));let i=await a.json(),l=setInterval(async()=>{let t=await fetch("".concat(B.eA,"/api/eval/job/").concat(i.id,"/"));if(!t.ok)throw clearInterval(l),Error("HTTP error! status: ".concat(t.status));let n=await t.json();if("complete"===n.status)clearInterval(l),x(!1),B.Ox?e.push("/eval/remote:".concat(encodeURIComponent(i.id))):e.push("/eval");else if("failed"===n.status)throw clearInterval(l),x(!1),Error("Job failed");else{let e=0===n.total?0:Math.round(n.progress/n.total*100);f(e)}},1e3)}catch(e){console.error(e),x(!1),alert("An error occurred: ".concat(e.message))}};return(0,a.jsx)(o.Z,{variant:"contained",color:"primary",onClick:g,disabled:h,children:h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K.Z,{size:24,sx:{marginRight:2}}),m.toFixed(0),"% complete"]}):"Run Evaluation"})},J=n(15320),X=n(26485);let G=["equals","contains","icontains","contains-all","contains-any","starts-with","regex","is-json","contains-json","is-sql","contains-sql","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","moderation"];var H=e=>{let{onAdd:t,initialValues:n}=e,[r,l]=(0,i.useState)(n||[]),c=e=>{let n=r.filter((t,n)=>n!==e);l(n),t(n)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Z,{variant:"h6",children:"Asserts"}),(0,a.jsx)(s.Z,{my:r.length>0?2:0,children:(0,a.jsx)(m.Z,{direction:"column",spacing:2,children:r.map((e,n)=>(0,a.jsxs)(m.Z,{direction:"row",spacing:2,alignItems:"center",children:[(0,a.jsx)(N.Z,{value:e.type,options:G,sx:{minWidth:200},onChange:(e,a)=>{let i=r.map((e,t)=>t===n?{...e,type:a}:e);l(i),t(i)},renderInput:e=>(0,a.jsx)(b.Z,{...e,label:"Type"})}),(0,a.jsx)(b.Z,{label:"Value",value:e.value,fullWidth:!0,onChange:e=>{let a=e.target.value,i=r.map((e,t)=>t===n?{...e,value:a}:e);l(i),t(i)}}),(0,a.jsx)(E.Z,{onClick:()=>c(n),size:"small",children:(0,a.jsx)(C.Z,{})})]},n))})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>{let e=[...r,{type:"equals",value:""}];l(e),t(e)},children:"Add Assert"})]})},M=e=>{let{onAdd:t,varsList:n,initialValues:r}=e,[l,o]=i.useState(r||{});return(0,i.useEffect)(()=>{let e={};n.forEach(t=>{e[t]=(null==r?void 0:r[t])||""}),o(e)},[n,r]),(0,a.jsxs)(s.Z,{my:2,children:[(0,a.jsx)(f.Z,{variant:"h6",mb:2,children:"Vars"}),n.length>0?(0,a.jsx)(m.Z,{direction:"row",spacing:2,alignItems:"center",children:Object.keys(l).map((e,n)=>(0,a.jsx)(m.Z,{direction:"row",spacing:2,alignItems:"center",children:(0,a.jsx)(b.Z,{placeholder:e,label:e,value:l[e],fullWidth:!0,onChange:n=>{let a=n.target.value,i={...l,[e]:a};o(i),t(i)}})},n))}):(0,a.jsxs)(f.Z,{variant:"subtitle1",gutterBottom:!0,children:["Add variables to your prompt using the ","{{varname}}"," syntax."]})]})},$=e=>{let{open:t,onAdd:n,varsList:r,initialValues:l,onCancel:c}=e,[h,m]=(0,i.useState)((null==l?void 0:l.description)||""),[f,g]=(0,i.useState)((null==l?void 0:l.vars)||{}),[j,v]=(0,i.useState)((null==l?void 0:l.assert)||[]),[Z,b]=(0,i.useState)(0);i.useEffect(()=>{l?(m(l.description||""),g(l.vars||{}),v(l.assert||[])):(m(""),g({}),v([]))},[l]);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:l?"Edit Test Case":"Add Test Case"}),(0,a.jsx)(u.Z,{children:(0,a.jsxs)(s.Z,{children:[(0,a.jsx)(M,{onAdd:e=>g(e),varsList:r,initialValues:null==l?void 0:l.vars}),(0,a.jsx)(H,{onAdd:e=>v(e),initialValues:((null==l?void 0:l.assert)||[]).filter(e=>"assert-set"!==e.type)||[]},Z)]})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:y.bind(void 0,!0),color:"primary",variant:"contained",children:l?"Update Test Case":"Add Test Case"}),!l&&(0,a.jsx)(o.Z,{onClick:y.bind(void 0,!1),color:"primary",variant:"contained",children:"Add Another"}),(0,a.jsx)(o.Z,{onClick:c,color:"secondary",children:"Cancel"})]})]})},Q=e=>{let{varsList:t}=e,{testCases:r,setTestCases:s}=(0,l.o)(),[c,d]=i.useState(null),[p,u]=i.useState(!1),h=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to delete this test case?")&&s(r.filter((e,n)=>n!==t))},x=(e,t)=>{e.stopPropagation();let n=JSON.parse(JSON.stringify(r[t]));s([...r,n])};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(m.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.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)(A.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(631),n.e(887)]).then(n.bind(n,83887)),t=e(i,{columns:!0});s([...r,...t.map(e=>(0,J.It)(e))])}},e.readAsText(a)}},style:{display:"none"}})]})})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>u(!0),variant:"contained",children:"Add Test Case"})]})]}),(0,a.jsx)(P.Z,{children:(0,a.jsxs)(I.Z,{children:[(0,a.jsx)(X.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)(O.Z,{children:0===r.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(S.Z,{colSpan:4,align:"center",children:"No test cases added yet."})}):r.map((e,t)=>{var n;return(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>{d(t),u(!0)},children:[(0,a.jsx)(S.Z,{children:(0,a.jsx)(f.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:()=>{d(t),u(!0)},size:"small",children:(0,a.jsx)(k.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>x(e,t),size:"small",children:(0,a.jsx)(_.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>h(e,t),size:"small",children:(0,a.jsx)(C.Z,{})})]})]},t)})})]})}),(0,a.jsx)($,{open:p,onAdd:(e,t)=>{if(null===c)s([...r,e]);else{let t=r.map((t,n)=>n===c?e:t);s(t),d(null)}t&&u(!1)},varsList:t,initialValues:null!==c?r[c]:void 0,onCancel:()=>{d(null),u(!1)}})]})},ee=n(71911),et=n.n(ee),en=n(93522),ea=n(34235),ei=n(38640),er=n.n(ei),el=n(29270);n(54492),n(55096),n(93486);var es=()=>{let{defaultTest:e,setDefaultTest:t,description:n,setDescription:r,env:c,setEnv:d,evaluateOptions:p,setEvaluateOptions:u,prompts:h,setPrompts:x,providers:m,setProviders:g,scenarios:j,setScenarios:v,testCases:Z,setTestCases:b}=(0,l.o)(),[y,_]=i.useState(""),[C,A]=i.useState(!0),E=e=>{t(e.defaultTest||{}),r(e.description||""),d(e.env||{}),u(e.evaluateOptions||{}),x(e.prompts||[]),g(e.providers||[]),v(e.scenarios||[]),b(e.tests||[])};return i.useEffect(()=>{_(ea.default.dump({defaultTest:e,description:n,env:c,evaluateOptions:p,prompts:h,providers:m,scenarios:j,tests:Z}))},[e,n,c,p,h,m,j,Z]),(0,a.jsxs)(s.Z,{mt:4,children:[(0,a.jsx)(f.Z,{variant:"h5",gutterBottom:!0,children:"Configuration"}),(0,a.jsxs)(f.Z,{variant:"body1",gutterBottom:!0,children:["This is the YAML config that defines the evaluation and is processed by promptfoo. See"," ",(0,a.jsx)(er(),{target:"_blank",href:"https://promptfoo.dev/docs/configuration/guide",children:"configuration docs"})," ","to learn more."]}),(0,a.jsx)(o.Z,{variant:"text",color:"primary",startIcon:C?(0,a.jsx)(k.Z,{}):(0,a.jsx)(en.Z,{}),onClick:()=>{if(!C)try{let e=ea.default.load(y,{json:!0});E(e)}catch(e){}A(!C)},children:C?"Edit YAML":"Save"}),(0,a.jsx)(et(),{autoCapitalize:"off",value:y,onValueChange:e=>{C||_(e)},highlight:e=>(0,el.highlight)(e,el.languages.yaml),padding:10,style:{fontFamily:'"Fira code", "Fira Mono", monospace',fontSize:14},disabled:C,className:C?"":"glowing-border"})]})};n(7517);var eo=n(77580);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:g,providers:j,setProviders:v,prompts:Z,setPrompts:b,testCases:_,setTestCases:C}=(0,l.o)();if((0,i.useEffect)(()=>{l.o.persist.rehydrate()},[]),eo.env.NEXT_PUBLIC_NO_BROWSING)return null;let k=(e=>{let t=/{{\s*(\w+)\s*}}/g,n=new Set;return e.forEach(e=>{let a;for(;null!==(a=t.exec(e));)n.add(a[1])}),Array.from(n)})(Z);return(0,a.jsxs)(c.Z,{maxWidth:"lg",sx:{marginTop:"2rem"},children:[(0,a.jsxs)(m.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.Z,{variant:"h4",children:"Set up an evaluation"}),(0,a.jsxs)(m.Z,{direction:"row",spacing:2,children:[(0,a.jsx)(Y,{}),(0,a.jsx)(y,{}),(0,a.jsx)(o.Z,{variant:"outlined",color:"primary",onClick:()=>t(!0),children:"Reset"})]})]}),(0,a.jsx)(s.Z,{mt:4}),(0,a.jsx)(s.Z,{mt:2,children:(0,a.jsx)(r.SV,{FallbackComponent:ec,onReset:()=>{v([])},children:(0,a.jsxs)(m.Z,{direction:"column",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.Z,{variant:"h5",children:"Providers"}),(0,a.jsx)(q,{providers:j,onChange:v})]})})}),(0,a.jsx)(s.Z,{mt:4}),(0,a.jsx)(r.SV,{FallbackComponent:ec,onReset:()=>{b([])},children:(0,a.jsx)(W,{})}),(0,a.jsx)(s.Z,{mt:6}),(0,a.jsx)(r.SV,{FallbackComponent:ec,onReset:()=>{C([])},children:(0,a.jsx)(Q,{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)(o.Z,{onClick:()=>t(!1),children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{g(""),v([]),b([]),C([]),t(!1)},autoFocus:!0,children:"Reset"})]})]})]})}},52428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return r},T8:function(){return i},eA:function(){return l}});var a=n(77580);let i=!a.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,r=!!a.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,l=""},47887:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var a=n(79685),i=n(74595);let r=(0,a.Ue)()((0,i.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},scenarios:[],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}),setScenarios:t=>e({scenarios: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=>"string"==typeof e&&!e.endsWith(".txt")&&!e.endsWith(".json")&&!e.endsWith(".yaml")):console.warn("Invalid prompts config",t.prompts)),t.defaultTest&&(n.defaultTest=t.defaultTest),t.evaluateOptions&&(n.evaluateOptions=t.evaluateOptions),t.scenarios&&(n.scenarios=t.scenarios),e(n)},getTestSuite:()=>{let{description:e,testCases:n,providers:a,prompts:i,env:r,scenarios:l}=t();return{env:r,description:e,providers:a,prompts:i,tests:n,scenarios:l}}}),{name:"promptfoo",skipHydration:!0}))},94499:function(){},55096:function(){},7517:function(){},15320:function(e,t){"use strict";t.It=void 0,t.It=function(e){let t,n,a,i;let r={},l=[],s={};for(let[o,c]of Object.entries(e))o.startsWith("__expected")?""!==c.trim()&&l.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|is-sql|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}}(c)):"__prefix"===o?s.prefix=c:"__suffix"===o?s.suffix=c:"__description"===o?n=c:"__providerOutput"===o?t=c:"__metric"===o?a=c:"__threshold"===o?i=parseFloat(c):r[o]=c;for(let e of l)e.metric=a;return{vars:r,assert:l,options:s,...n?{description:n}:{},...t?{providerOutput:t}:{},...i?{threshold:i}:{}}}}},function(e){e.O(0,[540,640,215,620,770,304,339,995,378,374,235,873,106,258,470,730,744],function(){return e(e.s=92739)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{72846:function(e,t,n){Promise.resolve().then(n.bind(n,83013))},83013:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ed}});var a=n(24004),i=n(14978),r=n(69179),l=n(47887),s=n(49567),o=n(40982),c=n(11520),d=n(29794),p=n(22701),u=n(51956),h=n(8541),x=n(82669),m=n(32414),f=n(63147),g=n(75307),j=n(63346),v=n(89235),Z=n(4078),b=n(67339),y=()=>{let{env:e,setEnv:t}=(0,l.o)(),[n,r]=(0,i.useState)(!1),[s,c]=(0,i.useState)(e),h=()=>{r(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Z,{variant:"outlined",startIcon:(0,a.jsx)(g.Z,{}),onClick:()=>{r(!0)},children:"API keys"}),(0,a.jsxs)(d.Z,{open:n,onClose:h,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Provider settings"}),(0,a.jsxs)(u.Z,{children:[(0,a.jsxs)(j.Z,{defaultExpanded:!0,children:[(0,a.jsx)(Z.Z,{children:"OpenAI"}),(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(b.Z,{label:"OpenAI API key",fullWidth:!0,margin:"normal",value:s.OPENAI_API_KEY,onChange:e=>c({...s,OPENAI_API_KEY:e.target.value})}),(0,a.jsx)(b.Z,{label:"OpenAI API host",fullWidth:!0,margin:"normal",value:s.OPENAI_API_HOST,onChange:e=>c({...s,OPENAI_API_HOST:e.target.value})}),(0,a.jsx)(b.Z,{label:"OpenAI organization",fullWidth:!0,margin:"normal",value:s.OPENAI_ORGANIZATION,onChange:e=>c({...s,OPENAI_ORGANIZATION:e.target.value})})]})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Azure"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Azure API key",fullWidth:!0,margin:"normal",value:s.AZURE_OPENAI_API_KEY,onChange:e=>c({...s,AZURE_OPENAI_API_KEY:e.target.value})})})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Amazon Bedrock"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Bedrock Region",fullWidth:!0,margin:"normal",value:s.AWS_BEDROCK_REGION,onChange:e=>c({...s,AWS_BEDROCK_REGION:e.target.value})})})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Anthropic"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Anthropic API key",fullWidth:!0,margin:"normal",value:s.ANTHROPIC_API_KEY,onChange:e=>c({...s,ANTHROPIC_API_KEY:e.target.value})})})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Google Vertex AI"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex API Key",fullWidth:!0,margin:"normal",value:s.VERTEX_API_KEY,onChange:e=>c({...s,VERTEX_API_KEY:e.target.value})})}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex Project ID",fullWidth:!0,margin:"normal",value:s.VERTEX_PROJECT_ID,onChange:e=>c({...s,VERTEX_PROJECT_ID:e.target.value})})}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex Region",fullWidth:!0,margin:"normal",value:s.VERTEX_REGION,onChange:e=>c({...s,VERTEX_REGION:e.target.value})})})]}),(0,a.jsxs)(j.Z,{children:[(0,a.jsx)(Z.Z,{children:"Replicate"}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(b.Z,{label:"Replicate API key",fullWidth:!0,margin:"normal",value:s.REPLICATE_API_KEY,onChange:e=>c({...s,REPLICATE_API_KEY:e.target.value})})})]})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:h,color:"primary",children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{t(s),h()},color:"primary",variant:"contained",children:"Save"})]})]})]})},_=n(35185),C=n(5592),k=n(14931),A=n(2185),E=n(77656),I=n(65068),O=n(70417),S=n(21303),P=n(61451),T=n(30021),w=n(65969),R=e=>{let{open:t,prompt:n,index:r,onAdd:l,onCancel:s}=e,[c,h]=i.useState(n),m=i.useRef(null);i.useEffect(()=>{h(n)},[n]);let f=e=>{l(c),h(""),e?s():m.current&&m.current.focus()};return(0,a.jsxs)(d.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Edit Prompt ".concat(r+1)}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(b.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)(o.Z,{onClick:f.bind(null,!0),color:"primary",variant:"contained",disabled:!c.length,children:"Add"}),(0,a.jsx)(o.Z,{onClick:f.bind(null,!1),color:"primary",variant:"contained",disabled:!c.length,children:"Add Another"}),(0,a.jsx)(o.Z,{onClick:s,color:"secondary",children:"Cancel"})]})]})};n(94499);var W=()=>{let[e,t]=(0,i.useState)(!1),[n,r]=(0,i.useState)(null),{prompts:s,setPrompts:c}=(0,l.o)(),d=(0,i.useRef)(null);(0,i.useEffect)(()=>{null!==n&&n>0&&d.current&&d.current.focus()},[n]);let p=e=>{r(e),t(!0)},u=(e,t)=>{e.stopPropagation();let n=s[t];c([...s,n])},h=(e,t)=>{c(s.map((n,a)=>a===e?t:n))},x=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to remove this prompt?")&&c(s.filter((e,n)=>n!==t))};return(0,a.jsxs)("div",{children:[(0,a.jsxs)(m.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.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)(A.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&&c([...s,a])},e.readAsText(n)}},style:{display:"none"}})]})})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>{t(!0)},variant:"contained",children:"Add Prompt"})]})]}),(0,a.jsx)(P.Z,{children:(0,a.jsx)(I.Z,{children:(0,a.jsx)(O.Z,{children:0===s.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(S.Z,{colSpan:2,align:"center",children:"No prompts added yet."})}):s.map((e,t)=>(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>p(t),children:[(0,a.jsx)(S.Z,{children:(0,a.jsxs)(f.Z,{variant:"body2",children:["Prompt #".concat(t+1,": "),(e.length>250?e.slice(0,250)+" ...":e).split(/({{\w+}})/g).map((e,t)=>/{{\s*(\w+)\s*}}/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:()=>p(t),size:"small",children:(0,a.jsx)(k.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>u(e,t),size:"small",children:(0,a.jsx)(_.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>x(e,t),size:"small",children:(0,a.jsx)(C.Z,{})})]})]},t))})})}),(0,a.jsx)(R,{open:e,prompt:null!==n?s[n]:"",index:null!==n?n:0,onAdd:e=>{null!==n?h(n,e):c([...s,e]),r(null)},onCancel:()=>{r(null),t(!1)}})]})},N=n(68873),z=n(885),F=e=>{let{onChange:t,...n}=e,[r,l]=i.useState(""),[s,o]=i.useState(!1);return(0,a.jsx)(b.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)}}})},V=e=>{let{open:t,providerId:n,config:r,onClose:l,onSave:c}=e,[h,m]=i.useState(r);return i.useEffect(()=>{m(r)},[r]),(0,a.jsxs)(d.Z,{open:t,onClose:l,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)(s.Z,{my:2,children:(0,a.jsx)(b.Z,{label:e,value:n,onChange:t,fullWidth:!0,InputLabelProps:{shrink:!0},type:"number"==typeof n?"number":"text"})},e)):(0,a.jsx)(s.Z,{my:2,children:(0,a.jsx)(F,{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)(o.Z,{onClick:l,children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{c(h)},children:"Save"})]})]})};let L=[].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_penalty: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_penalty: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)),U={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),o=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)(s.Z,{mt:2,children:[(0,a.jsx)(N.Z,{multiple:!0,freeSolo:!0,options:L,value:t,groupBy:e=>(function(e){if(!e)return"Other";let t=e.split(":")[0];return U[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=o(e),r=c(e,n);return(0,i.createElement)(z.Z,{variant:"outlined",label:a,...t({index:n}),key:r,onClick:()=>d(e)})}),renderInput:e=>(0,a.jsx)(b.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)(V,{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)}}})]})},B=n(52428),K=n(11615),D=n(28891),Y=()=>{let e=(0,D.useRouter)(),{defaultTest:t,description:n,env:r,evaluateOptions:s,prompts:c,providers:d,scenarios:p,testCases:u}=(0,l.o)(),[h,x]=(0,i.useState)(!1),[m,f]=(0,i.useState)(0),g=async()=>{x(!0);try{let a=await fetch("".concat(B.eA,"/api/eval/job/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultTest:t,description:n,env:r,evaluateOptions:s,prompts:c,providers:d,scenarios:p,tests:u})});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));let i=await a.json(),l=setInterval(async()=>{let t=await fetch("".concat(B.eA,"/api/eval/job/").concat(i.id,"/"));if(!t.ok)throw clearInterval(l),Error("HTTP error! status: ".concat(t.status));let n=await t.json();if("complete"===n.status)clearInterval(l),x(!1),B.Ox?e.push("/eval/remote:".concat(encodeURIComponent(i.id))):e.push("/eval");else if("failed"===n.status)throw clearInterval(l),x(!1),Error("Job failed");else{let e=0===n.total?0:Math.round(n.progress/n.total*100);f(e)}},1e3)}catch(e){console.error(e),x(!1),alert("An error occurred: ".concat(e.message))}};return(0,a.jsx)(o.Z,{variant:"contained",color:"primary",onClick:g,disabled:h,children:h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K.Z,{size:24,sx:{marginRight:2}}),m.toFixed(0),"% complete"]}):"Run Evaluation"})},J=n(15320),X=n(26485);let G=["equals","contains","icontains","contains-all","contains-any","starts-with","regex","is-json","contains-json","is-sql","contains-sql","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","moderation"];var H=e=>{let{onAdd:t,initialValues:n}=e,[r,l]=(0,i.useState)(n||[]),c=e=>{let n=r.filter((t,n)=>n!==e);l(n),t(n)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Z,{variant:"h6",children:"Asserts"}),(0,a.jsx)(s.Z,{my:r.length>0?2:0,children:(0,a.jsx)(m.Z,{direction:"column",spacing:2,children:r.map((e,n)=>(0,a.jsxs)(m.Z,{direction:"row",spacing:2,alignItems:"center",children:[(0,a.jsx)(N.Z,{value:e.type,options:G,sx:{minWidth:200},onChange:(e,a)=>{let i=r.map((e,t)=>t===n?{...e,type:a}:e);l(i),t(i)},renderInput:e=>(0,a.jsx)(b.Z,{...e,label:"Type"})}),(0,a.jsx)(b.Z,{label:"Value",value:e.value,fullWidth:!0,onChange:e=>{let a=e.target.value,i=r.map((e,t)=>t===n?{...e,value:a}:e);l(i),t(i)}}),(0,a.jsx)(E.Z,{onClick:()=>c(n),size:"small",children:(0,a.jsx)(C.Z,{})})]},n))})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>{let e=[...r,{type:"equals",value:""}];l(e),t(e)},children:"Add Assert"})]})},M=e=>{let{onAdd:t,varsList:n,initialValues:r}=e,[l,o]=i.useState(r||{});return(0,i.useEffect)(()=>{let e={};n.forEach(t=>{e[t]=(null==r?void 0:r[t])||""}),o(e)},[n,r]),(0,a.jsxs)(s.Z,{my:2,children:[(0,a.jsx)(f.Z,{variant:"h6",mb:2,children:"Vars"}),n.length>0?(0,a.jsx)(m.Z,{direction:"row",spacing:2,alignItems:"center",children:Object.keys(l).map((e,n)=>(0,a.jsx)(m.Z,{direction:"row",spacing:2,alignItems:"center",children:(0,a.jsx)(b.Z,{placeholder:e,label:e,value:l[e],fullWidth:!0,onChange:n=>{let a=n.target.value,i={...l,[e]:a};o(i),t(i)}})},n))}):(0,a.jsxs)(f.Z,{variant:"subtitle1",gutterBottom:!0,children:["Add variables to your prompt using the ","{{varname}}"," syntax."]})]})},$=e=>{let{open:t,onAdd:n,varsList:r,initialValues:l,onCancel:c}=e,[h,m]=(0,i.useState)((null==l?void 0:l.description)||""),[f,g]=(0,i.useState)((null==l?void 0:l.vars)||{}),[j,v]=(0,i.useState)((null==l?void 0:l.assert)||[]),[Z,b]=(0,i.useState)(0);i.useEffect(()=>{l?(m(l.description||""),g(l.vars||{}),v(l.assert||[])):(m(""),g({}),v([]))},[l]);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:l?"Edit Test Case":"Add Test Case"}),(0,a.jsx)(u.Z,{children:(0,a.jsxs)(s.Z,{children:[(0,a.jsx)(M,{onAdd:e=>g(e),varsList:r,initialValues:null==l?void 0:l.vars}),(0,a.jsx)(H,{onAdd:e=>v(e),initialValues:((null==l?void 0:l.assert)||[]).filter(e=>"assert-set"!==e.type)||[]},Z)]})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:y.bind(void 0,!0),color:"primary",variant:"contained",children:l?"Update Test Case":"Add Test Case"}),!l&&(0,a.jsx)(o.Z,{onClick:y.bind(void 0,!1),color:"primary",variant:"contained",children:"Add Another"}),(0,a.jsx)(o.Z,{onClick:c,color:"secondary",children:"Cancel"})]})]})},Q=e=>{let{varsList:t}=e,{testCases:r,setTestCases:s}=(0,l.o)(),[c,d]=i.useState(null),[p,u]=i.useState(!1),h=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to delete this test case?")&&s(r.filter((e,n)=>n!==t))},x=(e,t)=>{e.stopPropagation();let n=JSON.parse(JSON.stringify(r[t]));s([...r,n])};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(m.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.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)(A.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(631),n.e(887)]).then(n.bind(n,83887)),t=e(i,{columns:!0});s([...r,...t.map(e=>(0,J.It)(e))])}},e.readAsText(a)}},style:{display:"none"}})]})})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>u(!0),variant:"contained",children:"Add Test Case"})]})]}),(0,a.jsx)(P.Z,{children:(0,a.jsxs)(I.Z,{children:[(0,a.jsx)(X.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)(O.Z,{children:0===r.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(S.Z,{colSpan:4,align:"center",children:"No test cases added yet."})}):r.map((e,t)=>{var n;return(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>{d(t),u(!0)},children:[(0,a.jsx)(S.Z,{children:(0,a.jsx)(f.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:()=>{d(t),u(!0)},size:"small",children:(0,a.jsx)(k.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>x(e,t),size:"small",children:(0,a.jsx)(_.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>h(e,t),size:"small",children:(0,a.jsx)(C.Z,{})})]})]},t)})})]})}),(0,a.jsx)($,{open:p,onAdd:(e,t)=>{if(null===c)s([...r,e]);else{let t=r.map((t,n)=>n===c?e:t);s(t),d(null)}t&&u(!1)},varsList:t,initialValues:null!==c?r[c]:void 0,onCancel:()=>{d(null),u(!1)}})]})},ee=n(71911),et=n.n(ee),en=n(93522),ea=n(34235),ei=n(38640),er=n.n(ei),el=n(29270);n(54492),n(55096),n(93486);var es=()=>{let{defaultTest:e,setDefaultTest:t,description:n,setDescription:r,env:c,setEnv:d,evaluateOptions:p,setEvaluateOptions:u,prompts:h,setPrompts:x,providers:m,setProviders:g,scenarios:j,setScenarios:v,testCases:Z,setTestCases:b}=(0,l.o)(),[y,_]=i.useState(""),[C,A]=i.useState(!0),E=e=>{t(e.defaultTest||{}),r(e.description||""),d(e.env||{}),u(e.evaluateOptions||{}),x(e.prompts||[]),g(e.providers||[]),v(e.scenarios||[]),b(e.tests||[])};return i.useEffect(()=>{_(ea.default.dump({defaultTest:e,description:n,env:c,evaluateOptions:p,prompts:h,providers:m,scenarios:j,tests:Z}))},[e,n,c,p,h,m,j,Z]),(0,a.jsxs)(s.Z,{mt:4,children:[(0,a.jsx)(f.Z,{variant:"h5",gutterBottom:!0,children:"Configuration"}),(0,a.jsxs)(f.Z,{variant:"body1",gutterBottom:!0,children:["This is the YAML config that defines the evaluation and is processed by promptfoo. See"," ",(0,a.jsx)(er(),{target:"_blank",href:"https://promptfoo.dev/docs/configuration/guide",children:"configuration docs"})," ","to learn more."]}),(0,a.jsx)(o.Z,{variant:"text",color:"primary",startIcon:C?(0,a.jsx)(k.Z,{}):(0,a.jsx)(en.Z,{}),onClick:()=>{if(!C)try{let e=ea.default.load(y,{json:!0});E(e)}catch(e){}A(!C)},children:C?"Edit YAML":"Save"}),(0,a.jsx)(et(),{autoCapitalize:"off",value:y,onValueChange:e=>{C||_(e)},highlight:e=>(0,el.highlight)(e,el.languages.yaml),padding:10,style:{fontFamily:'"Fira code", "Fira Mono", monospace',fontSize:14},disabled:C,className:C?"":"glowing-border"})]})};n(7517);var eo=n(77580);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:g,providers:j,setProviders:v,prompts:Z,setPrompts:b,testCases:_,setTestCases:C}=(0,l.o)();if((0,i.useEffect)(()=>{l.o.persist.rehydrate()},[]),eo.env.NEXT_PUBLIC_NO_BROWSING)return null;let k=(e=>{let t=/{{\s*(\w+)\s*}}/g,n=new Set;return e.forEach(e=>{let a;for(;null!==(a=t.exec(e));)n.add(a[1])}),Array.from(n)})(Z);return(0,a.jsxs)(c.Z,{maxWidth:"lg",sx:{marginTop:"2rem"},children:[(0,a.jsxs)(m.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.Z,{variant:"h4",children:"Set up an evaluation"}),(0,a.jsxs)(m.Z,{direction:"row",spacing:2,children:[(0,a.jsx)(Y,{}),(0,a.jsx)(y,{}),(0,a.jsx)(o.Z,{variant:"outlined",color:"primary",onClick:()=>t(!0),children:"Reset"})]})]}),(0,a.jsx)(s.Z,{mt:4}),(0,a.jsx)(s.Z,{mt:2,children:(0,a.jsx)(r.SV,{FallbackComponent:ec,onReset:()=>{v([])},children:(0,a.jsxs)(m.Z,{direction:"column",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.Z,{variant:"h5",children:"Providers"}),(0,a.jsx)(q,{providers:j,onChange:v})]})})}),(0,a.jsx)(s.Z,{mt:4}),(0,a.jsx)(r.SV,{FallbackComponent:ec,onReset:()=>{b([])},children:(0,a.jsx)(W,{})}),(0,a.jsx)(s.Z,{mt:6}),(0,a.jsx)(r.SV,{FallbackComponent:ec,onReset:()=>{C([])},children:(0,a.jsx)(Q,{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)(o.Z,{onClick:()=>t(!1),children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{g(""),v([]),b([]),C([]),t(!1)},autoFocus:!0,children:"Reset"})]})]})]})}},52428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return r},T8:function(){return i},eA:function(){return l}});var a=n(77580);let i=!a.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,r=!!a.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,l=""},47887:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var a=n(79685),i=n(74595);let r=(0,a.Ue)()((0,i.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},scenarios:[],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}),setScenarios:t=>e({scenarios: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=>"string"==typeof e&&!e.endsWith(".txt")&&!e.endsWith(".json")&&!e.endsWith(".yaml")):console.warn("Invalid prompts config",t.prompts)),t.defaultTest&&(n.defaultTest=t.defaultTest),t.evaluateOptions&&(n.evaluateOptions=t.evaluateOptions),t.scenarios&&(n.scenarios=t.scenarios),e(n)},getTestSuite:()=>{let{description:e,testCases:n,providers:a,prompts:i,env:r,scenarios:l}=t();return{env:r,description:e,providers:a,prompts:i,tests:n,scenarios:l}}}),{name:"promptfoo",skipHydration:!0}))},94499:function(){},55096:function(){},7517:function(){},15320:function(e,t){"use strict";t.It=void 0,t.It=function(e){let t,n,a,i;let r={},l=[],s={};for(let[o,c]of Object.entries(e))o.startsWith("__expected")?""!==c.trim()&&l.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|is-sql|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}}(c)):"__prefix"===o?s.prefix=c:"__suffix"===o?s.suffix=c:"__description"===o?n=c:"__providerOutput"===o?t=c:"__metric"===o?a=c:"__threshold"===o?i=parseFloat(c):r[o]=c;for(let e of l)e.metric=a;return{vars:r,assert:l,options:s,...n?{description:n}:{},...t?{providerOutput:t}:{},...i?{threshold:i}:{}}}}},function(e){e.O(0,[540,640,215,620,770,304,339,995,378,374,235,873,106,258,470,730,744],function(){return e(e.s=72846)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{26498:function(e,n,t){Promise.resolve().then(t.t.bind(t,6020,23)),Promise.resolve().then(t.t.bind(t,83507,23)),Promise.resolve().then(t.t.bind(t,27883,23)),Promise.resolve().then(t.t.bind(t,46785,23)),Promise.resolve().then(t.t.bind(t,27382,23))}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[470,730],function(){return n(11409),n(26498)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{11515:function(e,n,t){Promise.resolve().then(t.t.bind(t,6020,23)),Promise.resolve().then(t.t.bind(t,83507,23)),Promise.resolve().then(t.t.bind(t,27883,23)),Promise.resolve().then(t.t.bind(t,46785,23)),Promise.resolve().then(t.t.bind(t,27382,23))}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[470,730],function(){return n(11409),n(11515)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ !function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},d={};function l(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}},r=!0;try{a[e].call(n.exports,n,n.exports,l),r=!1}finally{r&&delete d[e]}return n.exports}l.m=a,e=[],l.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(l.O).every(function(e){return l.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},l.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);l.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},l.d(o,u),o},l.d=function(e,t){for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.f={},l.e=function(e){return Promise.all(Object.keys(l.f).reduce(function(t,n){return l.f[n](e,t),t},[]))},l.u=function(e){return 631===e?"static/chunks/631-87fea556bbafe972.js":"static/chunks/"+e+"."+({407:"42b5daf65ab5dde9",887:"028187fb318c3e59"})[e]+".js"},l.miniCssF=function(e){return"static/css/"+({11:"94b771e23fc5d5f5",185:"106779eb64615639",413:"edcd6f0b6c902fde",420:"dab5d695b3657d59",421:"35ab7ce8025438b0",466:"48d388184a2f4ce3",931:"8119d8bd13a8adab"})[e]+".css"},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",l.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var d=f[a];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==o+n){i=d;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,l.nc&&i.setAttribute("nonce",l.nc),i.setAttribute("data-webpack",o+n),i.src=l.tu(e)),r[e]=[t];var s=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=s.bind(null,i.onerror),i.onload=s.bind(null,i.onload),c&&document.head.appendChild(i)},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},l.tu=function(e){return l.tt().createScriptURL(e)},l.p="/_next/",i={272:0},l.f.j=function(e,t){var n=l.o(i,e)?i[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=l.p+l.u(e),u=Error();l.l(o,function(t){if(l.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}else i[e]=0}},l.O.j=function(e){return 0===i[e]},c=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)l.o(u,n)&&(l.m[n]=u[n]);if(c)var a=c(l)}for(e&&e(t);f<o.length;f++)r=o[f],l.o(i,r)&&i[r]&&i[r][0](),i[r]=0;return l.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f))}();
@@ -0,0 +1 @@
1
+ .dark-mode-toggle{display:flex;background-color:transparent;border:none;color:var(--text-color);cursor:pointer;font-size:16px;padding:8px;transition:color .3s}.dark-mode-toggle:hover{color:var(--pass-color)}.logo{display:flex;font-family:monospace,monospace;font-size:.8rem;align-items:center;gap:8px;background-color:#f0f0f0;padding:0 2rem 0 0;border-radius:.5rem}[data-theme=dark] .logo{background-color:#333;border-color:#444}.logo img{width:25px;margin-top:2px}[data-theme=dark] .logo img{filter:invert(1)}.logo span{color:var(--text-color)}[data-theme=dark] .logo span{color:#f0f0f0}.nav{padding:.25rem 0 .25rem 1rem;gap:1rem;background-color:#eee;margin-bottom:1rem}[data-theme=dark] .nav{background-color:#333}.nav a{text-decoration:none;color:#000;align-self:center}.nav .active{font-weight:700}[data-theme=dark] .nav a{color:#f0f0f0}.nav .right-aligned{display:flex;align-items:center;gap:1rem;margin-left:auto;margin-right:.5rem}.nav a:hover{text-decoration:underline}[data-theme=dark] .nav a:hover{color:#ddd}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:400;font-display:swap;src:url(/_next/static/media/ec159349637c90ad-s.woff2) format("woff2");unicode-range:U+0460-052f,U+1c80-1c88,U+20b4,U+2de0-2dff,U+a640-a69f,U+fe2e-fe2f}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:400;font-display:swap;src:url(/_next/static/media/513657b02c5c193f-s.woff2) format("woff2");unicode-range:U+0301,U+0400-045f,U+0490-0491,U+04b0-04b1,U+2116}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:400;font-display:swap;src:url(/_next/static/media/fd4db3eb5472fc27-s.woff2) format("woff2");unicode-range:U+1f??}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:400;font-display:swap;src:url(/_next/static/media/51ed15f9841b9f9d-s.woff2) format("woff2");unicode-range:U+0370-0377,U+037a-037f,U+0384-038a,U+038c,U+038e-03a1,U+03a3-03ff}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:400;font-display:swap;src:url(/_next/static/media/05a31a2ca4975f99-s.woff2) format("woff2");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01a0-01a1,U+01af-01b0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1ea0-1ef9,U+20ab}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:400;font-display:swap;src:url(/_next/static/media/d6b16ce4a6175f26-s.woff2) format("woff2");unicode-range:U+0100-02af,U+0304,U+0308,U+0329,U+1e00-1e9f,U+1ef2-1eff,U+2020,U+20a0-20ab,U+20ad-20c0,U+2113,U+2c60-2c7f,U+a720-a7ff}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:400;font-display:swap;src:url(/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2) format("woff2");unicode-range:U+00??,U+0131,U+0152-0153,U+02bb-02bc,U+02c6,U+02da,U+02dc,U+0304,U+0308,U+0329,U+2000-206f,U+2074,U+20ac,U+2122,U+2191,U+2193,U+2212,U+2215,U+feff,U+fffd}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:500;font-display:swap;src:url(/_next/static/media/ec159349637c90ad-s.woff2) format("woff2");unicode-range:U+0460-052f,U+1c80-1c88,U+20b4,U+2de0-2dff,U+a640-a69f,U+fe2e-fe2f}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:500;font-display:swap;src:url(/_next/static/media/513657b02c5c193f-s.woff2) format("woff2");unicode-range:U+0301,U+0400-045f,U+0490-0491,U+04b0-04b1,U+2116}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:500;font-display:swap;src:url(/_next/static/media/fd4db3eb5472fc27-s.woff2) format("woff2");unicode-range:U+1f??}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:500;font-display:swap;src:url(/_next/static/media/51ed15f9841b9f9d-s.woff2) format("woff2");unicode-range:U+0370-0377,U+037a-037f,U+0384-038a,U+038c,U+038e-03a1,U+03a3-03ff}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:500;font-display:swap;src:url(/_next/static/media/05a31a2ca4975f99-s.woff2) format("woff2");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01a0-01a1,U+01af-01b0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1ea0-1ef9,U+20ab}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:500;font-display:swap;src:url(/_next/static/media/d6b16ce4a6175f26-s.woff2) format("woff2");unicode-range:U+0100-02af,U+0304,U+0308,U+0329,U+1e00-1e9f,U+1ef2-1eff,U+2020,U+20a0-20ab,U+20ad-20c0,U+2113,U+2c60-2c7f,U+a720-a7ff}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:500;font-display:swap;src:url(/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2) format("woff2");unicode-range:U+00??,U+0131,U+0152-0153,U+02bb-02bc,U+02c6,U+02da,U+02dc,U+0304,U+0308,U+0329,U+2000-206f,U+2074,U+20ac,U+2122,U+2191,U+2193,U+2212,U+2215,U+feff,U+fffd}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:700;font-display:swap;src:url(/_next/static/media/ec159349637c90ad-s.woff2) format("woff2");unicode-range:U+0460-052f,U+1c80-1c88,U+20b4,U+2de0-2dff,U+a640-a69f,U+fe2e-fe2f}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:700;font-display:swap;src:url(/_next/static/media/513657b02c5c193f-s.woff2) format("woff2");unicode-range:U+0301,U+0400-045f,U+0490-0491,U+04b0-04b1,U+2116}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:700;font-display:swap;src:url(/_next/static/media/fd4db3eb5472fc27-s.woff2) format("woff2");unicode-range:U+1f??}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:700;font-display:swap;src:url(/_next/static/media/51ed15f9841b9f9d-s.woff2) format("woff2");unicode-range:U+0370-0377,U+037a-037f,U+0384-038a,U+038c,U+038e-03a1,U+03a3-03ff}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:700;font-display:swap;src:url(/_next/static/media/05a31a2ca4975f99-s.woff2) format("woff2");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01a0-01a1,U+01af-01b0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1ea0-1ef9,U+20ab}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:700;font-display:swap;src:url(/_next/static/media/d6b16ce4a6175f26-s.woff2) format("woff2");unicode-range:U+0100-02af,U+0304,U+0308,U+0329,U+1e00-1e9f,U+1ef2-1eff,U+2020,U+20a0-20ab,U+20ad-20c0,U+2113,U+2c60-2c7f,U+a720-a7ff}@font-face{font-family:__Inter_c19315;font-style:normal;font-weight:700;font-display:swap;src:url(/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2) format("woff2");unicode-range:U+00??,U+0131,U+0152-0153,U+02bb-02bc,U+02c6,U+02da,U+02dc,U+0304,U+0308,U+0329,U+2000-206f,U+2074,U+20ac,U+2122,U+2191,U+2193,U+2212,U+2215,U+feff,U+fffd}@font-face{font-family:__Inter_Fallback_c19315;src:local("Arial");ascent-override:90.20%;descent-override:22.48%;line-gap-override:0.00%;size-adjust:107.40%}.__className_c19315{font-family:__Inter_c19315,__Inter_Fallback_c19315;font-style:normal}:root{font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;--background-color:#fff;--text-color:#404040;--link-color:#2e6585;--border-color:#d3d3d3;--table-border-color:#d3d3d3;--pass-color:green;--fail-color:#ad0000;--success-background-color:#d1ffd7;--fail-background-color:#ffd1d1;--neutral-background-color:#eee;--variable-background-color:#f7f7f7;--header-background-color:#fffdf7;--insert-highlight-color:#d4fcbc;--delete-highlight-color:#fbb6c2;--prompt-highlight-color:linen;--textarea-background-color:#fff;--textarea-color:#404040;--search-highlight-color:#ff0;--search-text-color:inherit}[data-theme=dark]{--background-color:#1a1a1a;--text-color:#f0f0f0;--link-color:#6fcaff;--border-color:#444;--table-border-color:#444;--pass-color:#b1e9b3;--fail-color:#ee726a;--success-background-color:#216d2b;--fail-background-color:#6d2121;--neutral-background-color:#424242;--variable-background-color:#333;--header-background-color:#333;--insert-highlight-color:#4f8a34;--delete-highlight-color:#8a3434;--prompt-highlight-color:#67605a;--textarea-background-color:#2d2d2d;--textarea-color:#fff;--search-highlight-color:#ff0;--search-text-color:#404040}html{font-size:16px;background-color:var(--background-color);color:var(--text-color)}body{margin:0}a{color:var(--link-color);text-decoration:none}a:hover{text-decoration:underline}textarea{background-color:var(--textarea-background-color);color:var(--textarea-color);padding:.5em;border:1px solid var(--border-color);border-radius:.25em;resize:vertical}*{box-sizing:border-box}
@@ -0,0 +1 @@
1
+ .custom-metric-container{display:inline-flex;flex-wrap:wrap;gap:.25rem;font-weight:400}.custom-metric-container>span{padding:.25rem .5rem;border-radius:4px;color:var(--text-color);border:1px solid var(--border-color);margin-right:.25rem}.custom-metric-container>span.clickable{cursor:pointer}.custom-metric-container>span.clickable:hover{border-color:var(--link-color)}.fail-reason-carousel-controls{float:right;color:var(--text-color);font-weight:400}pre{white-space:pre-wrap}.font-bold{font-weight:700}.divTable,table.results-table{border-collapse:collapse;width:100%;margin:1rem 0}.results-table ins{background-color:var(--insert-highlight-color);text-decoration:none}.results-table del{background-color:var(--delete-highlight-color);-webkit-text-decoration:strikethrough;text-decoration:strikethrough}.tr{display:flex}.results-table tr,.tr{width:-moz-fit-content;width:fit-content}.results-table tr:hover,.tr:hover{background-color:rgba(0,0,0,.02)}.results-table td,.results-table th,.td,.th{position:relative;border:1px solid var(--border-color);vertical-align:top}.compact .td,.compact .th,.compact.results-table td,.compact.results-table th{padding:.5rem}.results-table td.variable,.results-table th.variable,.td.variable,.th.variable{background-color:var(--variable-background-color)}.variable .cell{max-height:100%;overflow-y:auto}.results-table tr.header{background-color:var(--header-background-color)}.results-table th,.th{padding:1rem;position:relative;vertical-align:bottom;text-align:left;white-space:pre-wrap;font-weight:400}.results-table th .action{cursor:pointer;margin-left:.5rem}.results-table th .action svg{vertical-align:middle}.results-table td,.results-table th{height:1px}@-moz-document url-prefix(){.results-table td,.results-table th{height:100%}}.firefox-fix{display:table;height:100%}.results-table tr .cell{display:flex;flex-direction:column;white-space:pre-wrap;height:100%;padding:1rem}.results-table tr .cell img{max-width:256px;max-height:256px;cursor:zoom-in}.results-table tr .cell .prompt{background-color:var(--variable-background-color);padding:1rem;font-family:Courier New,Courier,monospace;font-size:.8rem}.results-table tr .cell .prompt,.results-table tr .cell .prompt .pill{border:1px solid var(--border-color);border-radius:4px;margin-bottom:.5rem}.results-table tr .cell .prompt .pill{display:block;background-color:var(--neutral-background-color);padding:.25rem;width:-moz-fit-content;width:fit-content}.results-table tr .cell-actions{display:flex;gap:.5rem;visibility:hidden;position:absolute;top:1.25rem;right:.75rem;line-height:0;font-size:1.25rem}.results-table tr:hover .cell-actions{visibility:visible}.results-table tr .cell-detail{display:flex;flex-wrap:wrap;column-gap:.5rem;row-gap:.25rem;padding-top:1rem;margin-top:auto}.results-table tr .stat-item{font-weight:400;font-size:.75rem;color:#888}.results-table tr .cell-actions .action{cursor:pointer}.results-table tr .cell table{width:100%;border-collapse:collapse;margin:1rem 0}.results-table tr .cell table td,.results-table tr .cell table th{border:1px solid var(--border-color);padding:.5rem;text-align:left}.results-table tr .cell table th{background-color:var(--header-background-color);font-weight:700}.results-table tr .cell table tr:nth-child(2n){background-color:var(--row-background-color)}.results-table tr .cell table tr:hover{background-color:var(--hover-background-color)}.results-table th .output-header{display:flex;flex-direction:column;height:100%;align-items:flex-start}.results-table th .output-header .pills{display:flex;flex-wrap:wrap;gap:.25rem;align-items:center;margin-bottom:.5rem}.results-table th .prompt-container{font-weight:700;margin-bottom:.5rem}.results-table th .prompt-container>*{display:inline}.results-table th .provider{display:inline-block;padding:.25rem .5rem;background-color:var(--neutral-background-color);border:1px solid var(--border-color);border-radius:4px;margin-right:.25rem}.results-table th .summary{font-weight:400}.results-table th .prompt-detail{display:flex;flex-wrap:wrap;column-gap:.5rem;row-gap:.25rem;font-size:.75rem;color:#888;margin-top:auto}.results-table th .summary .highlight{padding:.25rem .5rem;border-radius:4px;background-color:var(--fail-background-color);border:1px solid var(--border-color)}.results-table th .summary .highlight.success{background-color:var(--success-background-color);border:1px solid var(--pass-color)}.results-table .status{display:flex;flex-direction:column;gap:.25rem;font-weight:700;margin-bottom:.5rem}.results-table .status .pill{display:inline-block;padding:.25rem .5rem;border-radius:4px;margin-right:.25rem;align-self:flex-start}.results-table .pass .pill{background-color:var(--success-background-color);color:var(--pass-color);border:1px solid var(--pass-color)}.results-table .fail .pill{border:1px solid var(--fail-color)}.fail-reason,.results-table .fail{color:var(--fail-color)}.fail-reason{font-weight:700}.compact .fail-reason{display:inline}.results-table .fail .pill{background-color:var(--fail-background-color)}.results-table td .score{font-weight:400}.results-table .comment{margin-top:.5rem;padding:.25rem .5rem;border-radius:4px;background-color:var(--neutral-background-color);font-style:italic;cursor:pointer}.results-table td.first-prompt-col{border-left:2px solid #888}.results-table td.first-prompt-row{border-top:2px solid #888}.search-highlight{color:var(--search-text-color);background-color:var(--search-highlight-color)}.results-table tr .cell .lightbox{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;z-index:1000}.results-table tr .cell .lightbox img{max-width:90%;max-height:90%;cursor:zoom-out}.resizer{position:absolute;right:0;top:0;height:100%;width:5px;cursor:col-resize;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:none;background:var(--text-color);opacity:.5}.resizer.isResizing{background:var(--text-color);opacity:1}@media (hover:hover){.resizer{opacity:0}:hover>.resizer{opacity:1}}.description{cursor:pointer;transition:background-color .3s ease}.description:hover{background-color:#f0f0f0}.eval-header{display:flex;align-items:center;flex-grow:1}.eval-header strong{font-weight:500}body{background-color:var(--background-color);color:var(--text-color)}.error,.notice{display:flex;flex-direction:column;gap:1.5rem;justify-content:center;align-items:center;height:9rem}.error{font-size:1.5rem}
@@ -0,0 +1 @@
1
+ .custom-metric-container{display:inline-flex;flex-wrap:wrap;gap:.25rem;font-weight:400}.custom-metric-container>span{padding:.25rem .5rem;border-radius:4px;color:var(--text-color);border:1px solid var(--border-color);margin-right:.25rem}.custom-metric-container>span.clickable{cursor:pointer}.custom-metric-container>span.clickable:hover{border-color:var(--link-color)}.fail-reason-carousel-controls{float:right;color:var(--text-color);font-weight:400}pre{white-space:pre-wrap}.font-bold{font-weight:700}.divTable,table.results-table{border-collapse:collapse;width:100%;margin:1rem 0}.results-table ins{background-color:var(--insert-highlight-color);text-decoration:none}.results-table del{background-color:var(--delete-highlight-color);-webkit-text-decoration:strikethrough;text-decoration:strikethrough}.tr{display:flex}.results-table tr,.tr{width:-moz-fit-content;width:fit-content}.results-table tr:hover,.tr:hover{background-color:rgba(0,0,0,.02)}.results-table td,.results-table th,.td,.th{position:relative;border:1px solid var(--border-color);vertical-align:top}.compact .td,.compact .th,.compact.results-table td,.compact.results-table th{padding:.5rem}.results-table td.variable,.results-table th.variable,.td.variable,.th.variable{background-color:var(--variable-background-color)}.variable .cell{max-height:100%;overflow-y:auto}.results-table tr.header{background-color:var(--header-background-color)}.results-table th,.th{padding:1rem;position:relative;vertical-align:bottom;text-align:left;white-space:pre-wrap;font-weight:400}.results-table th .action{cursor:pointer;margin-left:.5rem}.results-table th .action svg{vertical-align:middle}.results-table td,.results-table th{height:1px}@-moz-document url-prefix(){.results-table td,.results-table th{height:100%}}.firefox-fix{display:table;height:100%}.results-table tr .cell{display:flex;flex-direction:column;white-space:pre-wrap;height:100%;padding:1rem}.results-table tr .cell img{max-width:256px;max-height:256px;cursor:zoom-in}.results-table tr .cell .prompt{background-color:var(--variable-background-color);padding:1rem;font-family:Courier New,Courier,monospace;font-size:.8rem}.results-table tr .cell .prompt,.results-table tr .cell .prompt .pill{border:1px solid var(--border-color);border-radius:4px;margin-bottom:.5rem}.results-table tr .cell .prompt .pill{display:block;background-color:var(--neutral-background-color);padding:.25rem;width:-moz-fit-content;width:fit-content}.results-table tr .cell-actions{display:flex;gap:.5rem;visibility:hidden;position:absolute;top:1.25rem;right:.75rem;line-height:0;font-size:1.25rem}.results-table tr:hover .cell-actions{visibility:visible}.results-table tr .cell-detail{display:flex;flex-wrap:wrap;column-gap:.5rem;row-gap:.25rem;padding-top:1rem;margin-top:auto}.results-table tr .stat-item{font-weight:400;font-size:.75rem;color:#888}.results-table tr .cell-actions .action{cursor:pointer}.results-table tr .cell table{width:100%;border-collapse:collapse;margin:1rem 0}.results-table tr .cell table td,.results-table tr .cell table th{border:1px solid var(--border-color);padding:.5rem;text-align:left}.results-table tr .cell table th{background-color:var(--header-background-color);font-weight:700}.results-table tr .cell table tr:nth-child(2n){background-color:var(--row-background-color)}.results-table tr .cell table tr:hover{background-color:var(--hover-background-color)}.results-table th .output-header{display:flex;flex-direction:column;height:100%;align-items:flex-start}.results-table th .output-header .pills{display:flex;flex-wrap:wrap;gap:.25rem;align-items:center;margin-bottom:.5rem}.results-table th .prompt-container{font-weight:700;margin-bottom:.5rem}.results-table th .prompt-container>*{display:inline}.results-table th .provider{display:inline-block;padding:.25rem .5rem;background-color:var(--neutral-background-color);border:1px solid var(--border-color);border-radius:4px;margin-right:.25rem}.results-table th .summary{font-weight:400}.results-table th .prompt-detail{display:flex;flex-wrap:wrap;column-gap:.5rem;row-gap:.25rem;font-size:.75rem;color:#888;margin-top:auto}.results-table th .summary .highlight{padding:.25rem .5rem;border-radius:4px;background-color:var(--fail-background-color);border:1px solid var(--border-color)}.results-table th .summary .highlight.success{background-color:var(--success-background-color);border:1px solid var(--pass-color)}.results-table .status{display:flex;flex-direction:column;gap:.25rem;font-weight:700;margin-bottom:.5rem}.results-table .status .pill{display:inline-block;padding:.25rem .5rem;border-radius:4px;margin-right:.25rem;align-self:flex-start}.results-table .pass .pill{background-color:var(--success-background-color);color:var(--pass-color);border:1px solid var(--pass-color)}.results-table .fail .pill{border:1px solid var(--fail-color)}.fail-reason,.results-table .fail{color:var(--fail-color)}.fail-reason{font-weight:700}.compact .fail-reason{display:inline}.results-table .fail .pill{background-color:var(--fail-background-color)}.results-table td .score{font-weight:400}.results-table .comment{margin-top:.5rem;padding:.25rem .5rem;border-radius:4px;background-color:var(--neutral-background-color);font-style:italic;cursor:pointer}.results-table td.first-prompt-col{border-left:2px solid #888}.results-table td.first-prompt-row{border-top:2px solid #888}.search-highlight{color:var(--search-text-color);background-color:var(--search-highlight-color)}.results-table tr .cell .lightbox{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;z-index:1000}.results-table tr .cell .lightbox img{max-width:90%;max-height:90%;cursor:zoom-out}.resizer{position:absolute;right:0;top:0;height:100%;width:5px;cursor:col-resize;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:none;background:var(--text-color);opacity:.5}.resizer.isResizing{background:var(--text-color);opacity:1}@media (hover:hover){.resizer{opacity:0}:hover>.resizer{opacity:1}}.description{cursor:pointer;transition:background-color .3s ease}.description:hover{background-color:#f0f0f0}.eval-header{display:flex;align-items:center;flex-grow:1}.eval-header strong{font-weight:500}body{background-color:var(--background-color);color:var(--text-color)}.notice{display:flex;flex-direction:column;gap:1.5rem;justify-content:center;align-items:center;height:9rem}