promptfoo 0.63.2 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -36
- package/dist/package.json +12 -11
- package/dist/src/assertions.d.ts +1 -1
- package/dist/src/assertions.d.ts.map +1 -1
- package/dist/src/assertions.js +30 -34
- package/dist/src/assertions.js.map +1 -1
- package/dist/src/commands/export.d.ts.map +1 -1
- package/dist/src/commands/export.js +28 -11
- package/dist/src/commands/export.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/main.js +8 -0
- package/dist/src/main.js.map +1 -1
- package/dist/src/matchers.js +1 -1
- package/dist/src/matchers.js.map +1 -1
- package/dist/src/onboarding.d.ts +1 -1
- package/dist/src/onboarding.d.ts.map +1 -1
- package/dist/src/onboarding.js +22 -12
- package/dist/src/onboarding.js.map +1 -1
- package/dist/src/providers/anthropic.d.ts +3 -0
- package/dist/src/providers/anthropic.d.ts.map +1 -1
- package/dist/src/providers/anthropic.js +40 -9
- package/dist/src/providers/anthropic.js.map +1 -1
- package/dist/src/providers/bedrock.d.ts.map +1 -1
- package/dist/src/providers/bedrock.js +10 -4
- package/dist/src/providers/bedrock.js.map +1 -1
- package/dist/src/providers/portkey.d.ts +27 -1
- package/dist/src/providers/portkey.d.ts.map +1 -1
- package/dist/src/providers/portkey.js +7 -27
- package/dist/src/providers/portkey.js.map +1 -1
- package/dist/src/providers/promptfoo.d.ts.map +1 -1
- package/dist/src/providers/promptfoo.js +5 -1
- package/dist/src/providers/promptfoo.js.map +1 -1
- package/dist/src/providers/vertex.d.ts.map +1 -1
- package/dist/src/providers/vertex.js +3 -1
- package/dist/src/providers/vertex.js.map +1 -1
- package/dist/src/providers/voyage.d.ts +13 -0
- package/dist/src/providers/voyage.d.ts.map +1 -0
- package/dist/src/providers/voyage.js +77 -0
- package/dist/src/providers/voyage.js.map +1 -0
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +4 -0
- package/dist/src/providers.js.map +1 -1
- package/dist/src/redteam/getHarmfulTests.d.ts +2 -2
- package/dist/src/redteam/getHarmfulTests.d.ts.map +1 -1
- package/dist/src/redteam/getHarmfulTests.js +8 -4
- package/dist/src/redteam/getHarmfulTests.js.map +1 -1
- package/dist/src/redteam/getPoliticalStatementsTests.d.ts +3 -0
- package/dist/src/redteam/getPoliticalStatementsTests.d.ts.map +1 -0
- package/dist/src/redteam/getPoliticalStatementsTests.js +78 -0
- package/dist/src/redteam/getPoliticalStatementsTests.js.map +1 -0
- package/dist/src/redteam/getUnintendedContractTests.d.ts +3 -0
- package/dist/src/redteam/getUnintendedContractTests.d.ts.map +1 -0
- package/dist/src/redteam/getUnintendedContractTests.js +68 -0
- package/dist/src/redteam/getUnintendedContractTests.js.map +1 -0
- package/dist/src/redteam/index.d.ts.map +1 -1
- package/dist/src/redteam/index.js +13 -5
- package/dist/src/redteam/index.js.map +1 -1
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +1 -0
- package/dist/src/util.js.map +1 -1
- package/dist/src/web/nextui/404/index.html +1 -1
- package/dist/src/web/nextui/404.html +1 -1
- package/dist/src/web/nextui/_next/static/a0zP5AalfDflhG52x_qBh/_buildManifest.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/106-598707cae3f2a1bd.js +44 -0
- package/dist/src/web/nextui/_next/static/chunks/135-7aa62cd3f1582b50.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/166-157bfb431b68d949.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/{1a53ab81-6d64be52a06b7c39.js → 1a53ab81-5e1a018996226f61.js} +2 -2
- package/dist/src/web/nextui/_next/static/chunks/2-bd2aabe9db98a910.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/215-7d83203d614bcd6a.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/235-2bbcbc3cd37eef0f.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/258-8a7aa9a347c287ea.js +8 -0
- package/dist/src/web/nextui/_next/static/chunks/304-37065d54ff218f46.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/322-92c9551f32057648.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/339-f38253669d469118.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/371-0554dc4f28404020.js +32 -0
- package/dist/src/web/nextui/_next/static/chunks/374-d40e4777b00cf7a7.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/378-4b0cc74c685f98f9.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/540-56159a4d6bc0d205.js +97 -0
- package/dist/src/web/nextui/_next/static/chunks/620-1e779bd81b43dafb.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/631-87fea556bbafe972.js +6 -0
- package/dist/src/web/nextui/_next/static/chunks/640-0f757e2fe135173d.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/730-3eb7255cd813a727.js +25 -0
- package/dist/src/web/nextui/_next/static/chunks/770-577cd7d7d380b3ac.js +2 -0
- package/dist/src/web/nextui/_next/static/chunks/873-0692f91d92df9b1d.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/887.028187fb318c3e59.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/954-97a0f702595307f3.js +6 -0
- package/dist/src/web/nextui/_next/static/chunks/995-c9a656a43545902a.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/auth/login/page-c4a2650ac3a0ecd9.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/page-dd18caf3100d8d0e.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-9426b519d4be1fdb.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-fe10d5df88bc44ef.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/page-40b89e739dc45119.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-16d9d50aa8dc0520.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/layout-dfda5ed5ef745c2d.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/page-122e9cfa52eb218a.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/progress/page-00b5c3308a81af12.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-ee610cffca4b965b.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/report/page-6e8ef680a9affe41.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/setup/page-af75505cf5003ac1.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/b6261da7-e9d81a4364ddd0c0.js +9 -0
- package/dist/src/web/nextui/_next/static/chunks/framework-c3d480eb9ad30ba5.js +25 -0
- package/dist/src/web/nextui/_next/static/chunks/main-853e5508e37bbe4c.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/main-app-7a1376166cb8b72e.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/pages/_app-998b254a061422d4.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/pages/_error-94f0db477e27e000.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/webpack-f33a3d7cf8537919.js +1 -0
- package/dist/src/web/nextui/_next/static/css/15e7b41f5e8a79bf.css +1 -0
- package/dist/src/web/nextui/_next/static/css/51f7d6933894a4f8.css +1 -0
- package/dist/src/web/nextui/_next/static/css/85bfc598653c1699.css +1 -0
- package/dist/src/web/nextui/auth/login/index.html +1 -1
- package/dist/src/web/nextui/auth/login/index.txt +5 -5
- package/dist/src/web/nextui/auth/signup/index.html +1 -1
- package/dist/src/web/nextui/auth/signup/index.txt +5 -5
- package/dist/src/web/nextui/datasets/index.html +1 -1
- package/dist/src/web/nextui/datasets/index.txt +5 -5
- package/dist/src/web/nextui/eval/index.html +1 -1
- package/dist/src/web/nextui/eval/index.txt +7 -7
- package/dist/src/web/nextui/index.html +1 -1
- package/dist/src/web/nextui/index.txt +4 -4
- package/dist/src/web/nextui/progress/index.html +1 -1
- package/dist/src/web/nextui/progress/index.txt +5 -5
- package/dist/src/web/nextui/prompts/index.html +1 -1
- package/dist/src/web/nextui/prompts/index.txt +5 -5
- package/dist/src/web/nextui/report/index.html +1 -0
- package/dist/src/web/nextui/report/index.txt +17 -0
- package/dist/src/web/nextui/setup/index.html +2 -2
- package/dist/src/web/nextui/setup/index.txt +6 -6
- package/package.json +12 -11
- package/dist/src/web/nextui/_next/static/T-Po7cKimMNTqoq7rCMq5/_buildManifest.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/106-1dceaa80df396865.js +0 -44
- package/dist/src/web/nextui/_next/static/chunks/107-ffb99760e0fb68f2.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/189-b6f910f4b701335b.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/215-63edfe1b1ae625e4.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/226-8eeb88a656092f72.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/235-5dedba2497d889c9.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/249-d4e0e50561ef8185.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/339-132502fa6d7b24c7.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/383-e19d78b51fa58f1b.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/629-2358b4dcbf84d053.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/631-efb1476abf72c1ff.js +0 -6
- package/dist/src/web/nextui/_next/static/chunks/635-d64ddf71d262749b.js +0 -97
- package/dist/src/web/nextui/_next/static/chunks/690-618c46a7158870af.js +0 -6
- package/dist/src/web/nextui/_next/static/chunks/7-6b1daff67cc5affb.js +0 -32
- package/dist/src/web/nextui/_next/static/chunks/730-9147ccb0626b2f6b.js +0 -25
- package/dist/src/web/nextui/_next/static/chunks/733-3e9ca9d39ddcb04c.js +0 -8
- package/dist/src/web/nextui/_next/static/chunks/770-fdb322f705e07d72.js +0 -2
- package/dist/src/web/nextui/_next/static/chunks/887.b3cb35585a6859bd.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/auth/login/page-4c3e963c95f17d0d.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/page-e5ee780ad914444b.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-b661c8d02af86f57.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-07e0dc7d48d31372.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/page-4f99a1a3db60e001.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-ff3a23e0e056a0cc.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/layout-844906ca58c0d644.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/page-4226f7bf0849864a.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/progress/page-5a4a4149e2361872.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-c5878f6e2cbee318.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/setup/page-f75709dda664e392.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/b6261da7-08dd8cb380ab7859.js +0 -9
- package/dist/src/web/nextui/_next/static/chunks/framework-e023a0f436413246.js +0 -25
- package/dist/src/web/nextui/_next/static/chunks/main-a0f072bd67a01e59.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/main-app-9a21304a7d2c7cca.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/pages/_app-19a521e9841c5ed8.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/pages/_error-d23f5e48cbe51f4e.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/webpack-0a139c96915bebb5.js +0 -1
- package/dist/src/web/nextui/_next/static/css/0e96bc835813e9d5.css +0 -1
- package/dist/src/web/nextui/_next/static/css/962981c6b98dedf4.css +0 -1
- /package/dist/src/web/nextui/_next/static/{T-Po7cKimMNTqoq7rCMq5 → a0zP5AalfDflhG52x_qBh}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[271],{1520:function(t,e,a){"use strict";a.d(e,{Z:function(){return W}});var r=a(4312),n=a(9042),i=a(4978),o=a(3468),s=a(6213),u=a(3982),l=a(225),d=a(8976),p=a(4059),h=a(3437),c=a(4004);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(1427),y=a(1608),Z=a(9020);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},3147:function(t,e,a){"use strict";a.d(e,{Z:function(){return W}});var r=a(4312),n=a(9042),i=a(4978),o=a(3468),s=a(6251),u=a(3982),l=a(1608),d=a(9020),p=a(1427),h=a(5800),c=a(6213);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(4004);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},8874:function(t,e,a){Promise.resolve().then(a.bind(a,8567))},8567:function(t,e,a){"use strict";a.r(e),a.d(e,{default:function(){return c}});var r=a(4004),n=a(4978),i=a(8640),o=a.n(i),s=a(982),u=a(7339),l=a(1520),d=a(3147),p=a(8891),h=a(1445);function c(){let t=(0,p.useRouter)(),[e,a]=n.useState(""),[i,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 h.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 h.OQ.auth.signUp({email:e,password:i,options:{emailRedirectTo:"".concat(location.origin,"/auth/callback")}});r?g(r.message):t.push("/")}x(!1)};return(0,r.jsxs)(l.Z,{component:"main",maxWidth:"xs",children:[(0,r.jsx)(d.Z,{component:"h1",variant:"h5",children:"Sign up"}),(0,r.jsx)("p",{children:(0,r.jsx)(d.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:i,error:!!m,helperText:m}),(0,r.jsx)(s.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)(o(),{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(4004),n=a(4978),i=a(2594);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})}}},function(t){t.O(0,[635,215,383,339,690,470,730,744],function(){return t(t.s=8874)}),_N_E=t.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{9166:function(e,t,s){Promise.resolve().then(s.bind(s,1400))},9532: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}})},1400:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return S}});var n=s(4004),i=s(4978),r=s(8640),l=s.n(r),c=s(1358),a=s(2202),d=s(5068),o=s(417),h=s(1303),u=s(6485),p=s(21),x=s(9708),j=s(5969),v=s(8891),m=s(4235),Z=s(982),f=s(9794),w=s(2701),C=s(1956),y=s(2669),g=s(3147),I=s(613);function k(e){var t,s,r,c;let{openDialog:x,handleClose:j,testCase:v}=e,[k,P]=(0,i.useState)(1);return(0,n.jsxs)(f.Z,{open:x,onClose:j,fullWidth:!0,maxWidth:"lg",children:[(0,n.jsxs)(y.Z,{children:["Dataset ",v.id.slice(0,6)]}),(0,n.jsxs)(C.Z,{children:[(0,n.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Test cases"}),(0,n.jsx)(I.u,{readOnly:!0,value:v&&m.default.dump(v.testCases),style:{width:"100%",padding:"0.75rem"},maxRows:15}),(0,n.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(u.Z,{children:(0,n.jsxs)(p.Z,{children:[(0,n.jsx)(h.Z,{children:"Eval ID"}),(0,n.jsx)(h.Z,{children:"Prompt ID"}),(0,n.jsx)(h.Z,{children:"Raw score"}),(0,n.jsx)(h.Z,{children:"Pass rate"}),(0,n.jsx)(h.Z,{children:"Pass count"}),(0,n.jsx)(h.Z,{children:"Fail count"}),(0,n.jsx)(h.Z,{children:"Prompt"})]})}),(0,n.jsx)(o.Z,{children:null==v?void 0:null===(t=v.prompts)||void 0===t?void 0:t.slice((k-1)*10,10*k).sort((e,t)=>t.evalId.localeCompare(e.evalId)).map((e,t)=>{var s,i,a,d,o;return(0,n.jsxs)(p.Z,{hover:!0,children:[(0,n.jsx)(h.Z,{children:(0,n.jsx)(l(),{href:"/eval/?evalId=".concat(e.evalId),children:e.evalId})}),(0,n.jsx)(h.Z,{style:{minWidth:"8em"},children:(0,n.jsx)(l(),{href:"/prompts/?id=".concat(e.id),children:e.id.slice(0,6)})}),(0,n.jsx)(h.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)(h.Z,{children:"number"==typeof(null===(i=e.prompt.metrics)||void 0===i?void 0:i.testPassCount)&&"number"==typeof(null===(a=e.prompt.metrics)||void 0===a?void 0:a.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)(h.Z,{children:null!==(r=null===(d=e.prompt.metrics)||void 0===d?void 0:d.testPassCount)&&void 0!==r?r:"-"}),(0,n.jsx)(h.Z,{children:null!==(c=null===(o=e.prompt.metrics)||void 0===o?void 0:o.testFailCount)&&void 0!==c?c:"-"}),(0,n.jsx)(h.Z,{children:e.prompt.raw.length>250?e.prompt.raw.slice(0,250)+"...":e.prompt.raw})]},t)})})]}),Math.ceil(((null==v?void 0:null===(s=v.prompts)||void 0===s?void 0:s.length)||0)/10)>1&&(0,n.jsx)(a.Z,{count:Math.ceil(v.prompts.length/10),page:k,onChange:(e,t)=>{P(t)}})]}),(0,n.jsx)(w.Z,{children:(0,n.jsx)(Z.Z,{onClick:j,children:"Close"})})]})}var P=s(9532);function S(){let e=(0,v.useSearchParams)(),[t,s]=(0,i.useState)([]),[r,m]=(0,i.useState)("date"),[Z,f]=(0,i.useState)("desc"),[w,C]=(0,i.useState)(1),[y,g]=(0,i.useState)(10),[I,S]=(0,i.useState)(!1),[b,E]=(0,i.useState)(0),D=e=>{let t=r===e&&"asc"===Z?"desc":"asc";m(e),f(t)};(0,i.useEffect)(()=>{(async()=>{fetch("".concat(await (0,P.b)(),"/api/datasets")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===r?0:"asc"===Z?e[r]>t[r]?1:-1:e[r]<t[r]?1:-1);s(t)})})()},[r,Z,w,y]),(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]);let F=e=>{E(e),S(!0)};return(0,n.jsxs)(c.Z,{paddingX:2,children:[(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(u.Z,{children:(0,n.jsxs)(p.Z,{children:[(0,n.jsx)(h.Z,{style:{width:"10%"},children:"ID"}),(0,n.jsx)(h.Z,{style:{width:"20%"},children:(0,n.jsx)(x.Z,{active:"raw"===r,direction:"raw"===r?Z:"asc",onClick:()=>D("raw"),children:"Info"})}),(0,n.jsx)(h.Z,{style:{width:"20%"},children:"Variables"}),(0,n.jsx)(h.Z,{style:{width:"10%"},children:(0,n.jsx)(x.Z,{active:"count"===r,direction:"count"===r?Z:"asc",onClick:()=>D("count"),children:"Total # evals"})}),(0,n.jsx)(h.Z,{style:{width:"20%"},children:(0,n.jsx)(j.Z,{title:"The date of the most recent eval for this set of test cases",children:(0,n.jsx)(x.Z,{active:"date"===r,direction:"date"===r?Z:"asc",onClick:()=>D("date"),children:"Most recent eval date"})})}),(0,n.jsx)(h.Z,{style:{width:"20%"},children:(0,n.jsx)(j.Z,{title:"The ID of the most recent eval for this set of test cases",children:(0,n.jsx)(x.Z,{active:"evalId"===r,direction:"evalId"===r?Z:"asc",onClick:()=>D("evalId"),children:"Most recent eval ID"})})})]})}),(0,n.jsx)(o.Z,{children:t.slice((w-1)*y,w*y).map((e,t)=>(0,n.jsxs)(p.Z,{hover:!0,onClick:()=>F(t),style:{cursor:"pointer"},children:[(0,n.jsx)(h.Z,{children:e.id.slice(0,6)}),(0,n.jsxs)(h.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:[e.testCases.length," test cases"]}),(0,n.jsx)(h.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)(h.Z,{style:{width:"10%"},children:e.count}),(0,n.jsx)(h.Z,{style:{width:"20%"},children:e.recentEvalDate||"Unknown"}),(0,n.jsx)(h.Z,{style:{width:"20%"},children:e.recentEvalId?(0,n.jsx)(l(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalId}):"Unknown"})]},t))})]}),Math.ceil(t.length/y)>1&&(0,n.jsx)(a.Z,{count:Math.ceil(t.length/y),page:w,onChange:(e,t)=>C(t)}),t[b]&&(0,n.jsx)(k,{openDialog:I,handleClose:()=>{S(!1)},testCase:t[b]})]})}},8891:function(e,t,s){e.exports=s(8556)}},function(e){e.O(0,[635,215,770,249,235,189,470,730,744],function(){return e(e.s=9166)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[466],{6144:function(n,e,u){Promise.resolve().then(u.t.bind(u,9820,23))},9820:function(){}},function(n){n.O(0,[470,730,744],function(){return n(n.s=6144)}),_N_E=n.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[421],{1070:function(e,n,t){Promise.resolve().then(t.t.bind(t,6662,23)),Promise.resolve().then(t.t.bind(t,7924,23)),Promise.resolve().then(t.t.bind(t,910,23)),Promise.resolve().then(t.t.bind(t,1885,23)),Promise.resolve().then(t.bind(t,4226)),Promise.resolve().then(t.t.bind(t,9820,23))},1885: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(9278),t(4978);let r=t(6995);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}},9820:function(){}},function(e){e.O(0,[583,635,215,383,339,770,690,249,629,235,631,106,7,226,470,730,744],function(){return e(e.s=1070)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[11],{6189:function(e,n,s){Promise.resolve().then(s.t.bind(s,3512,23)),Promise.resolve().then(s.bind(s,4226))}},function(e){e.O(0,[583,635,215,383,339,770,690,249,629,235,631,106,7,226,470,730,744],function(){return e(e.s=6189)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{6741:function(e,t,n){Promise.resolve().then(n.bind(n,224)),Promise.resolve().then(n.t.bind(n,2988,23)),Promise.resolve().then(n.t.bind(n,5100,23))},224:function(e,t,n){"use strict";n.r(t),n.d(t,{PageShell:function(){return Z}});var r=n(4004),s=n(4978),o=n(8127),i=n(1867),a=n(1191),l=n(1445),u=n(8640),c=n.n(u),d=n(2414),h=n(8891),f=n(7051),m=n.n(f),x=n(1358);function g(){return(0,r.jsxs)(x.Z,{className:"logo",children:[(0,r.jsx)(m(),{width:25,height:25,src:"/logo.svg",alt:"Promptfoo logo"})," ",(0,r.jsx)("span",{children:"promptfoo"})]})}n(7328);var j=n(1657),p=n(2324),v=n(6976),b=n(7656);function E(){let{user:e,logout:t}=(0,l.aC)(),[n,o]=s.useState(null),i=async()=>{null==t||t(),a()},a=()=>{o(null)};return e?(0,r.jsxs)("div",{children:[(0,r.jsx)(b.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)(j.Z,{sx:{width:"1em",height:"1em",bgcolor:"#1976d2"}})}),(0,r.jsxs)(p.Z,{id:"menu-appbar",anchorEl:n,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!n,onClose:a,children:[(0,r.jsxs)(v.Z,{disabled:!0,children:["Logged in as ",e.email]}),(0,r.jsx)(v.Z,{onClick:i,children:"Logout"})]})]}):(0,r.jsx)(c(),{href:"/auth/signup/",children:(0,r.jsx)(b.Z,{edge:"end","aria-label":"User not logged in","aria-controls":"menu-appbar","aria-haspopup":"true",color:"inherit",children:(0,r.jsx)(j.Z,{sx:{width:"1em",height:"1em"}})})})}var _=n(5707),k=n(378);function N(e){let{darkMode:t,onToggleDarkMode:n}=e;return(0,r.jsx)("div",{className:"dark-mode-toggle",onClick:n,children:t?(0,r.jsx)(_.Z,{}):(0,r.jsx)(k.Z,{})})}n(2854);var O=n(2428);n(5008);var C=n(7580);function P(e){let{href:t,label:n}=e,s=(0,h.usePathname)()||"";return(0,r.jsx)(c(),{href:t,className:s.startsWith(t)?"active":"",children:n})}function S(e){let{darkMode:t,onToggleDarkMode:n}=e;return C.env.NEXT_PUBLIC_NO_BROWSING?(0,r.jsxs)(d.Z,{direction:"row",spacing:2,className:"nav",children:[(0,r.jsx)(g,{}),(0,r.jsx)(N,{darkMode:t,onToggleDarkMode:n})]}):(0,r.jsxs)(d.Z,{direction:"row",spacing:2,className:"nav",children:[(0,r.jsx)(g,{}),(0,r.jsx)(P,{href:"/setup",label:"New Eval"}),(0,r.jsx)(P,{href:"/eval",label:"Evals"}),(0,r.jsx)(P,{href:"/prompts",label:"Prompts"}),(0,r.jsx)(P,{href:"/datasets",label:"Datasets"}),(0,r.jsx)(P,{href:"/progress",label:"Progress"}),(0,r.jsxs)("div",{className:"right-aligned",children:[O.Ox?(0,r.jsx)(E,{}):null,(0,r.jsx)(N,{darkMode:t,onToggleDarkMode:n})]})]})}function Z(e){let{children:t}=e,n=(0,o.Z)("(prefers-color-scheme: dark)"),[u,c]=s.useState(n),d=s.useMemo(()=>(0,i.Z)({typography:{fontFamily:"inherit"},palette:{mode:u||n?"dark":"light"}}),[u,n]);return s.useEffect(()=>{n&&document.documentElement.setAttribute("data-theme","dark")},[n]),(0,r.jsx)(s.StrictMode,{children:(0,r.jsx)(a.Z,{theme:d,children:(0,r.jsx)(l.Ho,{children:(0,r.jsxs)(T,{children:[(0,r.jsx)(S,{darkMode:u,onToggleDarkMode:()=>{c(!u),u?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme","dark")}}),(0,r.jsx)("div",{children:t})]})})})})}function T(e){let{children:t}=e;return(0,r.jsx)("div",{children:t})}n(894)},2428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return o},T8:function(){return s},eA:function(){return i}});var r=n(7580);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(4004),s=n(4978),o=n(2594);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})}},2854:function(){},7328:function(){},5008:function(){},894:function(){},5100:function(){}},function(e){e.O(0,[635,383,690,107,470,730,744],function(){return e(e.s=6741)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{3712:function(e,n,t){Promise.resolve().then(t.t.bind(t,6662,23)),Promise.resolve().then(t.t.bind(t,7924,23)),Promise.resolve().then(t.t.bind(t,910,23)),Promise.resolve().then(t.t.bind(t,1885,23)),Promise.resolve().then(t.t.bind(t,8607,23))},1885: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(9278),t(4978);let r=t(6995);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}},8607:function(){}},function(e){e.O(0,[470,730,744],function(){return e(e.s=3712)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[92],{8931:function(e,t,a){"use strict";var i=a(1851);t.Z=void 0;var r=i(a(9570)),n=a(4004);t.Z=(0,r.default)((0,n.jsx)("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}),"Download")},6212:function(e,t,a){"use strict";a.d(t,{f:function(){return n}});var i=a(5800),r=a(6213);function n(e){return(0,r.ZP)("MuiListItemIcon",e)}let s=(0,i.Z)("MuiListItemIcon",["root","alignItemsFlexStart"]);t.Z=s},5224:function(e,t,a){"use strict";a.d(t,{L:function(){return n}});var i=a(5800),r=a(6213);function n(e){return(0,r.ZP)("MuiListItemText",e)}let s=(0,i.Z)("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);t.Z=s},6976:function(e,t,a){"use strict";a.d(t,{Z:function(){return M}});var i=a(4312),r=a(9042),n=a(4978),s=a(3468),o=a(3982),l=a(3477),d=a(1608),c=a(1874),u=a(9020),p=a(1112),v=a(151),m=a(6656),h=a(1776),x=a(5800);let Z=(0,x.Z)("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);var f=a(6212),g=a(5224),C=a(6213);function I(e){return(0,C.ZP)("MuiMenuItem",e)}let j=(0,x.Z)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var b=a(4004);let y=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],P=e=>{let{disabled:t,dense:a,divider:i,disableGutters:n,selected:s,classes:l}=e,d=(0,o.Z)({root:["root",a&&"dense",t&&"disabled",!n&&"gutters",i&&"divider",s&&"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:a}=e;return[t.root,a.dense&&t.dense,a.divider&&t.divider,!a.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 a;let o=(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}=o,I=(0,i.Z)(o,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)({},o,{dense:k.dense,divider:v,disableGutters:x}),S=P(o),$=(0,h.Z)(M,t);return o.disabled||(a=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:a,component:d,focusVisibleClassName:(0,s.Z)(S.focusVisible,Z),className:(0,s.Z)(S.root,C)},I,{ownerState:F,classes:S}))})});var M=k},1340:function(e,t,a){Promise.resolve().then(a.bind(a,9259))},9259:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return I}});var i=a(4004),r=a(4978),n=a(8640),s=a.n(n),o=a(8873),l=a(1358),d=a(982),c=a(8931),u=a(2324),p=a(6976),v=a(2202),m=a(5068),h=a(417),x=a(1303),Z=a(6485),f=a(21),g=a(9708),C=a(7339);function I(){let[e,t]=(0,r.useState)([]),[a,n]=(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"),a=await e.json();a&&a.data&&t(a.data)})()},[]);let S=e=>{let t=a===e&&"asc"===I;n(e),j(t?"desc":"asc")},$=t=>{let a="json"===t?JSON.stringify(e):R(e),i=new Blob([a],{type:"text/".concat(t,";charset=utf-8;")}),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download="cols_export.".concat(t),r.click(),URL.revokeObjectURL(r.href),y(null)},O=e=>(null==e?void 0:e.testPassCount)!=null&&(null==e?void 0:e.testFailCount)!=null?(e.testPassCount/(e.testPassCount+e.testFailCount)*100).toFixed(2):"-",R=e=>{var t,a,i,r,n;let s=e.map(e=>{var s,o,l,d,c;return[null!==(t=e.evalId)&&void 0!==t?t:"",null!==(a=null===(s=e.datasetId)||void 0===s?void 0:s.slice(0,6))&&void 0!==a?a:"",null!==(i=e.provider)&&void 0!==i?i:"",(null!==(r=null===(o=e.promptId)||void 0===o?void 0:o.slice(0,6))&&void 0!==r?r:"")+" "+(null!==(n=e.raw)&&void 0!==n?n:""),O(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?"-":e.metrics.score.toFixed(2)]});return[["Eval","Dataset","Provider","Prompt","Pass Rate %","Pass Count","Fail Count","Raw score"]].concat(s).map(e=>e.map(e=>null!=e?e:"").join(",")).join("\n")},L=r.useMemo(()=>e.filter(e=>{var t,a,i,r;return(!k.evalId||(null===(t=e.evalId)||void 0===t?void 0:t.includes(k.evalId)))&&(!k.datasetId||(null===(a=e.datasetId)||void 0===a?void 0:a.startsWith(k.datasetId)))&&(!k.provider||(null===(i=e.provider)||void 0===i?void 0:i.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(!a)return 0;if("passRate"===a){let a=parseFloat(O(e.metrics)),i=parseFloat(O(t.metrics));return"asc"===I?a-i:i-a}if(a in e&&a in t){let i=e[a]||"",r=t[a]||"";return"asc"===I?i.toString().localeCompare(r.toString()):r.toString().localeCompare(i.toString())}return 0}),[L,a,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,i.jsxs)(l.Z,{paddingX:2,children:[(0,i.jsxs)(l.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,i.jsx)("h2",{children:"Progress summary"}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.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,i.jsx)(c.Z,{}),children:"Export"}),(0,i.jsxs)(u.Z,{id:"export-menu",anchorEl:b,open:F,onClose:()=>{y(null)},MenuListProps:{"aria-labelledby":"export-button"},children:[(0,i.jsx)(p.Z,{onClick:()=>$("csv"),children:"CSV"}),(0,i.jsx)(p.Z,{onClick:()=>$("json"),children:"JSON"})]})]})]}),(0,i.jsx)(l.Z,{children:"This page shows performance metrics for recent evals."}),(0,i.jsxs)(l.Z,{display:"flex",flexDirection:"row",gap:2,mt:2,children:[(0,i.jsx)(o.Z,{options:E,value:k.evalId,onChange:(e,t)=>{M({...k,evalId:t||""})},renderInput:e=>(0,i.jsx)(C.Z,{...e,label:"Eval ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,i.jsx)(o.Z,{options:V,value:k.datasetId,onChange:(e,t)=>{M({...k,datasetId:t||""})},renderInput:e=>(0,i.jsx)(C.Z,{...e,label:"Dataset ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,i.jsx)(o.Z,{options:N,value:k.provider,onChange:(e,t)=>{M({...k,provider:t||""})},renderInput:e=>(0,i.jsx)(C.Z,{...e,label:"Provider",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,i.jsx)(o.Z,{options:z,value:k.promptId,onChange:(e,t)=>{M({...k,promptId:t||""})},renderInput:e=>(0,i.jsx)(C.Z,{...e,label:"Prompt ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}})]}),(0,i.jsxs)(m.Z,{children:[(0,i.jsx)(Z.Z,{children:(0,i.jsxs)(f.Z,{children:[(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"evalId"===a,direction:"evalId"===a?I:"asc",onClick:()=>S("evalId"),children:"Eval"})}),(0,i.jsx)(x.Z,{children:"Dataset"}),(0,i.jsx)(x.Z,{children:"Provider"}),(0,i.jsx)(x.Z,{children:"Prompt"}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"passRate"===a,direction:"passRate"===a?I:"asc",onClick:()=>S("passRate"),children:"Pass Rate %"})}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"testPassCount"===a,direction:"testPassCount"===a?I:"asc",onClick:()=>S("testPassCount"),children:"Pass Count"})}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"testFailCount"===a,direction:"testFailCount"===a?I:"asc",onClick:()=>S("testFailCount"),children:"Fail Count"})}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"score"===a,direction:"score"===a?I:"asc",onClick:()=>S("score"),children:"Raw score"})})]})}),(0,i.jsx)(h.Z,{children:D.slice((P-1)*25,25*P).map((e,t)=>{var a,r,n,o,l;return(0,i.jsxs)(f.Z,{hover:!0,onClick:()=>M({...k,evalId:e.evalId,datasetId:e.datasetId||"",promptId:e.promptId||"",provider:e.provider}),children:[(0,i.jsx)(x.Z,{children:(0,i.jsx)(s(),{href:"/eval?evalId=".concat(e.evalId),onClick:e=>e.stopPropagation(),children:e.evalId})}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(s(),{href:"/datasets?id=".concat(e.datasetId),onClick:e=>e.stopPropagation(),children:null===(a=e.datasetId)||void 0===a?void 0:a.slice(0,6)})}),(0,i.jsx)(x.Z,{children:e.provider}),(0,i.jsxs)(x.Z,{children:[(0,i.jsxs)(s(),{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,i.jsx)(x.Z,{children:O(e.metrics)}),(0,i.jsx)(x.Z,{children:(null===(n=e.metrics)||void 0===n?void 0:n.testPassCount)==null?"-":"".concat(e.metrics.testPassCount)}),(0,i.jsx)(x.Z,{children:(null===(o=e.metrics)||void 0===o?void 0:o.testFailCount)==null?"-":"".concat(e.metrics.testFailCount)}),(0,i.jsx)(x.Z,{children:(null===(l=e.metrics)||void 0===l?void 0:l.score)==null?"-":e.metrics.score.toFixed(2)})]},t)})})]}),Math.ceil(L.length/25)>1&&(0,i.jsx)(v.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,[635,215,383,339,770,629,189,470,730,744],function(){return e(e.s=1340)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[794],{8486:function(e,t,n){Promise.resolve().then(n.bind(n,3730))},9532:function(e,t,n){"use strict";let i,s;async function l(){if(i||(s||(s=fetch("/api/config").then(e=>e.json()).then(e=>i=e.apiBaseUrl)),await s),void 0===i)throw Error("API base URL is undefined");return i}n.d(t,{b:function(){return l}})},3730:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return I}});var i=n(4004),s=n(4978),l=n(8640),r=n.n(l),c=n(1358),d=n(2202),a=n(5068),o=n(417),h=n(1303),u=n(6485),x=n(21),j=n(9708),Z=n(5969),v=n(8891),p=n(9532),f=n(9794),m=n(2701),w=n(1956),y=n(2669),C=n(613),g=n(3147),E=n(982),k=e=>{var t;let{openDialog:n,handleClose:s,selectedPrompt:l}=e;return(0,i.jsxs)(f.Z,{open:n,onClose:s,fullWidth:!0,maxWidth:"lg",children:[(0,i.jsxs)(y.Z,{children:["Prompt ",l.id.slice(0,6)]}),(0,i.jsxs)(w.Z,{children:[(0,i.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Prompt"}),(0,i.jsx)(C.u,{readOnly:!0,value:null==l?void 0:null===(t=l.prompt)||void 0===t?void 0:t.raw,style:{width:"100%",padding:"0.75rem"},maxRows:50}),(0,i.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(u.Z,{children:(0,i.jsxs)(x.Z,{children:[(0,i.jsx)(h.Z,{children:"Eval ID"}),(0,i.jsx)(h.Z,{children:"Dataset ID"}),(0,i.jsx)(h.Z,{children:"Raw score"}),(0,i.jsx)(h.Z,{children:"Pass rate"}),(0,i.jsx)(h.Z,{children:"Pass count"}),(0,i.jsx)(h.Z,{children:"Fail count"})]})}),(0,i.jsx)(o.Z,{children:null==l?void 0:l.evals.sort((e,t)=>t.id.localeCompare(e.id)).map(e=>{var t,n,s,l,c,d;let a=null!==(l=null===(t=e.metrics)||void 0===t?void 0:t.testPassCount)&&void 0!==l?l:0,o=null!==(c=null===(n=e.metrics)||void 0===n?void 0:n.testFailCount)&&void 0!==c?c:0,u=a+o>0?(a/(a+o)*100).toFixed(2)+"%":"-";return(0,i.jsxs)(x.Z,{children:[(0,i.jsx)(h.Z,{children:(0,i.jsx)(r(),{href:"/eval/?evalId=".concat(e.id),children:e.id})}),(0,i.jsx)(h.Z,{children:(0,i.jsx)(r(),{href:"/datasets/?id=".concat(e.datasetId),children:e.datasetId.slice(0,6)})}),(0,i.jsx)(h.Z,{children:null!==(d=null===(s=e.metrics)||void 0===s?void 0:s.score.toFixed(2))&&void 0!==d?d:"-"}),(0,i.jsx)(h.Z,{children:u}),(0,i.jsx)(h.Z,{children:a}),(0,i.jsx)(h.Z,{children:o})]},"eval-".concat(e.id))})})]})]}),(0,i.jsx)(m.Z,{children:(0,i.jsx)(E.Z,{onClick:s,children:"Close"})})]})};function I(){let e=(0,v.useSearchParams)(),[t,n]=(0,s.useState)([]),[l,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=l===e&&"asc"===m?"desc":"asc";f(e),w(t)};(0,s.useEffect)(()=>{(async()=>{fetch("".concat(await (0,p.b)(),"/api/prompts")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===l?0:"asc"===m?e[l]>t[l]?1:-1:e[l]<t[l]?1:-1);n(t)})})()},[l,m]),(0,s.useEffect)(()=>{let n=null==e?void 0:e.get("id");if(n){let e=t.findIndex(e=>e.id.startsWith(n));-1!==e&&_(e)}},[t,e]);let _=e=>{P(!0),D(e)};return(0,i.jsxs)(c.Z,{paddingX:2,children:[(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(u.Z,{children:(0,i.jsxs)(x.Z,{children:[(0,i.jsx)(h.Z,{style:{width:"10%"},children:"ID"}),(0,i.jsx)(h.Z,{style:{width:"60%"},children:(0,i.jsx)(j.Z,{active:"raw"===l,direction:"raw"===l?m:"asc",onClick:()=>b("raw"),children:"Prompt"})}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:(0,i.jsx)(Z.Z,{title:"The date of the most recent eval for this prompt",children:(0,i.jsx)(j.Z,{active:"date"===l,direction:"date"===l?m:"asc",onClick:()=>b("date"),children:"Most recent eval"})})}),(0,i.jsx)(h.Z,{style:{width:"10%"},children:(0,i.jsx)(j.Z,{active:"count"===l,direction:"count"===l?m:"asc",onClick:()=>b("count"),children:"# Evals"})})]})}),(0,i.jsx)(o.Z,{children:t.slice((y-1)*g,y*g).map((e,t)=>(0,i.jsxs)(x.Z,{hover:!0,children:[(0,i.jsx)(h.Z,{style:{width:"10%"},children:e.id.slice(0,6)}),(0,i.jsx)(h.Z,{style:{width:"60%",whiteSpace:"pre-wrap",cursor:"pointer"},onClick:()=>_(t),children:e.prompt.raw.length>500?e.prompt.raw.slice(0,500)+"...":e.prompt.raw}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:e.recentEvalDate?(0,i.jsx)(r(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalDate.slice(0,10)}):"Unknown"}),(0,i.jsx)(h.Z,{style:{width:"10%"},children:e.count})]},t))})]}),Math.ceil(t.length/g)>1&&(0,i.jsx)(d.Z,{count:Math.ceil(t.length/g),page:y,onChange:(e,t)=>C(t)}),t[S]&&(0,i.jsx)(k,{openDialog:I,handleClose:()=>{P(!1)},selectedPrompt:t[S]})]})}},8891:function(e,t,n){e.exports=n(8556)}},function(e){e.O(0,[635,215,770,249,189,470,730,744],function(){return e(e.s=8486)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{6178:function(e,t,n){Promise.resolve().then(n.bind(n,3013))},3013:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ed}});var a=n(4004),i=n(4978),r=n(982),l=n(1520),s=n(3147),o=n(1358),c=n(2414),d=n(9794),p=n(2701),u=n(1956),h=n(8541),x=n(2669),m=n(9179),f=n(8891),g=n(1615),j=n(7887),v=n(2428),Z=()=>{let e=(0,f.useRouter)(),{env:t,description:n,providers:l,prompts:s,testCases:o,defaultTest:c,evaluateOptions:d}=(0,j.o)(),[p,u]=(0,i.useState)(!1),[h,x]=(0,i.useState)(0),m=async()=>{u(!0);try{let a=await fetch("".concat(v.eA,"/api/eval/job/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t,description:n,providers:l,prompts:s,tests:o,defaultTest:c,evaluateOptions:d})});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));let i=await a.json(),r=setInterval(async()=>{let t=await fetch("".concat(v.eA,"/api/eval/job/").concat(i.id,"/"));if(!t.ok)throw clearInterval(r),Error("HTTP error! status: ".concat(t.status));let n=await t.json();if("complete"===n.status)clearInterval(r),u(!1),v.Ox?e.push("/eval/remote:".concat(encodeURIComponent(i.id))):e.push("/eval");else if("failed"===n.status)throw clearInterval(r),u(!1),Error("Job failed");else{let e=0===n.total?0:Math.round(n.progress/n.total*100);x(e)}},1e3)}catch(e){console.error(e),u(!1),alert("An error occurred: ".concat(e.message))}};return(0,a.jsx)(r.Z,{variant:"contained",color:"primary",onClick:m,disabled:p,children:p?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{size:24,sx:{marginRight:2}}),h.toFixed(0),"% complete"]}):"Run Evaluation"})},b=n(3346),y=n(9235),_=n(4078),C=n(7339),k=n(5307),A=()=>{let{env:e,setEnv:t}=(0,j.o)(),[n,l]=(0,i.useState)(!1),[s,o]=(0,i.useState)(e),c=()=>{l(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{variant:"outlined",startIcon:(0,a.jsx)(k.Z,{}),onClick:()=>{l(!0)},children:"API keys"}),(0,a.jsxs)(d.Z,{open:n,onClose:c,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Provider settings"}),(0,a.jsxs)(u.Z,{children:[(0,a.jsxs)(b.Z,{defaultExpanded:!0,children:[(0,a.jsx)(_.Z,{children:"OpenAI"}),(0,a.jsxs)(y.Z,{children:[(0,a.jsx)(C.Z,{label:"OpenAI API key",fullWidth:!0,margin:"normal",value:s.OPENAI_API_KEY,onChange:e=>o({...s,OPENAI_API_KEY:e.target.value})}),(0,a.jsx)(C.Z,{label:"OpenAI API host",fullWidth:!0,margin:"normal",value:s.OPENAI_API_HOST,onChange:e=>o({...s,OPENAI_API_HOST:e.target.value})}),(0,a.jsx)(C.Z,{label:"OpenAI organization",fullWidth:!0,margin:"normal",value:s.OPENAI_ORGANIZATION,onChange:e=>o({...s,OPENAI_ORGANIZATION:e.target.value})})]})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Azure"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Azure API key",fullWidth:!0,margin:"normal",value:s.AZURE_OPENAI_API_KEY,onChange:e=>o({...s,AZURE_OPENAI_API_KEY:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Amazon Bedrock"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Bedrock Region",fullWidth:!0,margin:"normal",value:s.AWS_BEDROCK_REGION,onChange:e=>o({...s,AWS_BEDROCK_REGION:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Anthropic"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Anthropic API key",fullWidth:!0,margin:"normal",value:s.ANTHROPIC_API_KEY,onChange:e=>o({...s,ANTHROPIC_API_KEY:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Google Vertex AI"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex API Key",fullWidth:!0,margin:"normal",value:s.VERTEX_API_KEY,onChange:e=>o({...s,VERTEX_API_KEY:e.target.value})})}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex Project ID",fullWidth:!0,margin:"normal",value:s.VERTEX_PROJECT_ID,onChange:e=>o({...s,VERTEX_PROJECT_ID:e.target.value})})}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Vertex Region",fullWidth:!0,margin:"normal",value:s.VERTEX_REGION,onChange:e=>o({...s,VERTEX_REGION:e.target.value})})})]}),(0,a.jsxs)(b.Z,{children:[(0,a.jsx)(_.Z,{children:"Replicate"}),(0,a.jsx)(y.Z,{children:(0,a.jsx)(C.Z,{label:"Replicate API key",fullWidth:!0,margin:"normal",value:s.REPLICATE_API_KEY,onChange:e=>o({...s,REPLICATE_API_KEY:e.target.value})})})]})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:c,color:"primary",children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{t(s),c()},color:"primary",variant:"contained",children:"Save"})]})]})]})},E=n(7656),I=n(5068),O=n(417),P=n(1303),S=n(1451),T=n(21),w=n(5969),R=n(4931),W=n(5101),N=n(2185),z=n(5185),F=e=>{let{open:t,prompt:n,index:l,onAdd:s,onCancel:o}=e,[c,h]=i.useState(n),m=i.useRef(null);i.useEffect(()=>{h(n)},[n]);let f=e=>{s(c),h(""),e?o():m.current&&m.current.focus()};return(0,a.jsxs)(d.Z,{open:t,onClose:o,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:"Edit Prompt ".concat(l+1)}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(C.Z,{value:c,onChange:e=>h(e.target.value),fullWidth:!0,margin:"normal",multiline:!0,placeholder:"The quick brown {{animal1}} jumps over the lazy {{animal2}}.",helperText:"Tip: use the {{varname}} syntax to add variables to your prompt.",inputRef:m})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:f.bind(null,!0),color:"primary",variant:"contained",disabled:!c.length,children:"Add"}),(0,a.jsx)(r.Z,{onClick:f.bind(null,!1),color:"primary",variant:"contained",disabled:!c.length,children:"Add Another"}),(0,a.jsx)(r.Z,{onClick:o,color:"secondary",children:"Cancel"})]})]})};n(4499);var V=()=>{let[e,t]=(0,i.useState)(!1),[n,l]=(0,i.useState)(null),{prompts:o,setPrompts:d}=(0,j.o)(),p=(0,i.useRef)(null);(0,i.useEffect)(()=>{null!==n&&n>0&&p.current&&p.current.focus()},[n]);let u=e=>{l(e),t(!0)},h=(e,t)=>{e.stopPropagation();let n=o[t];d([...o,n])},x=(e,t)=>{d(o.map((n,a)=>a===e?t:n))},m=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to remove this prompt?")&&d(o.filter((e,n)=>n!==t))};return(0,a.jsxs)("div",{children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Prompts"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"file-input-add-prompt",children:(0,a.jsx)(w.Z,{title:"Upload prompt from file",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(E.Z,{component:"span",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)("input",{id:"file-input-add-prompt",type:"file",accept:".txt,.md",onChange:e=>{var t;e.stopPropagation(),e.preventDefault();let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){let e=new FileReader;e.onload=e=>{var t,n;let a=null===(n=e.target)||void 0===n?void 0:null===(t=n.result)||void 0===t?void 0:t.toString();a&&d([...o,a])},e.readAsText(n)}},style:{display:"none"}})]})})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>{t(!0)},variant:"contained",children:"Add Prompt"})]})]}),(0,a.jsx)(S.Z,{children:(0,a.jsx)(I.Z,{children:(0,a.jsx)(O.Z,{children:0===o.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(P.Z,{colSpan:2,align:"center",children:"No prompts added yet."})}):o.map((e,t)=>(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>u(t),children:[(0,a.jsx)(P.Z,{children:(0,a.jsxs)(s.Z,{variant:"body2",children:["Prompt #".concat(t+1,": "),(e.length>250?e.slice(0,250)+" ...":e).split(/({{\w+}})/g).map((e,t)=>/{{\s*(\w+)\s*}}/g.test(e)?(0,a.jsx)("span",{className:"prompt-var-highlight",children:e},t):e)]})}),(0,a.jsxs)(P.Z,{align:"right",sx:{minWidth:150},children:[(0,a.jsx)(E.Z,{onClick:()=>u(t),size:"small",children:(0,a.jsx)(R.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>h(e,t),size:"small",children:(0,a.jsx)(z.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>m(e,t),size:"small",children:(0,a.jsx)(W.Z,{})})]})]},t))})})}),(0,a.jsx)(F,{open:e,prompt:null!==n?o[n]:"",index:null!==n?n:0,onAdd:e=>{null!==n?x(n,e):d([...o,e]),l(null)},onCancel:()=>{l(null),t(!1)}})]})},L=n(6485),U=e=>{let{onAdd:t,varsList:n,initialValues:r}=e,[l,d]=i.useState(r||{});return(0,i.useEffect)(()=>{let e={};n.forEach(t=>{e[t]=(null==r?void 0:r[t])||""}),d(e)},[n,r]),(0,a.jsxs)(o.Z,{my:2,children:[(0,a.jsx)(s.Z,{variant:"h6",mb:2,children:"Vars"}),n.length>0?(0,a.jsx)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:Object.keys(l).map((e,n)=>(0,a.jsx)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:(0,a.jsx)(C.Z,{placeholder:e,label:e,value:l[e],fullWidth:!0,onChange:n=>{let a=n.target.value,i={...l,[e]:a};d(i),t(i)}})},n))}):(0,a.jsxs)(s.Z,{variant:"subtitle1",gutterBottom:!0,children:["Add variables to your prompt using the ","{{varname}}"," syntax."]})]})},B=n(8873);let K=["equals","contains","icontains","contains-all","contains-any","starts-with","regex","is-json","contains-json","similar","llm-rubric","model-graded-closedqa","factuality","webhook","rouge-n","rouge-s","rouge-l","not-equals","not-contains","not-icontains","not-contains-all","not-contains-any","not-starts-with","not-regex","not-is-json","not-contains-json","not-similar","not-webhook","not-rouge-n","not-rouge-s","not-rouge-l","is-valid-openai-function-call","is-valid-openai-tools-call","latency","perplexity","perplexity-score","cost","answer-relevance","context-faithfulness","context-recall","context-relevance","select-best","moderation"];var D=e=>{let{onAdd:t,initialValues:n}=e,[l,d]=(0,i.useState)(n||[]),p=e=>{let n=l.filter((t,n)=>n!==e);d(n),t(n)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.Z,{variant:"h6",children:"Asserts"}),(0,a.jsx)(o.Z,{my:l.length>0?2:0,children:(0,a.jsx)(c.Z,{direction:"column",spacing:2,children:l.map((e,n)=>(0,a.jsxs)(c.Z,{direction:"row",spacing:2,alignItems:"center",children:[(0,a.jsx)(B.Z,{value:e.type,options:K,sx:{minWidth:200},onChange:(e,a)=>{let i=l.map((e,t)=>t===n?{...e,type:a}:e);d(i),t(i)},renderInput:e=>(0,a.jsx)(C.Z,{...e,label:"Type"})}),(0,a.jsx)(C.Z,{label:"Value",value:e.value,fullWidth:!0,onChange:e=>{let a=e.target.value,i=l.map((e,t)=>t===n?{...e,value:a}:e);d(i),t(i)}}),(0,a.jsx)(E.Z,{onClick:()=>p(n),size:"small",children:(0,a.jsx)(W.Z,{})})]},n))})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>{let e=[...l,{type:"equals",value:""}];d(e),t(e)},children:"Add Assert"})]})},Y=e=>{let{open:t,onAdd:n,varsList:l,initialValues:s,onCancel:c}=e,[h,m]=(0,i.useState)((null==s?void 0:s.description)||""),[f,g]=(0,i.useState)((null==s?void 0:s.vars)||{}),[j,v]=(0,i.useState)((null==s?void 0:s.assert)||[]),[Z,b]=(0,i.useState)(0);i.useEffect(()=>{s?(m(s.description||""),g(s.vars||{}),v(s.assert||[])):(m(""),g({}),v([]))},[s]);let y=e=>{n({description:h,vars:f,assert:j},e),e&&c(),m(""),g({}),v([]),b(e=>e+1)};return(0,a.jsxs)(d.Z,{open:t,onClose:c,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(x.Z,{children:s?"Edit Test Case":"Add Test Case"}),(0,a.jsx)(u.Z,{children:(0,a.jsxs)(o.Z,{children:[(0,a.jsx)(U,{onAdd:e=>g(e),varsList:l,initialValues:null==s?void 0:s.vars}),(0,a.jsx)(D,{onAdd:e=>v(e),initialValues:((null==s?void 0:s.assert)||[]).filter(e=>"assert-set"!==e.type)||[]},Z)]})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:y.bind(void 0,!0),color:"primary",variant:"contained",children:s?"Update Test Case":"Add Test Case"}),!s&&(0,a.jsx)(r.Z,{onClick:y.bind(void 0,!1),color:"primary",variant:"contained",children:"Add Another"}),(0,a.jsx)(r.Z,{onClick:c,color:"secondary",children:"Cancel"})]})]})},q=n(5320),J=e=>{let{varsList:t}=e,{testCases:l,setTestCases:o}=(0,j.o)(),[d,p]=i.useState(null),[u,h]=i.useState(!1),x=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to delete this test case?")&&o(l.filter((e,n)=>n!==t))},m=(e,t)=>{e.stopPropagation();let n=JSON.parse(JSON.stringify(l[t]));o([...l,n])};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Test Cases"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"file-input-add-test-case",children:(0,a.jsx)(w.Z,{title:"Upload test cases from csv",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(E.Z,{component:"span",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)("input",{id:"file-input-add-test-case",type:"file",accept:".csv",onChange:e=>{var t;e.stopPropagation(),e.preventDefault();let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(a){let e=new FileReader;e.onload=async e=>{var t,a;let i=null===(a=e.target)||void 0===a?void 0:null===(t=a.result)||void 0===t?void 0:t.toString();if(i){let{parse:e}=await Promise.all([n.e(631),n.e(887)]).then(n.bind(n,3887)),t=e(i,{columns:!0});o([...l,...t.map(e=>(0,q.It)(e))])}},e.readAsText(a)}},style:{display:"none"}})]})})}),(0,a.jsx)(r.Z,{color:"primary",onClick:()=>h(!0),variant:"contained",children:"Add Test Case"})]})]}),(0,a.jsx)(S.Z,{children:(0,a.jsxs)(I.Z,{children:[(0,a.jsx)(L.Z,{children:(0,a.jsxs)(T.Z,{children:[(0,a.jsx)(P.Z,{children:"Description"}),(0,a.jsx)(P.Z,{children:"Assertions"}),(0,a.jsx)(P.Z,{children:"Variables"}),(0,a.jsx)(P.Z,{align:"right"})]})}),(0,a.jsx)(O.Z,{children:0===l.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(P.Z,{colSpan:4,align:"center",children:"No test cases added yet."})}):l.map((e,t)=>{var n;return(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>{p(t),h(!0)},children:[(0,a.jsx)(P.Z,{children:(0,a.jsx)(s.Z,{variant:"body2",children:e.description||"Test Case #".concat(t+1)})}),(0,a.jsxs)(P.Z,{children:[(null===(n=e.assert)||void 0===n?void 0:n.length)||0," assertions"]}),(0,a.jsx)(P.Z,{children:Object.entries(e.vars||{}).map(e=>{let[t,n]=e;return t+"="+n}).join(", ")}),(0,a.jsxs)(P.Z,{align:"right",sx:{minWidth:150},children:[(0,a.jsx)(E.Z,{onClick:()=>{p(t),h(!0)},size:"small",children:(0,a.jsx)(R.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>m(e,t),size:"small",children:(0,a.jsx)(z.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>x(e,t),size:"small",children:(0,a.jsx)(W.Z,{})})]})]},t)})})]})}),(0,a.jsx)(Y,{open:u,onAdd:(e,t)=>{if(null===d)o([...l,e]);else{let t=l.map((t,n)=>n===d?e:t);o(t),p(null)}t&&h(!1)},varsList:t,initialValues:null!==d?l[d]:void 0,onCancel:()=>{p(null),h(!1)}})]})},X=n(885),G=e=>{let{onChange:t,...n}=e,[r,l]=i.useState(""),[s,o]=i.useState(!1);return(0,a.jsx)(C.Z,{...n,error:s,helperText:s?"Invalid JSON":"",value:r,onChange:e=>{let n=e.target.value;try{let e=JSON.parse(n);l(n),o(!1),t&&t(e)}catch(e){l(n),o(!0)}}})},H=e=>{let{open:t,providerId:n,config:l,onClose:s,onSave:c}=e,[h,m]=i.useState(l);return i.useEffect(()=>{m(l)},[l]),(0,a.jsxs)(d.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"md",children:[(0,a.jsxs)(x.Z,{children:["Edit ",n.length>50?n.slice(0,50)+"...":n]}),(0,a.jsx)(u.Z,{children:Object.keys(h).map(e=>{let t;let n=h[e];return"number"==typeof n||"boolean"==typeof n||"string"==typeof n?(t="number"==typeof n?t=>m({...h,[e]:parseFloat(t.target.value)}):"boolean"==typeof n?t=>m({...h,[e]:"true"===t.target.value}):t=>{let n=t.target.value.trim();if(n.startsWith("{")||n.startsWith("["))try{m({...h,[e]:JSON.parse(n)})}catch(t){m({...h,[e]:n})}else"null"===n?m({...h,[e]:null}):"undefined"===n?m({...h,[e]:void 0}):m({...h,[e]:n})},(0,a.jsx)(o.Z,{my:2,children:(0,a.jsx)(C.Z,{label:e,value:n,onChange:t,fullWidth:!0,InputLabelProps:{shrink:!0},type:"number"==typeof n?"number":"text"})},e)):(0,a.jsx)(o.Z,{my:2,children:(0,a.jsx)(G,{label:e,defaultValue:JSON.stringify(n),onChange:t=>{m({...h,[e]:t})},fullWidth:!0,multiline:!0,minRows:2,InputLabelProps:{shrink:!0}})},e)})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:s,children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{c(h)},children:"Save"})]})]})};let M=[].concat(["replicate:replicate/flan-t5-small:69716ad8c34274043bf4a135b7315c7c569ec931d8f23d6826e249e1c142a264"].map(e=>({id:e,config:{temperature:.5,max_length:1024,repetition_penality:1}}))).concat(["replicate:replicate/codellama-7b-instruct:0103579e86fc75ba0d65912890fa19ef03c84a68554635319accf2e0ba93d3ae","replicate:replicate/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b","replicate:replicate/llama-2-70b-chat:2796ee9483c3fd7aa2e171d38f4ca12251a30609463dcfd4cd76703f22e96cdf"].map(e=>({id:e,config:{system_prompt:"",temperature:.75,top_p:.9,top_k:50,max_new_tokens:128,min_new_tokens:-1}}))).concat(["replicate:replicate/codellama-7b:6880b103613a9cd23950c5fd6c140197e519905bd0dd00e448c4858bdd06090a","replicate:replicate/codellama-13b-python:09b87c02dfa403e0c3289166dece62286b3bce49bae39a9c9204713cf94b8b7d","replicate:replicate/codellama-13b:1c914d844307b0588599b8393480a3ba917b660c7e9dfae681542b5325f228db","replicate:replicate/codellama-34b-python:9048743d22a7b19cd0abb018066809ea6af4f2b4717bef9aad3c5ae21ceac00d","replicate:replicate/codellama-34b:0666717e5ead8557dff55ee8f11924b5c0309f5f1ca52f64bb8eec405fdb38a7"].map(e=>({id:e,config:{temperature:.75,top_p:.9,top_k:50,max_new_tokens:128,min_new_tokens:-1}}))).concat(["replicate:a16z-infra/llama-2-7b-chat:7b0bfc9aff140d5b75bacbed23e91fd3c34b01a1e958d32132de6e0a19796e2c","replicate:a16z-infra/llama-2-13b-chat:2a7f981751ec7fdf87b5b91ad4db53683a98082e9ff7bfd12c8cd5ea85980a52"].map(e=>({id:e,config:{temperature:.95,top_p:.95,top_k:250,max_new_tokens:500,min_new_tokens:-1,repetition_penality:1,system_prompt:""}}))).concat(["replicate:mistralai/mistral-7b-v0.1","replicate:mistralai/mistral-7b-instruct-v0.2","replicate:mistralai/mixtral-8x7b-instruct-v0.1"].map(e=>({id:e,config:{temperature:.7,top_p:.9,top_k:-1,max_new_tokens:128,min_new_tokens:-1,repetition_penality:1.15,prompt_template:"{prompt}"}}))).concat(["anthropic:claude-1","anthropic:claude-1-100k","anthropic:claude-instant-1","anthropic:claude-instant-1-100k"].map(e=>({id:e,config:{max_tokens_to_sample:256,temperature:.5}}))).concat(["anthropic:messages:claude-instant-1.2","anthropic:messages:claude-2.0","anthropic:messages:claude-2.1","anthropic:messages:claude-3-haiku-20240307","anthropic:messages:claude-3-sonnet-20240229","anthropic:messages:claude-3-opus-20240229"].map(e=>({id:e,config:{max_tokens:1024,temperature:.5}}))).concat(["bedrock:anthropic.claude-instant-v1","bedrock:anthropic.claude-v1","bedrock:anthropic.claude-v2"].map(e=>({id:e,config:{max_tokens_to_sample:256,temperature:.5}}))).concat(["openai:gpt-3.5-turbo","openai:gpt-3.5-turbo-0301","openai:gpt-3.5-turbo-0613","openai:gpt-3.5-turbo-16k","openai:gpt-3.5-turbo-16k-0613","openai:gpt-4","openai:gpt-4-0314","openai:gpt-4-0613","openai:gpt-4-32k","openai:gpt-4-32k-0314"].map(e=>({id:e,config:{organization:"",temperature:.5,max_tokens:1024,top_p:1,frequency_penalty:0,presence_penalty:0,function_call:void 0,functions:void 0,stop:void 0}}))).concat(["azureopenai:gpt-3.5-turbo","azureopenai:gpt-3.5-turbo-0301","azureopenai:gpt-3.5-turbo-0613","azureopenai:gpt-3.5-turbo-16k","azureopenai:gpt-3.5-turbo-16k-0613","azureopenai:gpt-4","azureopenai:gpt-4-0314","azureopenai:gpt-4-0613","azureopenai:gpt-4-32k","azureopenai:gpt-4-32k-0314"].map(e=>({id:e,config:{temperature:.5,max_tokens:1024,top_p:1,frequency_penalty:0,presence_penalty:0,function_call:void 0,functions:void 0,stop:void 0}}))).concat(["vertex:chat-bison@001","vertex:chat-bison","vertex:chat-bison-32k","vertex:chat-bison-32k@001"].map(e=>({id:e,config:{context:void 0,examples:void 0,temperature:0,maxOutputTokens:1024,topP:.95,topK:40,safetySettings:void 0,stopSequence:void 0}}))).sort((e,t)=>e.id.localeCompare(t.id)),$={anthropic:"Anthropic",bedrock:"Amazon Web Services",azureopenai:"Azure",openai:"OpenAI",replicate:"Replicate"};var Q=e=>{let{providers:t,onChange:n}=e,[r,l]=i.useState(null),s=e=>"string"==typeof e?e:e.id||"Unknown provider",c=(e,t)=>"string"==typeof e?e:e.id||t,d=e=>{"string"==typeof e?alert("Cannot edit custom providers"):e.config?l(e):alert("There is no config for this provider")};return(0,a.jsxs)(o.Z,{mt:2,children:[(0,a.jsx)(B.Z,{multiple:!0,freeSolo:!0,options:M,value:t,groupBy:e=>(function(e){if(!e)return"Other";let t=e.split(":")[0];return $[t]||t})(e.id),onChange:(e,t)=>{n(t.map(e=>"string"==typeof e?{id:e}:e))},getOptionLabel:e=>{if(!e)return"";let t="";"string"==typeof e&&(t=e),e.id&&"string"==typeof e.id&&(t=e.id);let n=t.split(":");return n.length>1?n.length>2&&"anthropic"===n[0]?n[2]:n[1]:"Unknown provider"},renderTags:(e,t)=>e.map((e,n)=>{let a=s(e),r=c(e,n);return(0,i.createElement)(X.Z,{variant:"outlined",label:a,...t({index:n}),key:r,onClick:()=>d(e)})}),renderInput:e=>(0,a.jsx)(C.Z,{...e,variant:"outlined",placeholder:"Select LLM providers",helperText:t.length>0?"Click a provider to configure its settings.":null})}),r&&r.id&&(0,a.jsx)(H,{open:!!r,providerId:r.id,config:r.config,onClose:()=>l(null),onSave:e=>{if(r){let a=t.map(t=>t.id===r.id?{...t,config:e}:t);n(a),l(null)}}})]})},ee=n(1911),et=n.n(ee),en=n(9270);n(4492),n(3486);var ea=n(4235),ei=n(3522),er=n(8640),el=n.n(er);n(5096);var es=()=>{let{env:e,setEnv:t,description:n,setDescription:l,providers:c,setProviders:d,prompts:p,setPrompts:u,testCases:h,setTestCases:x,defaultTest:m,setDefaultTest:f,evaluateOptions:g,setEvaluateOptions:v}=(0,j.o)(),[Z,b]=i.useState(""),[y,_]=i.useState(!0);i.useEffect(()=>{b(ea.default.dump({env:e,description:n,providers:c,prompts:p,tests:h,defaultTest:m,evaluateOptions:g}))},[e,n,c,p,h,m,g]);let C=e=>{t(e.env||{}),l(e.description||""),d(e.providers||[]),u(e.prompts||[]),x(e.tests||[]),f(e.defaultTest||{}),v(e.evaluateOptions||{})};return(0,a.jsxs)(o.Z,{mt:4,children:[(0,a.jsx)(s.Z,{variant:"h5",gutterBottom:!0,children:"Configuration"}),(0,a.jsxs)(s.Z,{variant:"body1",gutterBottom:!0,children:["This is the YAML config that defines the evaluation and is processed by promptfoo. See"," ",(0,a.jsx)(el(),{target:"_blank",href:"https://promptfoo.dev/docs/configuration/guide",children:"configuration docs"})," ","to learn more."]}),(0,a.jsx)(r.Z,{variant:"text",color:"primary",startIcon:y?(0,a.jsx)(R.Z,{}):(0,a.jsx)(ei.Z,{}),onClick:()=>{if(!y)try{let e=ea.default.load(Z,{json:!0});C(e)}catch(e){}_(!y)},children:y?"Edit YAML":"Save"}),(0,a.jsx)(et(),{autoCapitalize:"off",value:Z,onValueChange:e=>{y||b(e)},highlight:e=>(0,en.highlight)(e,en.languages.yaml),padding:10,style:{fontFamily:'"Fira code", "Fira Mono", monospace',fontSize:14},disabled:y,className:y?"":"glowing-border"})]})};n(7517);var eo=n(7580);function ec(e){let{error:t,resetErrorBoundary:n}=e;return(0,a.jsxs)("div",{role:"alert",children:[(0,a.jsx)("p",{children:"Something went wrong:"}),(0,a.jsx)("pre",{children:t.message}),(0,a.jsx)("button",{onClick:n,children:"Try again"})]})}var ed=()=>{let[e,t]=(0,i.useState)(!1),{description:n,setDescription:f,providers:g,setProviders:v,prompts:b,setPrompts:y,testCases:_,setTestCases:C}=(0,j.o)();if((0,i.useEffect)(()=>{j.o.persist.rehydrate()},[]),eo.env.NEXT_PUBLIC_NO_BROWSING)return null;let k=(e=>{let t=/{{\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)})(b);return(0,a.jsxs)(l.Z,{maxWidth:"lg",sx:{marginTop:"2rem"},children:[(0,a.jsxs)(c.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h4",children:"Set up an evaluation"}),(0,a.jsxs)(c.Z,{direction:"row",spacing:2,children:[(0,a.jsx)(Z,{}),(0,a.jsx)(A,{}),(0,a.jsx)(r.Z,{variant:"outlined",color:"primary",onClick:()=>t(!0),children:"Reset"})]})]}),(0,a.jsx)(o.Z,{mt:4}),(0,a.jsx)(o.Z,{mt:2,children:(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{v([])},children:(0,a.jsxs)(c.Z,{direction:"column",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(s.Z,{variant:"h5",children:"Providers"}),(0,a.jsx)(Q,{providers:g,onChange:v})]})})}),(0,a.jsx)(o.Z,{mt:4}),(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{y([])},children:(0,a.jsx)(V,{})}),(0,a.jsx)(o.Z,{mt:6}),(0,a.jsx)(m.SV,{FallbackComponent:ec,onReset:()=>{C([])},children:(0,a.jsx)(J,{varsList:k})}),(0,a.jsx)(es,{}),(0,a.jsxs)(d.Z,{open:e,onClose:()=>t(!1),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,a.jsx)(x.Z,{id:"alert-dialog-title",children:"Confirm Reset"}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(h.Z,{id:"alert-dialog-description",children:"Are you sure you want to reset all the fields? This action cannot be undone."})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(r.Z,{onClick:()=>t(!1),children:"Cancel"}),(0,a.jsx)(r.Z,{onClick:()=>{f(""),v([]),y([]),C([]),t(!1)},autoFocus:!0,children:"Reset"})]})]})]})}},2428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return r},T8:function(){return i},eA:function(){return l}});var a=n(7580);let i=!a.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,r=!!a.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,l=""},7887:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var a=n(9685),i=n(4595);let r=(0,a.Ue)()((0,i.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},setEnv:t=>e({env:t}),setTestCases:t=>e({testCases:t}),setDescription:t=>e({description:t}),setProviders:t=>e({providers:t}),setPrompts:t=>e({prompts:t}),setDefaultTest:t=>e({defaultTest:t}),setEvaluateOptions:t=>e({evaluateOptions:t}),setStateFromConfig:t=>{let n={};t.description&&(n.description=t.description||""),t.tests&&(n.testCases=t.tests),t.providers&&(n.providers=t.providers),t.prompts&&("string"==typeof t.prompts?n.prompts=[t.prompts]:Array.isArray(t.prompts)?n.prompts=t.prompts.filter(e=>"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),e(n)},getTestSuite:()=>{let{description:e,testCases:n,providers:a,prompts:i,env:r}=t();return{env:r,description:e,providers:a,prompts:i,tests:n}}}),{name:"promptfoo",skipHydration:!0}))},4499:function(){},5096:function(){},7517:function(){},5320: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|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,[635,215,383,339,770,249,629,235,106,733,470,730,744],function(){return e(e.s=6178)}),_N_E=e.O()}]);
|