promptfoo 0.17.3 → 0.17.5

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 (50) hide show
  1. package/README.md +3 -2
  2. package/dist/package.json +2 -2
  3. package/dist/src/assertions.d.ts.map +1 -1
  4. package/dist/src/assertions.js +14 -2
  5. package/dist/src/assertions.js.map +1 -1
  6. package/dist/src/index.d.ts.map +1 -1
  7. package/dist/src/index.js +1 -0
  8. package/dist/src/index.js.map +1 -1
  9. package/dist/src/main.js +70 -39
  10. package/dist/src/main.js.map +1 -1
  11. package/dist/src/providers/anthropic.js.map +1 -1
  12. package/dist/src/providers/azureopenai.d.ts +34 -0
  13. package/dist/src/providers/azureopenai.d.ts.map +1 -0
  14. package/dist/src/providers/azureopenai.js +234 -0
  15. package/dist/src/providers/azureopenai.js.map +1 -0
  16. package/dist/src/providers/openai.d.ts.map +1 -1
  17. package/dist/src/providers/openai.js +23 -9
  18. package/dist/src/providers/openai.js.map +1 -1
  19. package/dist/src/providers.d.ts.map +1 -1
  20. package/dist/src/providers.js +16 -0
  21. package/dist/src/providers.js.map +1 -1
  22. package/dist/src/telemetry.d.ts +1 -0
  23. package/dist/src/telemetry.d.ts.map +1 -1
  24. package/dist/src/telemetry.js +7 -0
  25. package/dist/src/telemetry.js.map +1 -1
  26. package/dist/src/types.d.ts +2 -1
  27. package/dist/src/types.d.ts.map +1 -1
  28. package/dist/src/updates.d.ts.map +1 -1
  29. package/dist/src/updates.js +10 -1
  30. package/dist/src/updates.js.map +1 -1
  31. package/dist/src/util.d.ts +3 -0
  32. package/dist/src/util.d.ts.map +1 -1
  33. package/dist/src/util.js +40 -1
  34. package/dist/src/util.js.map +1 -1
  35. package/dist/src/web/client/assets/{index-58a0e3e3.js → index-c2756e5d.js} +1 -1
  36. package/dist/src/web/client/index.html +1 -1
  37. package/package.json +2 -2
  38. package/src/assertions.ts +18 -2
  39. package/src/index.ts +1 -0
  40. package/src/main.ts +88 -40
  41. package/src/providers/anthropic.ts +1 -1
  42. package/src/providers/azureopenai.ts +280 -0
  43. package/src/providers/openai.ts +27 -11
  44. package/src/providers.ts +19 -0
  45. package/src/telemetry.ts +14 -1
  46. package/src/types.ts +4 -0
  47. package/src/updates.ts +10 -1
  48. package/src/util.ts +40 -0
  49. package/src/web/client/package-lock.json +5726 -0
  50. package/src/web/client/src/ResultsView.tsx +12 -10
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,iGAA6D;AAC7D,4DAA+B;AAC/B,sDAA2B;AAC3B,wDAAgC;AAChC,+BAAgC;AAChC,+BAA0C;AAC1C,yCAAmD;AACnD,6CAA+C;AAE/C,sDAA8B;AAC9B,6CAAmD;AACnD,+BAAqC;AAcrC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACzB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAEM,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC9B,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AALD,0CAKC;AAEM,KAAK,UAAU,UAAU,CAAC,UAAkB;IACjD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC;IACvC,QAAQ,GAAG,EAAE;QACX,KAAK,OAAO;YACV,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC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CAAC;IAC5E,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/E,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/E,OAAO,UAAU,GAAG,CAAC,aAAa,GAAG,aAAa,CAAC,CAAC;AACtD,CAAC;AARD,4CAQC;AAED,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC9C,IAAI,GAAG,KAAK,YAAY,EAAE;YACxB,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBACvB,OAAO,CAAC,IAAI,CAAC,IAAA,gCAAmB,EAAC,KAAK,CAAC,CAAC,CAAC;aAC1C;SACF;aAAM;YACL,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACnB;KACF;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,OAAO;KAChB,CAAC;AACJ,CAAC;AAjBD,gDAiBC"}
@@ -196,4 +196,4 @@ Error generating stack: `+i.message+`
196
196
  *
197
197
  * This source code is licensed under the MIT license found in the
198
198
  * LICENSE file in the root directory of this source tree.
199
- */var ju=S,qO=KO;function YO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var XO=typeof Object.is=="function"?Object.is:YO,QO=qO.useSyncExternalStore,ZO=ju.useRef,JO=ju.useEffect,eI=ju.useMemo,tI=ju.useDebugValue;Y1.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=ZO(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=eI(function(){function a(m){if(!u){if(u=!0,c=m,m=r(m),o!==void 0&&s.hasValue){var y=s.value;if(o(y,m))return d=y}return d=m}if(y=d,XO(c,m))return y;var v=r(m);return o!==void 0&&o(y,v)?y:(c=m,d=v)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(t())},f===null?void 0:function(){return a(f())}]},[t,n,r,o]);var l=QO(e,i[0],i[1]);return JO(function(){s.hasValue=!0,s.value=l},[l]),tI(l),l};q1.exports=Y1;var nI=q1.exports;const rI=af(nI),{useSyncExternalStoreWithSelector:oI}=rI;function iI(e,t=e.getState,n){const r=oI(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return S.useDebugValue(r),r}const Fg=e=>{({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?NO(e):e,n=(r,o)=>iI(t,r,o);return Object.assign(n,t),n},sI=e=>e?Fg(e):Fg;var lI=e=>(({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&console.warn("[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand'`."),sI(e));const Bu=lI(e=>({table:null,setTable:t=>e(()=>({table:t})),config:null,setConfig:t=>e(()=>({config:t}))}));function aI(e){return pe("MuiDialog",e)}const uI=fe("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),Dc=uI,cI=S.createContext({}),Z1=cI,dI=["aria-describedby","aria-labelledby","BackdropComponent","BackdropProps","children","className","disableEscapeKeyDown","fullScreen","fullWidth","maxWidth","onBackdropClick","onClose","open","PaperComponent","PaperProps","scroll","TransitionComponent","transitionDuration","TransitionProps"],fI=H($1,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),pI=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:i}=e,s={root:["root"],container:["container",`scroll${Y(n)}`],paper:["paper",`paperScroll${Y(n)}`,`paperWidth${Y(String(r))}`,o&&"paperFullWidth",i&&"paperFullScreen"]};return me(s,aI,t)},hI=H(E1,{name:"MuiDialog",slot:"Root",overridesResolver:(e,t)=>t.root})({"@media print":{position:"absolute !important"}}),mI=H("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${Y(n.scroll)}`]]}})(({ownerState:e})=>b({height:"100%","@media print":{height:"auto"},outline:0},e.scroll==="paper"&&{display:"flex",justifyContent:"center",alignItems:"center"},e.scroll==="body"&&{overflowY:"auto",overflowX:"hidden",textAlign:"center","&:after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}})),gI=H(Du,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${Y(n.scroll)}`],t[`paperWidth${Y(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(({theme:e,ownerState:t})=>b({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"}},t.scroll==="paper"&&{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"},t.scroll==="body"&&{display:"inline-block",verticalAlign:"middle",textAlign:"left"},!t.maxWidth&&{maxWidth:"calc(100% - 64px)"},t.maxWidth==="xs"&&{maxWidth:e.breakpoints.unit==="px"?Math.max(e.breakpoints.values.xs,444):`${e.breakpoints.values.xs}${e.breakpoints.unit}`,[`&.${Dc.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.maxWidth&&t.maxWidth!=="xs"&&{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`,[`&.${Dc.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t.maxWidth]+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.fullWidth&&{width:"calc(100% - 64px)"},t.fullScreen&&{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${Dc.paperScrollBody}`]:{margin:0,maxWidth:"100%"}})),vI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialog"}),o=ai(),i={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{"aria-describedby":s,"aria-labelledby":l,BackdropComponent:a,BackdropProps:u,children:c,className:d,disableEscapeKeyDown:f=!1,fullScreen:m=!1,fullWidth:y=!1,maxWidth:v="sm",onBackdropClick:k,onClose:g,open:p,PaperComponent:h=Du,PaperProps:x={},scroll:C="paper",TransitionComponent:R=R1,transitionDuration:$=i,TransitionProps:E}=r,M=X(r,dI),P=b({},r,{disableEscapeKeyDown:f,fullScreen:m,fullWidth:y,maxWidth:v,scroll:C}),I=pI(P),B=S.useRef(),A=z=>{B.current=z.target===z.currentTarget},_=z=>{B.current&&(B.current=null,k&&k(z),g&&g(z,"backdropClick"))},O=Wa(l),N=S.useMemo(()=>({titleId:O}),[O]);return w.jsx(hI,b({className:J(I.root,d),closeAfterTransition:!0,components:{Backdrop:fI},componentsProps:{backdrop:b({transitionDuration:$,as:a},u)},disableEscapeKeyDown:f,onClose:g,open:p,ref:n,onClick:_,ownerState:P},M,{children:w.jsx(R,b({appear:!0,in:p,timeout:$,role:"presentation"},E,{children:w.jsx(mI,{className:J(I.container),onMouseDown:A,ownerState:P,children:w.jsx(gI,b({as:h,elevation:24,role:"dialog","aria-describedby":s,"aria-labelledby":O},x,{className:J(I.paper,x.className),ownerState:P,children:w.jsx(Z1.Provider,{value:N,children:c})}))})}))}))}),Gp=vI;function yI(e){return pe("MuiDialogActions",e)}fe("MuiDialogActions",["root","spacing"]);const xI=["className","disableSpacing"],SI=e=>{const{classes:t,disableSpacing:n}=e;return me({root:["root",!n&&"spacing"]},yI,t)},bI=H("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})(({ownerState:e})=>b({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!e.disableSpacing&&{"& > :not(:first-of-type)":{marginLeft:8}})),wI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialogActions"}),{className:o,disableSpacing:i=!1}=r,s=X(r,xI),l=b({},r,{disableSpacing:i}),a=SI(l);return w.jsx(bI,b({className:J(a.root,o),ownerState:l,ref:n},s))}),Kp=wI;function CI(e){return pe("MuiDialogContent",e)}fe("MuiDialogContent",["root","dividers"]);function kI(e){return pe("MuiDialogTitle",e)}const RI=fe("MuiDialogTitle",["root"]),$I=RI,EI=["className","dividers"],PI=e=>{const{classes:t,dividers:n}=e;return me({root:["root",n&&"dividers"]},CI,t)},_I=H("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(({theme:e,ownerState:t})=>b({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px"},t.dividers?{padding:"16px 24px",borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}:{[`.${$I.root} + &`]:{paddingTop:0}})),TI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialogContent"}),{className:o,dividers:i=!1}=r,s=X(r,EI),l=b({},r,{dividers:i}),a=PI(l);return w.jsx(_I,b({className:J(a.root,o),ownerState:l,ref:n},s))}),Ra=TI,MI=["className","id"],OI=e=>{const{classes:t}=e;return me({root:["root"]},kI,t)},II=H(yn,{name:"MuiDialogTitle",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:"16px 24px",flex:"0 0 auto"}),AI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialogTitle"}),{className:o,id:i}=r,s=X(r,MI),l=r,a=OI(l),{titleId:u=i}=S.useContext(Z1);return w.jsx(II,b({component:"h2",className:J(a.root,o),ownerState:l,ref:n,variant:"h6",id:i??u},s))}),$a=AI;function FI(e){return pe("MuiIconButton",e)}const LI=fe("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge"]),NI=LI,zI=["edge","children","className","color","disabled","disableFocusRipple","size"],DI=e=>{const{classes:t,disabled:n,color:r,edge:o,size:i}=e,s={root:["root",n&&"disabled",r!=="default"&&`color${Y(r)}`,o&&`edge${Y(o)}`,`size${Y(i)}`]};return me(s,FI,t)},jI=H(Cu,{name:"MuiIconButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Y(n.color)}`],n.edge&&t[`edge${Y(n.edge)}`],t[`size${Y(n.size)}`]]}})(({theme:e,ownerState:t})=>b({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",overflow:"visible",color:(e.vars||e).palette.action.active,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest})},!t.disableRipple&&{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:ft(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},t.edge==="start"&&{marginLeft:t.size==="small"?-3:-12},t.edge==="end"&&{marginRight:t.size==="small"?-3:-12}),({theme:e,ownerState:t})=>{var n;const r=(n=(e.vars||e).palette)==null?void 0:n[t.color];return b({},t.color==="inherit"&&{color:"inherit"},t.color!=="inherit"&&t.color!=="default"&&b({color:r==null?void 0:r.main},!t.disableRipple&&{"&:hover":b({},r&&{backgroundColor:e.vars?`rgba(${r.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:ft(r.main,e.palette.action.hoverOpacity)},{"@media (hover: none)":{backgroundColor:"transparent"}})}),t.size==="small"&&{padding:5,fontSize:e.typography.pxToRem(18)},t.size==="large"&&{padding:12,fontSize:e.typography.pxToRem(28)},{[`&.${NI.disabled}`]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled}})}),BI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiIconButton"}),{edge:o=!1,children:i,className:s,color:l="default",disabled:a=!1,disableFocusRipple:u=!1,size:c="medium"}=r,d=X(r,zI),f=b({},r,{edge:o,color:l,disabled:a,disableFocusRipple:u,size:c}),m=DI(f);return w.jsx(jI,b({className:J(m.root,s),centerRipple:!0,focusRipple:!u,disabled:a,ref:n,ownerState:f},d,{children:i}))}),qp=BI;var Yp={},VI=oo;Object.defineProperty(Yp,"__esModule",{value:!0});var J1=Yp.default=void 0,HI=VI(io()),WI=w,UI=(0,HI.default)((0,WI.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"}),"ContentCopy");J1=Yp.default=UI;var Xp={},GI=oo;Object.defineProperty(Xp,"__esModule",{value:!0});var Qp=Xp.default=void 0,KI=GI(io()),qI=w,YI=(0,KI.default)((0,qI.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check");Qp=Xp.default=YI;function ex({open:e,onClose:t,prompt:n,output:r}){const[o,i]=S.useState(!1);S.useEffect(()=>{i(!1)},[n]);const s=async l=>{await navigator.clipboard.writeText(l),i(!0)};return w.jsxs(Gp,{open:e,onClose:t,fullWidth:!0,maxWidth:"lg",children:[w.jsx($a,{children:"Prompt"}),w.jsxs(Ra,{children:[w.jsx(Kd,{readOnly:!0,value:n,style:{width:"100%"}}),w.jsx(qp,{onClick:()=>s(n),style:{position:"absolute",right:"10px",top:"10px"},children:o?w.jsx(Qp,{}):w.jsx(J1,{})})]}),r&&w.jsxs(w.Fragment,{children:[w.jsx($a,{children:"Output"}),w.jsx(Ra,{children:w.jsx(Kd,{readOnly:!0,value:r,style:{width:"100%"}})})]}),w.jsx(Kp,{children:w.jsx(Ps,{onClick:t,children:"Close"})})]})}function XI(e){if(typeof e=="string"){const t=e.startsWith("[PASS]");let n=e;return(e.startsWith("[PASS]")||e.startsWith("[FAIL]"))&&(n=n.slice(6)),{text:n,pass:t,score:t?1:0}}return e}function Lg(e){return e===0||e===1?"":`(${e.toFixed(2)})`}function Zp({text:e,maxLength:t}){const[n,r]=S.useState(!0);let o=typeof e=="string"?e:JSON.stringify(e);o=o.replace(/\n/g,"<br>");const i=()=>{r(!n)};return(()=>o.length<=t?w.jsx("span",{dangerouslySetInnerHTML:{__html:o}}):n?w.jsxs("span",{style:{cursor:"pointer"},onClick:i,children:[w.jsx("span",{dangerouslySetInnerHTML:{__html:o.substring(0,t)}})," ..."]}):w.jsx("span",{style:{cursor:"pointer"},onClick:i,children:w.jsx("span",{dangerouslySetInnerHTML:{__html:o}})}))()}function QI({output:e,maxTextLength:t,rowIndex:n,promptIndex:r,onRating:o}){const[i,s]=S.useState(!1),l=()=>{s(!0)},a=()=>{s(!1)};let u=typeof e.text=="string"?e.text:JSON.stringify(e.text),c=[];!e.pass&&u.includes("---")&&(c=u.split("---"),u=c.slice(1).join("---"));const d=f=>{o(n,r,f)};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"cell",children:[e.pass&&w.jsxs("div",{className:"status pass",children:["PASS ",w.jsx("span",{className:"score",children:Lg(e.score)})]}),!e.pass&&w.jsxs("div",{className:"status fail",children:["[FAIL",w.jsx("span",{className:"score",children:Lg(e.score)}),"] ",c[0]]})," ",w.jsx(Zp,{text:u,maxLength:t})]}),w.jsxs("div",{className:"cell-actions",children:[e.prompt&&w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"action",onClick:l,children:"🔎"}),w.jsx(ex,{open:i,onClose:a,prompt:e.prompt,output:u})]}),w.jsx("span",{className:"action",onClick:()=>d(!0),children:"👍"}),w.jsx("span",{className:"action",onClick:()=>d(!1),children:"👎"})]})]})}function Ng({text:e,maxLength:t,smallText:n,expandedText:r}){const[o,i]=S.useState(!1),s=()=>{i(!0)},l=()=>{i(!1)};return w.jsxs("div",{children:[w.jsx(Zp,{text:e,maxLength:t}),r&&w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"action",onClick:s,children:"🔎"}),w.jsx(ex,{open:o,onClose:l,prompt:r})]}),w.jsx("div",{className:"smalltext",children:n})]})}function ZI({maxTextLength:e,columnVisibility:t,wordBreak:n,filterMode:r,failureFilter:o,onFailureFilterToggle:i}){const{table:s,setTable:l}=Bu();e1(s,"Table should be defined");const{head:a,body:u}=s,c=a.prompts.map((p,h)=>u.reduce((x,C)=>x+(C.outputs[h].pass?1:0),0)),d=(p,h,x)=>{const C=[...u],R={...C[p]},$=[...R.outputs];$[h].pass=x,$[h].score=x?1:0,R.outputs=$,C[p]=R,l({head:a,body:C})},f=c.reduce((p,h,x,C)=>h>C[p]?x:p,0),m=c[f],y=MO(),v=[y.group({id:"vars",header:()=>w.jsx("span",{children:"Variables"}),columns:a.vars.map((p,h)=>y.accessor(x=>x.vars[h],{id:`Variable ${h+1}`,header:()=>w.jsx(Ng,{smallText:`Variable ${h+1}`,text:p,maxLength:e}),cell:x=>w.jsx(Zp,{text:x.getValue(),maxLength:e}),size:50}))}),y.group({id:"prompts",header:()=>w.jsx("span",{children:"Outputs"}),columns:a.prompts.map((p,h)=>y.accessor(x=>XI(x.outputs[h]),{id:`Prompt ${h+1}`,header:()=>{const x=(c[h]/u.length*100).toFixed(2),C=c[h]===m&&m!==0,R=`Prompt ${h+1}`,$=o[R]||!1;return w.jsxs(w.Fragment,{children:[w.jsx(Ng,{smallText:`Prompt ${h+1}`,text:typeof p=="string"?p:p.display,expandedText:typeof p=="string"?void 0:p.raw,maxLength:e}),r==="failures"&&w.jsx(x1,{sx:{"& .MuiFormControlLabel-label":{fontSize:"0.75rem"}},control:w.jsx(Qd,{checked:$,onChange:E=>i(R,E.target.checked)}),label:"Show failures"}),w.jsxs("div",{className:`summary ${C?"highlight":""}`,children:["Passing: ",w.jsxs("strong",{children:[x,"%"]})," (",c[h]," / ",u.length,")"]})]})},cell:x=>w.jsx(QI,{output:x.getValue(),maxTextLength:e,rowIndex:x.row.index,promptIndex:h,onRating:d})}))})],k=S.useMemo(()=>r==="failures"?Object.values(o).every(p=>!p)?u:u.filter(p=>p.outputs.some((h,x)=>{const C=`Prompt ${x+1}`,R=!h.pass;return o[C]&&R})):u,[u,o,r]),g=LO({data:k,columns:v,columnResizeMode:"onChange",getCoreRowModel:OO(),state:{columnVisibility:t}});return w.jsxs("table",{style:{wordBreak:n},children:[w.jsx("thead",{children:g.getHeaderGroups().map(p=>w.jsx("tr",{className:"header",children:p.headers.map(h=>w.jsxs("th",{key:h.id,colSpan:h.colSpan,style:{width:h.getSize()},children:[h.isPlaceholder?null:Ig(h.column.columnDef.header,h.getContext()),w.jsx("div",{onMouseDown:h.getResizeHandler(),onTouchStart:h.getResizeHandler(),className:`resizer ${h.column.getIsResizing()?"isResizing":""}`})]}))},p.id))}),w.jsx("tbody",{children:g.getRowModel().rows.map((p,h)=>{let x=!1;return w.jsx("tr",{children:p.getVisibleCells().map(C=>{const R=C.column.id.startsWith("Variable"),$=!R&&!x;$&&(x=!0);const E=h===0&&!R;return w.jsx("td",{key:C.id,style:{width:C.column.getSize()},className:`${R?"variable":""} ${E?"first-prompt-row":""} ${$?"first-prompt-col":""}`,children:Ig(C.column.columnDef.cell,C.getContext())})})},p.id)})})]})}const JI="modulepreload",eA=function(e){return"/"+e},zg={},tA=function(t,n,r){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(i=>{if(i=eA(i),i in zg)return;zg[i]=!0;const s=i.endsWith(".css"),l=s?'[rel="stylesheet"]':"";if(!!r)for(let c=o.length-1;c>=0;c--){const d=o[c];if(d.href===i&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${l}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":JI,s||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),s)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())};function nA(e){return pe("MuiDialogContentText",e)}fe("MuiDialogContentText",["root"]);const rA=["children","className"],oA=e=>{const{classes:t}=e,r=me({root:["root"]},nA,t);return b({},t,r)},iA=H(yn,{shouldForwardProp:e=>an(e)||e==="classes",name:"MuiDialogContentText",slot:"Root",overridesResolver:(e,t)=>t.root})({}),sA=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialogContentText"}),{className:o}=r,i=X(r,rA),s=oA(i);return w.jsx(iA,b({component:"p",variant:"body1",color:"text.secondary",ref:n,ownerState:i,className:J(s.root,o)},r,{classes:s}))}),lA=sA;function aA(e){return pe("MuiFormHelperText",e)}const uA=fe("MuiFormHelperText",["root","error","disabled","sizeSmall","sizeMedium","contained","focused","filled","required"]),Dg=uA;var jg;const cA=["children","className","component","disabled","error","filled","focused","margin","required","variant"],dA=e=>{const{classes:t,contained:n,size:r,disabled:o,error:i,filled:s,focused:l,required:a}=e,u={root:["root",o&&"disabled",i&&"error",r&&`size${Y(r)}`,n&&"contained",l&&"focused",s&&"filled",a&&"required"]};return me(u,aA,t)},fA=H("p",{name:"MuiFormHelperText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.size&&t[`size${Y(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(({theme:e,ownerState:t})=>b({color:(e.vars||e).palette.text.secondary},e.typography.caption,{textAlign:"left",marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${Dg.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Dg.error}`]:{color:(e.vars||e).palette.error.main}},t.size==="small"&&{marginTop:4},t.contained&&{marginLeft:14,marginRight:14})),pA=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiFormHelperText"}),{children:o,className:i,component:s="p"}=r,l=X(r,cA),a=_r(),u=ro({props:r,muiFormControl:a,states:["variant","size","disabled","error","filled","focused","required"]}),c=b({},r,{component:s,contained:u.variant==="filled"||u.variant==="outlined",variant:u.variant,size:u.size,disabled:u.disabled,error:u.error,filled:u.filled,focused:u.focused,required:u.required}),d=dA(c);return w.jsx(fA,b({as:s,ownerState:c,className:J(d.root,i),ref:n},l,{children:o===" "?jg||(jg=w.jsx("span",{className:"notranslate",children:"​"})):o}))}),hA=pA;function mA(e){return pe("MuiTextField",e)}fe("MuiTextField",["root"]);const gA=["autoComplete","autoFocus","children","className","color","defaultValue","disabled","error","FormHelperTextProps","fullWidth","helperText","id","InputLabelProps","inputProps","InputProps","inputRef","label","maxRows","minRows","multiline","name","onBlur","onChange","onClick","onFocus","placeholder","required","rows","select","SelectProps","type","value","variant"],vA={standard:M1,filled:I1,outlined:Lp},yA=e=>{const{classes:t}=e;return me({root:["root"]},mA,t)},xA=H(Zd,{name:"MuiTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({}),SA=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiTextField"}),{autoComplete:o,autoFocus:i=!1,children:s,className:l,color:a="primary",defaultValue:u,disabled:c=!1,error:d=!1,FormHelperTextProps:f,fullWidth:m=!1,helperText:y,id:v,InputLabelProps:k,inputProps:g,InputProps:p,inputRef:h,label:x,maxRows:C,minRows:R,multiline:$=!1,name:E,onBlur:M,onChange:P,onClick:I,onFocus:B,placeholder:A,required:_=!1,rows:O,select:N=!1,SelectProps:z,type:T,value:L,variant:F="outlined"}=r,q=X(r,gA),G=b({},r,{autoFocus:i,color:a,disabled:c,error:d,fullWidth:m,multiline:$,required:_,select:N,variant:F}),oe=yA(G),te={};F==="outlined"&&(k&&typeof k.shrink<"u"&&(te.notched=k.shrink),te.label=x),N&&((!z||!z.native)&&(te.id=void 0),te["aria-describedby"]=void 0);const Q=Wa(v),se=y&&Q?`${Q}-helper-text`:void 0,Ce=x&&Q?`${Q}-label`:void 0,Se=vA[F],ae=w.jsx(Se,b({"aria-describedby":se,autoComplete:o,autoFocus:i,defaultValue:u,fullWidth:m,multiline:$,name:E,rows:O,maxRows:C,minRows:R,type:T,value:L,id:Q,inputRef:h,onBlur:M,onChange:P,onFocus:B,onClick:I,placeholder:A,inputProps:g},te,p));return w.jsxs(xA,b({className:J(oe.root,l),disabled:c,error:d,fullWidth:m,ref:n,required:_,color:a,variant:F,ownerState:G},q,{children:[x!=null&&x!==""&&w.jsx(Jd,b({htmlFor:Q,id:Ce},k,{children:x})),N?w.jsx(nf,b({"aria-describedby":se,id:Q,labelId:Ce,value:L,input:ae},z,{children:s})):ae,y&&w.jsx(hA,b({id:se},f,{children:y}))]}))}),bA=SA,wA=no(w.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),CA=no(w.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");function kA({open:e,onClose:t}){const{config:n}=Bu(),r=wt.useRef(null),[o,i]=wt.useState(!1),[s,l]=wt.useState("");wt.useEffect(()=>{e&&(async()=>{const{default:c}=await tA(()=>import("./js-yaml-8bbf9398.js"),[]);l(c.dump(n))})()},[e,n]);const a=()=>{r.current&&(r.current.select(),document.execCommand("copy"),i(!0))},u=()=>{i(!1),t()};return w.jsxs(Gp,{open:e,onClose:u,"aria-labelledby":"config-dialog-title",maxWidth:"md",fullWidth:!0,children:[w.jsx($a,{id:"config-dialog-title",children:w.jsxs(Vn,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[w.jsx(yn,{variant:"h6",children:"Config"}),w.jsx(qp,{onClick:a,children:o?w.jsx(wA,{}):w.jsx(CA,{})})]})}),w.jsx(Ra,{children:w.jsx(yn,{variant:"body1",component:"div",children:w.jsx("textarea",{ref:r,readOnly:!0,value:s,style:{width:"100%",minHeight:"400px",fontFamily:"monospace",border:"1px solid #ccc"}})})}),w.jsx(Kp,{children:w.jsx(Ps,{onClick:u,color:"primary",children:"Close"})})]})}var Jp={},RA=oo;Object.defineProperty(Jp,"__esModule",{value:!0});var tx=Jp.default=void 0,$A=RA(io()),EA=w,PA=(0,$A.default)((0,EA.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");tx=Jp.default=PA;const _A=({open:e,onClose:t,shareUrl:n})=>{const r=S.useRef(null),[o,i]=S.useState(!1),s=()=>{r.current&&(r.current.select(),document.execCommand("copy"),i(!0))},l=()=>{t(),i(!1)};return w.jsxs(Gp,{open:e,onClose:l,PaperProps:{style:{minWidth:"min(660px, 100%)"}},children:[w.jsx($a,{children:"Your eval is ready to share"}),w.jsxs(Ra,{children:[w.jsx(bA,{inputRef:r,value:n,fullWidth:!0,InputProps:{readOnly:!0,endAdornment:w.jsx(qp,{onClick:s,children:o?w.jsx(Qp,{}):w.jsx(tx,{})})}}),w.jsx(lA,{sx:{fontSize:"0.75rem"},children:"Shared URLs are deleted after 1 week."})]}),w.jsx(Kp,{children:w.jsx(Ps,{onClick:l,color:"primary",children:"Close"})})]})},Bg=Ty(EM)(({theme:e})=>({maxWidth:"100%",flexWrap:"wrap",[e.breakpoints.down("sm")]:{flexDirection:"column"}}));function TA(){const{table:e,config:t}=Bu(),[n,r]=S.useState(250),[o,i]=S.useState({}),[s,l]=S.useState([]),[a,u]=S.useState({}),c=(A,_)=>{u(O=>({...O,[A]:_}))},[d,f]=S.useState("all"),m=A=>{const _=A.target.value;f(_);const O={};P.prompts.forEach((N,z)=>{const T=`Prompt ${z+1}`;O[T]=_==="failures"}),u(O)},[y,v]=S.useState("break-all"),k=A=>{v(A.target.checked?"break-all":"break-word")},[g,p]=S.useState(!1),[h,x]=S.useState(""),[C,R]=S.useState(!1),$=async()=>{R(!0);try{const A=await fetch("https://api.promptfoo.dev/eval",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:{version:1,results:{table:e},config:t}})}),{id:_}=await A.json(),O=`https://app.promptfoo.dev/eval/${_}`;x(O),p(!0)}catch{alert("Sorry, something went wrong.")}finally{R(!1)}},[E,M]=S.useState(!1);e1(e,"Table data must be loaded before rendering ResultsView");const{head:P}=e,I=A=>{const{target:{value:_}}=A;l(typeof _=="string"?_.split(","):_);const O=[...P.vars.map((z,T)=>`Variable ${T+1}`),...P.prompts.map((z,T)=>`Prompt ${T+1}`)],N={};O.forEach(z=>{N[z]=(typeof _=="string"?_.split(","):_).includes(z)}),i(N)},B=[...P.vars.map((A,_)=>({value:`Variable ${_+1}`,label:`Variable ${_+1}`,group:"Variables"})),...P.prompts.map((A,_)=>({value:`Prompt ${_+1}`,label:`Prompt ${_+1}`,group:"Prompts"}))];return S.useEffect(()=>{l([...P.vars.map((A,_)=>`Variable ${_+1}`),...P.prompts.map((A,_)=>`Prompt ${_+1}`)])},[P]),w.jsxs("div",{children:[w.jsx(Vn,{py:"md",children:w.jsxs(Bg,{direction:"row",spacing:8,alignItems:"center",children:[w.jsx(Vn,{children:w.jsxs(Zd,{sx:{m:1,minWidth:200},size:"small",children:[w.jsx(Jd,{id:"visible-columns-label",children:"Visible columns"}),w.jsx(nf,{labelId:"visible-columns-label",id:"visible-columns",multiple:!0,value:s,onChange:I,input:w.jsx(Lp,{label:"Visible columns"}),renderValue:A=>A.join(", "),children:B.map(A=>w.jsxs(Rc,{dense:!0,value:A.value,children:[w.jsx(Qd,{checked:s.indexOf(A.value)>-1}),w.jsx(r_,{primary:A.label})]},A.value))})]})}),w.jsx(Vn,{children:w.jsxs(Zd,{sx:{minWidth:180},size:"small",children:[w.jsx(Jd,{id:"failure-filter-mode-label",children:"Filter"}),w.jsxs(nf,{labelId:"filter-mode-label",id:"filter-mode",value:d,onChange:m,label:"Filter",children:[w.jsx(Rc,{value:"all",children:"Show all results"}),w.jsx(Rc,{value:"failures",children:"Show only failures"})]})]})}),w.jsxs(Vn,{children:[w.jsxs(yn,{mt:2,children:["Max text length: ",n]}),w.jsx(RM,{min:25,max:1e3,value:n,onChange:(A,_)=>r(_)})]}),w.jsx(Vn,{children:w.jsx(Tc,{title:"Forcing line breaks makes it easier to adjust column widths to your liking",children:w.jsx(x1,{control:w.jsx(Qd,{checked:y==="break-all",onChange:k}),label:"Force line breaks"})})}),w.jsx(Vn,{flexGrow:1}),w.jsx(Vn,{display:"flex",justifyContent:"flex-end",children:w.jsxs(Bg,{direction:"row",spacing:2,children:[t&&w.jsx(Tc,{title:"View config",children:w.jsx(Ps,{color:"primary",onClick:()=>M(!0),startIcon:w.jsx(z1,{}),children:"Config"})}),w.jsx(Tc,{title:"Generate a unique URL that others can access",children:w.jsx(Ps,{color:"primary",onClick:$,disabled:C,startIcon:C?w.jsx(g2,{size:16}):w.jsx(N1,{}),children:"Share"})})]})})]})}),w.jsx(ZI,{maxTextLength:n,columnVisibility:o,wordBreak:y,filterMode:d,failureFilter:a,onFailureFilterToggle:c}),w.jsx(kA,{open:E,onClose:()=>M(!1)}),w.jsx(_A,{open:g,onClose:()=>p(!1),shareUrl:h})]})}function MA(){return w.jsxs(Vn,{className:"logo",children:[w.jsx("img",{src:"/logo.svg",alt:"Promptfoo logo"})," ",w.jsx("span",{children:"promptfoo"})]})}var eh={},OA=oo;Object.defineProperty(eh,"__esModule",{value:!0});var nx=eh.default=void 0,IA=OA(io()),AA=w,FA=(0,IA.default)((0,AA.jsx)("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"}),"DarkMode");nx=eh.default=FA;var th={},LA=oo;Object.defineProperty(th,"__esModule",{value:!0});var rx=th.default=void 0,NA=LA(io()),zA=w,DA=(0,NA.default)((0,zA.jsx)("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"}),"LightMode");rx=th.default=DA;function jA({darkMode:e,onToggleDarkMode:t}){return w.jsxs("nav",{children:[w.jsx(MA,{}),w.jsx("div",{className:"dark-mode-toggle",onClick:t,children:e?w.jsx(nx,{}):w.jsx(rx,{})})]})}function BA(){const{table:e,setTable:t,setConfig:n}=Bu(),[r,o]=S.useState(!1),i=S.useRef(!1),s=Rk("(prefers-color-scheme: dark)"),[l,a]=S.useState(s),u=S.useMemo(()=>bp({palette:{mode:l?"dark":"light"}}),[l]),c=()=>{a(!l),l?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme","dark")};return S.useEffect(()=>{const d=async y=>{var g;if(i.current)return;i.current=!0;const k=await(await fetch(`https://api.promptfoo.dev/eval/${y}`)).json();t(((g=k.data.results)==null?void 0:g.table)||k.data.table),n(k.data.config),o(!0)},f=Bl("http://localhost:15500"),m=window.location.pathname.match(/\/eval\/([\w:-]+)/);if(m){const y=m[1];d(y)}else f.on("init",y=>{console.log("Initialized socket connection",y),o(!0),t(y.results.table),n(y.config)}),f.on("update",y=>{console.log("Received data update",y),t(y.results.table),n(y.config)});return()=>{f.disconnect()}},[t,n]),w.jsxs(uR,{theme:u,children:[w.jsx(jA,{darkMode:l,onToggleDarkMode:c}),r&&e?w.jsx(TA,{}):w.jsx("div",{children:"Loading..."})]})}jc.createRoot(document.getElementById("root")).render(w.jsx(wt.StrictMode,{children:w.jsx(BA,{})}));
199
+ */var ju=S,qO=KO;function YO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var XO=typeof Object.is=="function"?Object.is:YO,QO=qO.useSyncExternalStore,ZO=ju.useRef,JO=ju.useEffect,eI=ju.useMemo,tI=ju.useDebugValue;Y1.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=ZO(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=eI(function(){function a(m){if(!u){if(u=!0,c=m,m=r(m),o!==void 0&&s.hasValue){var y=s.value;if(o(y,m))return d=y}return d=m}if(y=d,XO(c,m))return y;var v=r(m);return o!==void 0&&o(y,v)?y:(c=m,d=v)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(t())},f===null?void 0:function(){return a(f())}]},[t,n,r,o]);var l=QO(e,i[0],i[1]);return JO(function(){s.hasValue=!0,s.value=l},[l]),tI(l),l};q1.exports=Y1;var nI=q1.exports;const rI=af(nI),{useSyncExternalStoreWithSelector:oI}=rI;function iI(e,t=e.getState,n){const r=oI(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return S.useDebugValue(r),r}const Fg=e=>{({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?NO(e):e,n=(r,o)=>iI(t,r,o);return Object.assign(n,t),n},sI=e=>e?Fg(e):Fg;var lI=e=>(({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&console.warn("[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand'`."),sI(e));const Bu=lI(e=>({table:null,setTable:t=>e(()=>({table:t})),config:null,setConfig:t=>e(()=>({config:t}))}));function aI(e){return pe("MuiDialog",e)}const uI=fe("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),Dc=uI,cI=S.createContext({}),Z1=cI,dI=["aria-describedby","aria-labelledby","BackdropComponent","BackdropProps","children","className","disableEscapeKeyDown","fullScreen","fullWidth","maxWidth","onBackdropClick","onClose","open","PaperComponent","PaperProps","scroll","TransitionComponent","transitionDuration","TransitionProps"],fI=H($1,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),pI=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:i}=e,s={root:["root"],container:["container",`scroll${Y(n)}`],paper:["paper",`paperScroll${Y(n)}`,`paperWidth${Y(String(r))}`,o&&"paperFullWidth",i&&"paperFullScreen"]};return me(s,aI,t)},hI=H(E1,{name:"MuiDialog",slot:"Root",overridesResolver:(e,t)=>t.root})({"@media print":{position:"absolute !important"}}),mI=H("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${Y(n.scroll)}`]]}})(({ownerState:e})=>b({height:"100%","@media print":{height:"auto"},outline:0},e.scroll==="paper"&&{display:"flex",justifyContent:"center",alignItems:"center"},e.scroll==="body"&&{overflowY:"auto",overflowX:"hidden",textAlign:"center","&:after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}})),gI=H(Du,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${Y(n.scroll)}`],t[`paperWidth${Y(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(({theme:e,ownerState:t})=>b({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"}},t.scroll==="paper"&&{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"},t.scroll==="body"&&{display:"inline-block",verticalAlign:"middle",textAlign:"left"},!t.maxWidth&&{maxWidth:"calc(100% - 64px)"},t.maxWidth==="xs"&&{maxWidth:e.breakpoints.unit==="px"?Math.max(e.breakpoints.values.xs,444):`${e.breakpoints.values.xs}${e.breakpoints.unit}`,[`&.${Dc.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.maxWidth&&t.maxWidth!=="xs"&&{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`,[`&.${Dc.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t.maxWidth]+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.fullWidth&&{width:"calc(100% - 64px)"},t.fullScreen&&{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${Dc.paperScrollBody}`]:{margin:0,maxWidth:"100%"}})),vI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialog"}),o=ai(),i={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{"aria-describedby":s,"aria-labelledby":l,BackdropComponent:a,BackdropProps:u,children:c,className:d,disableEscapeKeyDown:f=!1,fullScreen:m=!1,fullWidth:y=!1,maxWidth:v="sm",onBackdropClick:k,onClose:g,open:p,PaperComponent:h=Du,PaperProps:x={},scroll:C="paper",TransitionComponent:R=R1,transitionDuration:$=i,TransitionProps:E}=r,M=X(r,dI),P=b({},r,{disableEscapeKeyDown:f,fullScreen:m,fullWidth:y,maxWidth:v,scroll:C}),I=pI(P),B=S.useRef(),A=z=>{B.current=z.target===z.currentTarget},_=z=>{B.current&&(B.current=null,k&&k(z),g&&g(z,"backdropClick"))},O=Wa(l),N=S.useMemo(()=>({titleId:O}),[O]);return w.jsx(hI,b({className:J(I.root,d),closeAfterTransition:!0,components:{Backdrop:fI},componentsProps:{backdrop:b({transitionDuration:$,as:a},u)},disableEscapeKeyDown:f,onClose:g,open:p,ref:n,onClick:_,ownerState:P},M,{children:w.jsx(R,b({appear:!0,in:p,timeout:$,role:"presentation"},E,{children:w.jsx(mI,{className:J(I.container),onMouseDown:A,ownerState:P,children:w.jsx(gI,b({as:h,elevation:24,role:"dialog","aria-describedby":s,"aria-labelledby":O},x,{className:J(I.paper,x.className),ownerState:P,children:w.jsx(Z1.Provider,{value:N,children:c})}))})}))}))}),Gp=vI;function yI(e){return pe("MuiDialogActions",e)}fe("MuiDialogActions",["root","spacing"]);const xI=["className","disableSpacing"],SI=e=>{const{classes:t,disableSpacing:n}=e;return me({root:["root",!n&&"spacing"]},yI,t)},bI=H("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})(({ownerState:e})=>b({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!e.disableSpacing&&{"& > :not(:first-of-type)":{marginLeft:8}})),wI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialogActions"}),{className:o,disableSpacing:i=!1}=r,s=X(r,xI),l=b({},r,{disableSpacing:i}),a=SI(l);return w.jsx(bI,b({className:J(a.root,o),ownerState:l,ref:n},s))}),Kp=wI;function CI(e){return pe("MuiDialogContent",e)}fe("MuiDialogContent",["root","dividers"]);function kI(e){return pe("MuiDialogTitle",e)}const RI=fe("MuiDialogTitle",["root"]),$I=RI,EI=["className","dividers"],PI=e=>{const{classes:t,dividers:n}=e;return me({root:["root",n&&"dividers"]},CI,t)},_I=H("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(({theme:e,ownerState:t})=>b({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px"},t.dividers?{padding:"16px 24px",borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}:{[`.${$I.root} + &`]:{paddingTop:0}})),TI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialogContent"}),{className:o,dividers:i=!1}=r,s=X(r,EI),l=b({},r,{dividers:i}),a=PI(l);return w.jsx(_I,b({className:J(a.root,o),ownerState:l,ref:n},s))}),Ra=TI,MI=["className","id"],OI=e=>{const{classes:t}=e;return me({root:["root"]},kI,t)},II=H(yn,{name:"MuiDialogTitle",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:"16px 24px",flex:"0 0 auto"}),AI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialogTitle"}),{className:o,id:i}=r,s=X(r,MI),l=r,a=OI(l),{titleId:u=i}=S.useContext(Z1);return w.jsx(II,b({component:"h2",className:J(a.root,o),ownerState:l,ref:n,variant:"h6",id:i??u},s))}),$a=AI;function FI(e){return pe("MuiIconButton",e)}const LI=fe("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge"]),NI=LI,zI=["edge","children","className","color","disabled","disableFocusRipple","size"],DI=e=>{const{classes:t,disabled:n,color:r,edge:o,size:i}=e,s={root:["root",n&&"disabled",r!=="default"&&`color${Y(r)}`,o&&`edge${Y(o)}`,`size${Y(i)}`]};return me(s,FI,t)},jI=H(Cu,{name:"MuiIconButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Y(n.color)}`],n.edge&&t[`edge${Y(n.edge)}`],t[`size${Y(n.size)}`]]}})(({theme:e,ownerState:t})=>b({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",overflow:"visible",color:(e.vars||e).palette.action.active,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest})},!t.disableRipple&&{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:ft(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},t.edge==="start"&&{marginLeft:t.size==="small"?-3:-12},t.edge==="end"&&{marginRight:t.size==="small"?-3:-12}),({theme:e,ownerState:t})=>{var n;const r=(n=(e.vars||e).palette)==null?void 0:n[t.color];return b({},t.color==="inherit"&&{color:"inherit"},t.color!=="inherit"&&t.color!=="default"&&b({color:r==null?void 0:r.main},!t.disableRipple&&{"&:hover":b({},r&&{backgroundColor:e.vars?`rgba(${r.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:ft(r.main,e.palette.action.hoverOpacity)},{"@media (hover: none)":{backgroundColor:"transparent"}})}),t.size==="small"&&{padding:5,fontSize:e.typography.pxToRem(18)},t.size==="large"&&{padding:12,fontSize:e.typography.pxToRem(28)},{[`&.${NI.disabled}`]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled}})}),BI=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiIconButton"}),{edge:o=!1,children:i,className:s,color:l="default",disabled:a=!1,disableFocusRipple:u=!1,size:c="medium"}=r,d=X(r,zI),f=b({},r,{edge:o,color:l,disabled:a,disableFocusRipple:u,size:c}),m=DI(f);return w.jsx(jI,b({className:J(m.root,s),centerRipple:!0,focusRipple:!u,disabled:a,ref:n,ownerState:f},d,{children:i}))}),qp=BI;var Yp={},VI=oo;Object.defineProperty(Yp,"__esModule",{value:!0});var J1=Yp.default=void 0,HI=VI(io()),WI=w,UI=(0,HI.default)((0,WI.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"}),"ContentCopy");J1=Yp.default=UI;var Xp={},GI=oo;Object.defineProperty(Xp,"__esModule",{value:!0});var Qp=Xp.default=void 0,KI=GI(io()),qI=w,YI=(0,KI.default)((0,qI.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check");Qp=Xp.default=YI;function ex({open:e,onClose:t,prompt:n,output:r}){const[o,i]=S.useState(!1);S.useEffect(()=>{i(!1)},[n]);const s=async l=>{await navigator.clipboard.writeText(l),i(!0)};return w.jsxs(Gp,{open:e,onClose:t,fullWidth:!0,maxWidth:"lg",children:[w.jsx($a,{children:"Prompt"}),w.jsxs(Ra,{children:[w.jsx(Kd,{readOnly:!0,value:n,style:{width:"100%"}}),w.jsx(qp,{onClick:()=>s(n),style:{position:"absolute",right:"10px",top:"10px"},children:o?w.jsx(Qp,{}):w.jsx(J1,{})})]}),r&&w.jsxs(w.Fragment,{children:[w.jsx($a,{children:"Output"}),w.jsx(Ra,{children:w.jsx(Kd,{readOnly:!0,value:r,style:{width:"100%"}})})]}),w.jsx(Kp,{children:w.jsx(Ps,{onClick:t,children:"Close"})})]})}function XI(e){if(typeof e=="string"){const t=e.startsWith("[PASS]");let n=e;return(e.startsWith("[PASS]")||e.startsWith("[FAIL]"))&&(n=n.slice(6)),{text:n,pass:t,score:t?1:0}}return e}function Lg(e){return e===0||e===1?"":`(${e.toFixed(2)})`}function Zp({text:e,maxLength:t}){const[n,r]=S.useState(!0);let o=typeof e=="string"?e:JSON.stringify(e);o=o.replace(/\n/g,"<br>");const i=()=>{r(!n)};return(()=>o.length<=t?w.jsx("span",{dangerouslySetInnerHTML:{__html:o}}):n?w.jsxs("span",{style:{cursor:"pointer"},onClick:i,children:[w.jsx("span",{dangerouslySetInnerHTML:{__html:o.substring(0,t)}})," ..."]}):w.jsx("span",{style:{cursor:"pointer"},onClick:i,children:w.jsx("span",{dangerouslySetInnerHTML:{__html:o}})}))()}function QI({output:e,maxTextLength:t,rowIndex:n,promptIndex:r,onRating:o}){const[i,s]=S.useState(!1),l=()=>{s(!0)},a=()=>{s(!1)};let u=typeof e.text=="string"?e.text:JSON.stringify(e.text),c=[];!e.pass&&u.includes("---")&&(c=u.split("---"),u=c.slice(1).join("---"));const d=f=>{o(n,r,f)};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"cell",children:[e.pass&&w.jsxs("div",{className:"status pass",children:["PASS ",w.jsx("span",{className:"score",children:Lg(e.score)})]}),!e.pass&&w.jsxs("div",{className:"status fail",children:["[FAIL",w.jsx("span",{className:"score",children:Lg(e.score)}),"] ",c[0]]})," ",w.jsx(Zp,{text:u,maxLength:t})]}),w.jsxs("div",{className:"cell-actions",children:[e.prompt&&w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"action",onClick:l,children:"🔎"}),w.jsx(ex,{open:i,onClose:a,prompt:e.prompt,output:u})]}),w.jsx("span",{className:"action",onClick:()=>d(!0),children:"👍"}),w.jsx("span",{className:"action",onClick:()=>d(!1),children:"👎"})]})]})}function Ng({text:e,maxLength:t,smallText:n,expandedText:r}){const[o,i]=S.useState(!1),s=()=>{i(!0)},l=()=>{i(!1)};return w.jsxs("div",{children:[w.jsx(Zp,{text:e,maxLength:t}),r&&w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"action",onClick:s,children:"🔎"}),w.jsx(ex,{open:o,onClose:l,prompt:r})]}),w.jsx("div",{className:"smalltext",children:n})]})}function ZI({maxTextLength:e,columnVisibility:t,wordBreak:n,filterMode:r,failureFilter:o,onFailureFilterToggle:i}){const{table:s,setTable:l}=Bu();e1(s,"Table should be defined");const{head:a,body:u}=s,c=a.prompts.map((p,h)=>u.reduce((x,C)=>x+(C.outputs[h].pass?1:0),0)),d=(p,h,x)=>{const C=[...u],R={...C[p]},$=[...R.outputs];$[h].pass=x,$[h].score=x?1:0,R.outputs=$,C[p]=R,l({head:a,body:C})},f=c.reduce((p,h,x,C)=>h>C[p]?x:p,0),m=c[f],y=MO(),v=[y.group({id:"vars",header:()=>w.jsx("span",{children:"Variables"}),columns:a.vars.map((p,h)=>y.accessor(x=>x.vars[h],{id:`Variable ${h+1}`,header:()=>w.jsx(Ng,{smallText:`Variable ${h+1}`,text:p,maxLength:e}),cell:x=>w.jsx(Zp,{text:x.getValue(),maxLength:e}),size:50}))}),y.group({id:"prompts",header:()=>w.jsx("span",{children:"Outputs"}),columns:a.prompts.map((p,h)=>y.accessor(x=>XI(x.outputs[h]),{id:`Prompt ${h+1}`,header:()=>{const x=(c[h]/u.length*100).toFixed(2),C=c[h]===m&&m!==0,R=`Prompt ${h+1}`,$=o[R]||!1;return w.jsxs(w.Fragment,{children:[w.jsx(Ng,{smallText:`Prompt ${h+1}`,text:typeof p=="string"?p:p.display,expandedText:typeof p=="string"?void 0:p.raw,maxLength:e}),r==="failures"&&w.jsx(x1,{sx:{"& .MuiFormControlLabel-label":{fontSize:"0.75rem"}},control:w.jsx(Qd,{checked:$,onChange:E=>i(R,E.target.checked)}),label:"Show failures"}),w.jsxs("div",{className:`summary ${C?"highlight":""}`,children:["Passing: ",w.jsxs("strong",{children:[x,"%"]})," (",c[h]," / ",u.length,")"]})]})},cell:x=>w.jsx(QI,{output:x.getValue(),maxTextLength:e,rowIndex:x.row.index,promptIndex:h,onRating:d})}))})],k=S.useMemo(()=>r==="failures"?Object.values(o).every(p=>!p)?u:u.filter(p=>p.outputs.some((h,x)=>{const C=`Prompt ${x+1}`,R=!h.pass;return o[C]&&R})):u,[u,o,r]),g=LO({data:k,columns:v,columnResizeMode:"onChange",getCoreRowModel:OO(),state:{columnVisibility:t}});return w.jsxs("table",{style:{wordBreak:n},children:[w.jsx("thead",{children:g.getHeaderGroups().map(p=>w.jsx("tr",{className:"header",children:p.headers.map(h=>w.jsxs("th",{key:h.id,colSpan:h.colSpan,style:{width:h.getSize()},children:[h.isPlaceholder?null:Ig(h.column.columnDef.header,h.getContext()),w.jsx("div",{onMouseDown:h.getResizeHandler(),onTouchStart:h.getResizeHandler(),className:`resizer ${h.column.getIsResizing()?"isResizing":""}`})]}))},p.id))}),w.jsx("tbody",{children:g.getRowModel().rows.map((p,h)=>{let x=!1;return w.jsx("tr",{children:p.getVisibleCells().map(C=>{const R=C.column.id.startsWith("Variable"),$=!R&&!x;$&&(x=!0);const E=h===0&&!R;return w.jsx("td",{key:C.id,style:{width:C.column.getSize()},className:`${R?"variable":""} ${E?"first-prompt-row":""} ${$?"first-prompt-col":""}`,children:Ig(C.column.columnDef.cell,C.getContext())})})},p.id)})})]})}const JI="modulepreload",eA=function(e){return"/"+e},zg={},tA=function(t,n,r){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(i=>{if(i=eA(i),i in zg)return;zg[i]=!0;const s=i.endsWith(".css"),l=s?'[rel="stylesheet"]':"";if(!!r)for(let c=o.length-1;c>=0;c--){const d=o[c];if(d.href===i&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${l}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":JI,s||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),s)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())};function nA(e){return pe("MuiDialogContentText",e)}fe("MuiDialogContentText",["root"]);const rA=["children","className"],oA=e=>{const{classes:t}=e,r=me({root:["root"]},nA,t);return b({},t,r)},iA=H(yn,{shouldForwardProp:e=>an(e)||e==="classes",name:"MuiDialogContentText",slot:"Root",overridesResolver:(e,t)=>t.root})({}),sA=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiDialogContentText"}),{className:o}=r,i=X(r,rA),s=oA(i);return w.jsx(iA,b({component:"p",variant:"body1",color:"text.secondary",ref:n,ownerState:i,className:J(s.root,o)},r,{classes:s}))}),lA=sA;function aA(e){return pe("MuiFormHelperText",e)}const uA=fe("MuiFormHelperText",["root","error","disabled","sizeSmall","sizeMedium","contained","focused","filled","required"]),Dg=uA;var jg;const cA=["children","className","component","disabled","error","filled","focused","margin","required","variant"],dA=e=>{const{classes:t,contained:n,size:r,disabled:o,error:i,filled:s,focused:l,required:a}=e,u={root:["root",o&&"disabled",i&&"error",r&&`size${Y(r)}`,n&&"contained",l&&"focused",s&&"filled",a&&"required"]};return me(u,aA,t)},fA=H("p",{name:"MuiFormHelperText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.size&&t[`size${Y(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(({theme:e,ownerState:t})=>b({color:(e.vars||e).palette.text.secondary},e.typography.caption,{textAlign:"left",marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${Dg.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Dg.error}`]:{color:(e.vars||e).palette.error.main}},t.size==="small"&&{marginTop:4},t.contained&&{marginLeft:14,marginRight:14})),pA=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiFormHelperText"}),{children:o,className:i,component:s="p"}=r,l=X(r,cA),a=_r(),u=ro({props:r,muiFormControl:a,states:["variant","size","disabled","error","filled","focused","required"]}),c=b({},r,{component:s,contained:u.variant==="filled"||u.variant==="outlined",variant:u.variant,size:u.size,disabled:u.disabled,error:u.error,filled:u.filled,focused:u.focused,required:u.required}),d=dA(c);return w.jsx(fA,b({as:s,ownerState:c,className:J(d.root,i),ref:n},l,{children:o===" "?jg||(jg=w.jsx("span",{className:"notranslate",children:"​"})):o}))}),hA=pA;function mA(e){return pe("MuiTextField",e)}fe("MuiTextField",["root"]);const gA=["autoComplete","autoFocus","children","className","color","defaultValue","disabled","error","FormHelperTextProps","fullWidth","helperText","id","InputLabelProps","inputProps","InputProps","inputRef","label","maxRows","minRows","multiline","name","onBlur","onChange","onClick","onFocus","placeholder","required","rows","select","SelectProps","type","value","variant"],vA={standard:M1,filled:I1,outlined:Lp},yA=e=>{const{classes:t}=e;return me({root:["root"]},mA,t)},xA=H(Zd,{name:"MuiTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({}),SA=S.forwardRef(function(t,n){const r=xe({props:t,name:"MuiTextField"}),{autoComplete:o,autoFocus:i=!1,children:s,className:l,color:a="primary",defaultValue:u,disabled:c=!1,error:d=!1,FormHelperTextProps:f,fullWidth:m=!1,helperText:y,id:v,InputLabelProps:k,inputProps:g,InputProps:p,inputRef:h,label:x,maxRows:C,minRows:R,multiline:$=!1,name:E,onBlur:M,onChange:P,onClick:I,onFocus:B,placeholder:A,required:_=!1,rows:O,select:N=!1,SelectProps:z,type:T,value:L,variant:F="outlined"}=r,q=X(r,gA),G=b({},r,{autoFocus:i,color:a,disabled:c,error:d,fullWidth:m,multiline:$,required:_,select:N,variant:F}),oe=yA(G),te={};F==="outlined"&&(k&&typeof k.shrink<"u"&&(te.notched=k.shrink),te.label=x),N&&((!z||!z.native)&&(te.id=void 0),te["aria-describedby"]=void 0);const Q=Wa(v),se=y&&Q?`${Q}-helper-text`:void 0,Ce=x&&Q?`${Q}-label`:void 0,Se=vA[F],ae=w.jsx(Se,b({"aria-describedby":se,autoComplete:o,autoFocus:i,defaultValue:u,fullWidth:m,multiline:$,name:E,rows:O,maxRows:C,minRows:R,type:T,value:L,id:Q,inputRef:h,onBlur:M,onChange:P,onFocus:B,onClick:I,placeholder:A,inputProps:g},te,p));return w.jsxs(xA,b({className:J(oe.root,l),disabled:c,error:d,fullWidth:m,ref:n,required:_,color:a,variant:F,ownerState:G},q,{children:[x!=null&&x!==""&&w.jsx(Jd,b({htmlFor:Q,id:Ce},k,{children:x})),N?w.jsx(nf,b({"aria-describedby":se,id:Q,labelId:Ce,value:L,input:ae},z,{children:s})):ae,y&&w.jsx(hA,b({id:se},f,{children:y}))]}))}),bA=SA,wA=no(w.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),CA=no(w.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");function kA({open:e,onClose:t}){const{config:n}=Bu(),r=wt.useRef(null),[o,i]=wt.useState(!1),[s,l]=wt.useState("");wt.useEffect(()=>{e&&(async()=>{const{default:c}=await tA(()=>import("./js-yaml-8bbf9398.js"),[]);l(c.dump(n))})()},[e,n]);const a=()=>{r.current&&(r.current.select(),document.execCommand("copy"),i(!0))},u=()=>{i(!1),t()};return w.jsxs(Gp,{open:e,onClose:u,"aria-labelledby":"config-dialog-title",maxWidth:"md",fullWidth:!0,children:[w.jsx($a,{id:"config-dialog-title",children:w.jsxs(Vn,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[w.jsx(yn,{variant:"h6",children:"Config"}),w.jsx(qp,{onClick:a,children:o?w.jsx(wA,{}):w.jsx(CA,{})})]})}),w.jsx(Ra,{children:w.jsx(yn,{variant:"body1",component:"div",children:w.jsx("textarea",{ref:r,readOnly:!0,value:s,style:{width:"100%",minHeight:"400px",fontFamily:"monospace",border:"1px solid #ccc"}})})}),w.jsx(Kp,{children:w.jsx(Ps,{onClick:u,color:"primary",children:"Close"})})]})}var Jp={},RA=oo;Object.defineProperty(Jp,"__esModule",{value:!0});var tx=Jp.default=void 0,$A=RA(io()),EA=w,PA=(0,$A.default)((0,EA.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");tx=Jp.default=PA;const _A=({open:e,onClose:t,shareUrl:n})=>{const r=S.useRef(null),[o,i]=S.useState(!1),s=()=>{r.current&&(r.current.select(),document.execCommand("copy"),i(!0))},l=()=>{t(),i(!1)};return w.jsxs(Gp,{open:e,onClose:l,PaperProps:{style:{minWidth:"min(660px, 100%)"}},children:[w.jsx($a,{children:"Your eval is ready to share"}),w.jsxs(Ra,{children:[w.jsx(bA,{inputRef:r,value:n,fullWidth:!0,InputProps:{readOnly:!0,endAdornment:w.jsx(qp,{onClick:s,children:o?w.jsx(Qp,{}):w.jsx(tx,{})})}}),w.jsx(lA,{sx:{fontSize:"0.75rem"},children:"Shared URLs are deleted after 1 week."})]}),w.jsx(Kp,{children:w.jsx(Ps,{onClick:l,color:"primary",children:"Close"})})]})},Bg=Ty(EM)(({theme:e})=>({maxWidth:"100%",flexWrap:"wrap",[e.breakpoints.down("sm")]:{flexDirection:"column"}}));function TA(){const{table:e,config:t}=Bu(),[n,r]=S.useState(250),[o,i]=S.useState({}),[s,l]=S.useState([]),[a,u]=S.useState({}),c=(A,_)=>{u(O=>({...O,[A]:_}))},[d,f]=S.useState("all"),m=A=>{const _=A.target.value;f(_);const O={};P.prompts.forEach((N,z)=>{const T=`Prompt ${z+1}`;O[T]=_==="failures"}),u(O)},[y,v]=S.useState("break-all"),k=A=>{v(A.target.checked?"break-all":"break-word")},[g,p]=S.useState(!1),[h,x]=S.useState(""),[C,R]=S.useState(!1),$=async()=>{R(!0);try{const A=await fetch("https://api.promptfoo.dev/eval",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:{version:1,results:{table:e},config:t}})}),{id:_}=await A.json(),O=`https://app.promptfoo.dev/eval/${_}`;x(O),p(!0)}catch{alert("Sorry, something went wrong.")}finally{R(!1)}},[E,M]=S.useState(!1);e1(e,"Table data must be loaded before rendering ResultsView");const{head:P}=e,I=A=>{const{target:{value:_}}=A;l(typeof _=="string"?_.split(","):_);const O=[...P.vars.map((z,T)=>`Variable ${T+1}`),...P.prompts.map((z,T)=>`Prompt ${T+1}`)],N={};O.forEach(z=>{N[z]=(typeof _=="string"?_.split(","):_).includes(z)}),i(N)},B=[...P.vars.map((A,_)=>({value:`Variable ${_+1}`,label:`Variable ${_+1}`,group:"Variables"})),...P.prompts.map((A,_)=>({value:`Prompt ${_+1}`,label:`Prompt ${_+1}`,group:"Prompts"}))];return S.useEffect(()=>{l([...P.vars.map((A,_)=>`Variable ${_+1}`),...P.prompts.map((A,_)=>`Prompt ${_+1}`)])},[P]),w.jsxs("div",{children:[w.jsx(Vn,{py:"md",children:w.jsxs(Bg,{direction:"row",spacing:8,alignItems:"center",children:[w.jsx(Vn,{children:w.jsxs(Zd,{sx:{m:1,minWidth:200},size:"small",children:[w.jsx(Jd,{id:"visible-columns-label",children:"Visible columns"}),w.jsx(nf,{labelId:"visible-columns-label",id:"visible-columns",multiple:!0,value:s,onChange:I,input:w.jsx(Lp,{label:"Visible columns"}),renderValue:A=>A.join(", "),children:B.map(A=>w.jsxs(Rc,{dense:!0,value:A.value,children:[w.jsx(Qd,{checked:s.indexOf(A.value)>-1}),w.jsx(r_,{primary:A.label})]},A.value))})]})}),w.jsx(Vn,{children:w.jsxs(Zd,{sx:{minWidth:180},size:"small",children:[w.jsx(Jd,{id:"failure-filter-mode-label",children:"Filter"}),w.jsxs(nf,{labelId:"filter-mode-label",id:"filter-mode",value:d,onChange:m,label:"Filter",children:[w.jsx(Rc,{value:"all",children:"Show all results"}),w.jsx(Rc,{value:"failures",children:"Show only failures"})]})]})}),w.jsxs(Vn,{children:[w.jsxs(yn,{mt:2,children:["Max text length: ",n]}),w.jsx(RM,{min:25,max:1e3,value:n,onChange:(A,_)=>r(_)})]}),w.jsx(Vn,{children:w.jsx(Tc,{title:"Forcing line breaks makes it easier to adjust column widths to your liking",children:w.jsx(x1,{control:w.jsx(Qd,{checked:y==="break-all",onChange:k}),label:"Force line breaks"})})}),w.jsx(Vn,{flexGrow:1}),w.jsx(Vn,{display:"flex",justifyContent:"flex-end",children:w.jsxs(Bg,{direction:"row",spacing:2,children:[t&&w.jsx(Tc,{title:"View config",children:w.jsx(Ps,{color:"primary",onClick:()=>M(!0),startIcon:w.jsx(z1,{}),children:"Config"})}),(t==null?void 0:t.sharing)&&w.jsx(Tc,{title:"Generate a unique URL that others can access",children:w.jsx(Ps,{color:"primary",onClick:$,disabled:C,startIcon:C?w.jsx(g2,{size:16}):w.jsx(N1,{}),children:"Share"})})]})})]})}),w.jsx(ZI,{maxTextLength:n,columnVisibility:o,wordBreak:y,filterMode:d,failureFilter:a,onFailureFilterToggle:c}),w.jsx(kA,{open:E,onClose:()=>M(!1)}),w.jsx(_A,{open:g,onClose:()=>p(!1),shareUrl:h})]})}function MA(){return w.jsxs(Vn,{className:"logo",children:[w.jsx("img",{src:"/logo.svg",alt:"Promptfoo logo"})," ",w.jsx("span",{children:"promptfoo"})]})}var eh={},OA=oo;Object.defineProperty(eh,"__esModule",{value:!0});var nx=eh.default=void 0,IA=OA(io()),AA=w,FA=(0,IA.default)((0,AA.jsx)("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"}),"DarkMode");nx=eh.default=FA;var th={},LA=oo;Object.defineProperty(th,"__esModule",{value:!0});var rx=th.default=void 0,NA=LA(io()),zA=w,DA=(0,NA.default)((0,zA.jsx)("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"}),"LightMode");rx=th.default=DA;function jA({darkMode:e,onToggleDarkMode:t}){return w.jsxs("nav",{children:[w.jsx(MA,{}),w.jsx("div",{className:"dark-mode-toggle",onClick:t,children:e?w.jsx(nx,{}):w.jsx(rx,{})})]})}function BA(){const{table:e,setTable:t,setConfig:n}=Bu(),[r,o]=S.useState(!1),i=S.useRef(!1),s=Rk("(prefers-color-scheme: dark)"),[l,a]=S.useState(s),u=S.useMemo(()=>bp({palette:{mode:l?"dark":"light"}}),[l]),c=()=>{a(!l),l?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme","dark")};return S.useEffect(()=>{const d=async y=>{var g;if(i.current)return;i.current=!0;const k=await(await fetch(`https://api.promptfoo.dev/eval/${y}`)).json();t(((g=k.data.results)==null?void 0:g.table)||k.data.table),n(k.data.config),o(!0)},f=Bl("http://localhost:15500"),m=window.location.pathname.match(/\/eval\/([\w:-]+)/);if(m){const y=m[1];d(y)}else f.on("init",y=>{console.log("Initialized socket connection",y),o(!0),t(y.results.table),n(y.config)}),f.on("update",y=>{console.log("Received data update",y),t(y.results.table),n(y.config)});return()=>{f.disconnect()}},[t,n]),w.jsxs(uR,{theme:u,children:[w.jsx(jA,{darkMode:l,onToggleDarkMode:c}),r&&e?w.jsx(TA,{}):w.jsx("div",{children:"Loading..."})]})}jc.createRoot(document.getElementById("root")).render(w.jsx(wt.StrictMode,{children:w.jsx(BA,{})}));
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>promptfoo web viewer</title>
8
- <script type="module" crossorigin src="/assets/index-58a0e3e3.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-c2756e5d.js"></script>
9
9
  <link rel="stylesheet" href="/assets/index-b82d0138.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "promptfoo",
3
3
  "description": "LLM eval & testing toolkit",
4
4
  "author": "Ian Webster",
5
- "version": "0.17.3",
5
+ "version": "0.17.5",
6
6
  "license": "MIT",
7
7
  "type": "commonjs",
8
8
  "main": "dist/src/index.js",
@@ -25,7 +25,7 @@
25
25
  "promptfoo": "dist/src/main.js"
26
26
  },
27
27
  "scripts": {
28
- "local": "ts-node --esm src/main.ts",
28
+ "local": "ts-node --esm --files src/main.ts",
29
29
  "install:client": "cd src/web/client && npm install",
30
30
  "build:clean": "rm -rf dist",
31
31
  "build:client": "cd src/web/client && npm run build && cp -r dist/ ../../../dist/src/web/client",
package/src/assertions.ts CHANGED
@@ -207,6 +207,22 @@ export async function runAssertion(
207
207
  };
208
208
  }
209
209
 
210
+ if (baseType === 'starts-with') {
211
+ invariant(assertion.value, '"starts-with" assertion type must have a string value');
212
+ invariant(
213
+ typeof assertion.value === 'string',
214
+ '"starts-with" assertion type must have a string value',
215
+ );
216
+ pass = output.startsWith(String(assertion.value)) !== inverse;
217
+ return {
218
+ pass,
219
+ score: pass ? 1 : 0,
220
+ reason: pass
221
+ ? 'Assertion passed'
222
+ : `Expected output to ${inverse ? 'not ' : ''}start with "${assertion.value}"`,
223
+ };
224
+ }
225
+
210
226
  if (baseType === 'contains-json') {
211
227
  pass = containsJSON(output) !== inverse;
212
228
  return {
@@ -480,7 +496,7 @@ export function assertionFromString(expected: string): Assertion {
480
496
 
481
497
  // New options
482
498
  const assertionRegex =
483
- /^(not-)?(equals|contains-any|contains-all|contains-json|is-json|regex|icontains|contains|webhook|rouge-n|similar)(?::|\((\d+(\.\d+)?)\):)?(.*)$/;
499
+ /^(not-)?(equals|contains-any|contains-all|contains-json|is-json|regex|icontains|contains|webhook|rouge-n|similar|starts-with)(?::|\((\d+(\.\d+)?)\):)?(.*)$/;
484
500
  const regexMatch = expected.match(assertionRegex);
485
501
 
486
502
  if (regexMatch) {
@@ -497,7 +513,7 @@ export function assertionFromString(expected: string): Assertion {
497
513
  return {
498
514
  type: fullType as AssertionType,
499
515
  };
500
- } else if (type === 'rouge-n' || type === 'similar') {
516
+ } else if (type === 'rouge-n' || type === 'similar' || type === 'starts-with') {
501
517
  return {
502
518
  type: fullType as AssertionType,
503
519
  value,
package/src/index.ts CHANGED
@@ -26,6 +26,7 @@ async function evaluate(testSuite: EvaluateTestSuite, options: EvaluateOptions =
26
26
  display: promptContent,
27
27
  })),
28
28
  };
29
+ telemetry.maybeShowNotice();
29
30
  const ret = await doEvaluate(constructedTestSuite, options);
30
31
  await telemetry.send();
31
32
  return ret;
package/src/main.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
3
3
  import { join as pathJoin, dirname } from 'path';
4
+ import readline from 'readline';
4
5
 
5
6
  import chalk from 'chalk';
6
7
  import { Command } from 'commander';
@@ -56,10 +57,14 @@ function createDummyFiles(directory: string | null) {
56
57
  writeFileSync(pathJoin(process.cwd(), directory, 'README.md'), DEFAULT_README);
57
58
 
58
59
  if (directory === '.') {
59
- logger.info('Wrote prompts.txt and promptfooconfig.js. Open README.md to get started!');
60
+ logger.info(
61
+ chalk.green.bold(
62
+ 'Wrote prompts.txt and promptfooconfig.yaml. Open README.md to get started!',
63
+ ),
64
+ );
60
65
  } else {
61
- logger.info(`Wrote prompts.txt and promptfooconfig.js to ./${directory}`);
62
- logger.info(`\`cd ${directory}\` and open README.md to get started!`);
66
+ logger.info(chalk.green.bold(`Wrote prompts.txt and promptfooconfig.yaml to ./${directory}`));
67
+ logger.info(chalk.green(`\`cd ${directory}\` and open README.md to get started!`));
63
68
  }
64
69
  }
65
70
 
@@ -72,20 +77,20 @@ async function main() {
72
77
  pathJoin(pwd, 'promptfooconfig.json'),
73
78
  pathJoin(pwd, 'promptfooconfig.yaml'),
74
79
  ];
75
- let config: Partial<UnifiedConfig> = {};
80
+ let defaultConfig: Partial<UnifiedConfig> = {};
76
81
  for (const path of potentialPaths) {
77
82
  const maybeConfig = await maybeReadConfig(path);
78
83
  if (maybeConfig) {
79
- config = maybeConfig;
84
+ defaultConfig = maybeConfig;
80
85
  break;
81
86
  }
82
87
  }
83
88
 
84
89
  let evaluateOptions: EvaluateOptions = {};
85
- if (config.evaluateOptions) {
86
- evaluateOptions.generateSuggestions = config.evaluateOptions.generateSuggestions;
87
- evaluateOptions.maxConcurrency = config.evaluateOptions.maxConcurrency;
88
- evaluateOptions.showProgressBar = config.evaluateOptions.showProgressBar;
90
+ if (defaultConfig.evaluateOptions) {
91
+ evaluateOptions.generateSuggestions = defaultConfig.evaluateOptions.generateSuggestions;
92
+ evaluateOptions.maxConcurrency = defaultConfig.evaluateOptions.maxConcurrency;
93
+ evaluateOptions.showProgressBar = defaultConfig.evaluateOptions.showProgressBar;
89
94
  }
90
95
 
91
96
  const program = new Command();
@@ -102,6 +107,7 @@ async function main() {
102
107
  .command('init [directory]')
103
108
  .description('Initialize project with dummy files')
104
109
  .action(async (directory: string | null) => {
110
+ telemetry.maybeShowNotice();
105
111
  createDummyFiles(directory);
106
112
  telemetry.record('command_used', {
107
113
  name: 'init',
@@ -114,6 +120,7 @@ async function main() {
114
120
  .description('Start browser ui')
115
121
  .option('-p, --port <number>', 'Port number', '15500')
116
122
  .action(async (cmdObj: { port: number } & Command) => {
123
+ telemetry.maybeShowNotice();
117
124
  telemetry.record('command_used', {
118
125
  name: 'view',
119
126
  });
@@ -124,19 +131,46 @@ async function main() {
124
131
  program
125
132
  .command('share')
126
133
  .description('Share your most recent result')
127
- .action(async (cmdObj: { port: number } & Command) => {
134
+ .option('-y, --yes', 'Skip confirmation')
135
+ .action(async (cmdObj: { yes: boolean } & Command) => {
136
+ telemetry.maybeShowNotice();
128
137
  telemetry.record('command_used', {
129
138
  name: 'share',
130
139
  });
131
140
  await telemetry.send();
132
141
 
133
- const latestResults = readLatestResults();
134
- if (!latestResults) {
135
- logger.error('Could not load results. Do you need to run `promptfoo eval` first?');
136
- process.exit(1);
142
+ const createPublicUrl = async () => {
143
+ const latestResults = readLatestResults();
144
+ if (!latestResults) {
145
+ logger.error('Could not load results. Do you need to run `promptfoo eval` first?');
146
+ process.exit(1);
147
+ }
148
+ const url = await createShareableUrl(latestResults.results, latestResults.config);
149
+ logger.info(`View results: ${chalk.greenBright.bold(url)}`);
150
+ };
151
+
152
+ if (cmdObj.yes || process.env.PROMPTFOO_DISABLE_SHARE_WARNING) {
153
+ createPublicUrl();
154
+ } else {
155
+ const reader = readline.createInterface({
156
+ input: process.stdin,
157
+ output: process.stdout,
158
+ });
159
+
160
+ reader.question(
161
+ 'Are you sure you want to create a public URL? [y/N] ',
162
+ async function (answer: string) {
163
+ if (answer.toLowerCase() !== 'yes' && answer.toLowerCase() !== 'y') {
164
+ logger.info('Did not create a public URL.');
165
+ reader.close();
166
+ return;
167
+ }
168
+ reader.close();
169
+
170
+ createPublicUrl();
171
+ },
172
+ );
137
173
  }
138
- const url = await createShareableUrl(latestResults.results, latestResults.config);
139
- logger.info(`View results: ${chalk.greenBright.bold(url)}`);
140
174
  });
141
175
 
142
176
  program
@@ -145,6 +179,7 @@ async function main() {
145
179
  .command('clear')
146
180
  .description('Clear cache')
147
181
  .action(async () => {
182
+ telemetry.maybeShowNotice();
148
183
  await clearCache();
149
184
  telemetry.record('command_used', {
150
185
  name: 'cache_clear',
@@ -155,28 +190,32 @@ async function main() {
155
190
  program
156
191
  .command('eval')
157
192
  .description('Evaluate prompts')
158
- .option('-p, --prompts <paths...>', 'Paths to prompt files (.txt)', config.prompts)
193
+ .option('-p, --prompts <paths...>', 'Paths to prompt files (.txt)')
159
194
  .option(
160
195
  '-r, --providers <name or path...>',
161
196
  'One of: openai:chat, openai:completion, openai:<model name>, or path to custom API caller module',
162
197
  )
163
198
  .option(
164
199
  '-c, --config <path>',
165
- 'Path to configuration file. Automatically loads promptfooconfig.js/json/yaml',
200
+ 'Path to configuration file. Automatically loads promptfoodefaultConfig.js/json/yaml',
166
201
  )
167
202
  .option(
168
203
  // TODO(ian): Remove `vars` for v1
169
204
  '-v, --vars, -t, --tests <path>',
170
205
  'Path to CSV with test cases',
171
- config?.commandLineOptions?.vars,
206
+ defaultConfig?.commandLineOptions?.vars,
207
+ )
208
+ .option('-t, --tests <path>', 'Path to CSV with test cases')
209
+ .option(
210
+ '-o, --output <path>',
211
+ 'Path to output file (csv, json, yaml, html)',
212
+ defaultConfig.outputPath,
172
213
  )
173
- .option('-t, --tests <path>', 'Path to CSV with test cases', config?.commandLineOptions?.tests)
174
- .option('-o, --output <path>', 'Path to output file (csv, json, yaml, html)', config.outputPath)
175
214
  .option(
176
215
  '-j, --max-concurrency <number>',
177
216
  'Maximum number of concurrent API calls',
178
- config.evaluateOptions?.maxConcurrency
179
- ? String(config.evaluateOptions.maxConcurrency)
217
+ defaultConfig.evaluateOptions?.maxConcurrency
218
+ ? String(defaultConfig.evaluateOptions.maxConcurrency)
180
219
  : undefined,
181
220
  )
182
221
  .option(
@@ -191,28 +230,28 @@ async function main() {
191
230
  .option(
192
231
  '--prompt-prefix <path>',
193
232
  'This prefix is prepended to every prompt',
194
- config.defaultTest?.options?.prefix,
233
+ defaultConfig.defaultTest?.options?.prefix,
195
234
  )
196
235
  .option(
197
236
  '--prompt-suffix <path>',
198
237
  'This suffix is append to every prompt',
199
- config.defaultTest?.options?.suffix,
238
+ defaultConfig.defaultTest?.options?.suffix,
200
239
  )
201
240
  .option(
202
241
  '--no-write',
203
242
  'Do not write results to promptfoo directory',
204
- config?.commandLineOptions?.write,
243
+ defaultConfig?.commandLineOptions?.write,
205
244
  )
206
245
  .option(
207
246
  '--no-cache',
208
247
  'Do not read or write results to disk cache',
209
- config?.commandLineOptions?.cache,
248
+ defaultConfig?.commandLineOptions?.cache,
210
249
  )
211
250
  .option('--no-progress-bar', 'Do not show progress bar')
212
- .option('--no-table', 'Do not output table in CLI', config?.commandLineOptions?.table)
213
- .option('--share', 'Create a shareable URL', config?.commandLineOptions?.share)
214
- .option('--grader', 'Model that will grade outputs', config?.commandLineOptions?.grader)
215
- .option('--verbose', 'Show debug logs', config?.commandLineOptions?.verbose)
251
+ .option('--no-table', 'Do not output table in CLI', defaultConfig?.commandLineOptions?.table)
252
+ .option('--share', 'Create a shareable URL', defaultConfig?.commandLineOptions?.share)
253
+ .option('--grader', 'Model that will grade outputs', defaultConfig?.commandLineOptions?.grader)
254
+ .option('--verbose', 'Show debug logs', defaultConfig?.commandLineOptions?.verbose)
216
255
  .option('--view [port]', 'View in browser ui')
217
256
  .action(async (cmdObj: CommandLineOptions & Command) => {
218
257
  // Misc settings
@@ -225,15 +264,20 @@ async function main() {
225
264
 
226
265
  // Config parsing
227
266
  const maxConcurrency = parseInt(cmdObj.maxConcurrency || '', 10);
267
+ let fileConfig: Partial<UnifiedConfig> = {};
228
268
  const configPath = cmdObj.config;
229
269
  if (configPath) {
230
- config = await readConfig(configPath);
270
+ fileConfig = await readConfig(configPath);
231
271
  }
232
- config = {
233
- prompts: cmdObj.prompts || config.prompts,
234
- providers: cmdObj.providers || config.providers,
235
- tests: cmdObj.tests || cmdObj.vars || config.tests,
236
- defaultTest: config.defaultTest,
272
+ const config: Partial<UnifiedConfig> = {
273
+ prompts: cmdObj.prompts || fileConfig.prompts || defaultConfig.prompts,
274
+ providers: cmdObj.providers || fileConfig.providers || defaultConfig.providers,
275
+ tests: cmdObj.tests || cmdObj.vars || fileConfig.tests || defaultConfig.tests,
276
+ sharing:
277
+ process.env.PROMPTFOO_DISABLE_SHARING === '1'
278
+ ? false
279
+ : fileConfig.sharing ?? defaultConfig.sharing ?? true,
280
+ defaultTest: fileConfig.defaultTest,
237
281
  };
238
282
 
239
283
  // Validation
@@ -301,7 +345,8 @@ async function main() {
301
345
 
302
346
  const summary = await evaluate(testSuite, options);
303
347
 
304
- const shareableUrl = cmdObj.share ? await createShareableUrl(summary, config) : null;
348
+ const shareableUrl =
349
+ cmdObj.share && config.sharing ? await createShareableUrl(summary, config) : null;
305
350
 
306
351
  if (cmdObj.output) {
307
352
  logger.info(chalk.yellow(`Writing output to ${cmdObj.output}`));
@@ -317,7 +362,9 @@ async function main() {
317
362
  }
318
363
  }
319
364
 
320
- const border = '='.repeat(process.stdout.columns - 10);
365
+ telemetry.maybeShowNotice();
366
+
367
+ const border = '='.repeat((process.stdout.columns || 80) - 10);
321
368
  logger.info(border);
322
369
  if (!cmdObj.write) {
323
370
  logger.info(`${chalk.green('✔')} Evaluation complete`);
@@ -340,13 +387,14 @@ async function main() {
340
387
  logger.info(
341
388
  `Token usage: Total ${summary.stats.tokenUsage.total}, Prompt ${summary.stats.tokenUsage.prompt}, Completion ${summary.stats.tokenUsage.completion}, Cached ${summary.stats.tokenUsage.cached}`,
342
389
  );
343
- logger.info('Done.');
344
390
 
345
391
  telemetry.record('command_used', {
346
392
  name: 'eval',
347
393
  });
348
394
  await telemetry.send();
349
395
 
396
+ logger.info('Done.');
397
+
350
398
  if (cmdObj.view) {
351
399
  init(parseInt(cmdObj.view, 10) || 15500);
352
400
  }
@@ -25,7 +25,7 @@ export class AnthropicCompletionProvider implements ApiProvider {
25
25
  constructor(modelName: string, apiKey?: string, context?: AnthropicCompletionOptions) {
26
26
  this.modelName = modelName;
27
27
  this.apiKey = apiKey || process.env.ANTHROPIC_API_KEY;
28
- this.anthropic = new Anthropic({apiKey: this.apiKey});
28
+ this.anthropic = new Anthropic({ apiKey: this.apiKey });
29
29
  this.options = context || {};
30
30
  }
31
31