promptfoo 0.75.2 → 0.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/drizzle/0003_lively_naoko.sql +8 -0
- package/dist/drizzle/meta/_journal.json +7 -0
- package/dist/package.json +2 -2
- package/dist/src/assertions.js +1 -1
- package/dist/src/assertions.js.map +1 -1
- package/dist/src/commands/delete.d.ts.map +1 -1
- package/dist/src/commands/delete.js +27 -2
- package/dist/src/commands/delete.js.map +1 -1
- package/dist/src/commands/eval.d.ts.map +1 -1
- package/dist/src/commands/eval.js +1 -0
- package/dist/src/commands/eval.js.map +1 -1
- package/dist/src/commands/export.js +15 -15
- package/dist/src/commands/export.js.map +1 -1
- package/dist/src/commands/generate/redteam.d.ts.map +1 -1
- package/dist/src/commands/generate/redteam.js +7 -26
- package/dist/src/commands/generate/redteam.js.map +1 -1
- package/dist/src/commands/import.js +2 -2
- package/dist/src/commands/import.js.map +1 -1
- package/dist/src/commands/redteam.js +2 -2
- package/dist/src/commands/redteam.js.map +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +23 -2
- package/dist/src/config.js.map +1 -1
- package/dist/src/database/{operations.d.ts → tables.d.ts} +2 -1
- package/dist/src/database/tables.d.ts.map +1 -0
- package/dist/src/database/{operations.js → tables.js} +15 -4
- package/dist/src/database/tables.js.map +1 -0
- package/dist/src/fetch.d.ts.map +1 -1
- package/dist/src/fetch.js +3 -1
- package/dist/src/fetch.js.map +1 -1
- package/dist/src/providers/cohere.d.ts +1 -1
- package/dist/src/providers/cohere.d.ts.map +1 -1
- package/dist/src/providers/cohere.js.map +1 -1
- package/dist/src/providers/manualInput.d.ts +1 -1
- package/dist/src/providers/manualInput.d.ts.map +1 -1
- package/dist/src/providers/pythonCompletion.d.ts +5 -1
- package/dist/src/providers/pythonCompletion.d.ts.map +1 -1
- package/dist/src/providers/pythonCompletion.js.map +1 -1
- package/dist/src/providers/shared.d.ts.map +1 -1
- package/dist/src/providers/shared.js +6 -0
- package/dist/src/providers/shared.js.map +1 -1
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +3 -1
- package/dist/src/providers.js.map +1 -1
- package/dist/src/redteam/constants.d.ts +3 -2
- package/dist/src/redteam/constants.d.ts.map +1 -1
- package/dist/src/redteam/constants.js +19 -2
- package/dist/src/redteam/constants.js.map +1 -1
- package/dist/src/redteam/graders.d.ts.map +1 -1
- package/dist/src/redteam/graders.js +4 -0
- package/dist/src/redteam/graders.js.map +1 -1
- package/dist/src/redteam/index.d.ts.map +1 -1
- package/dist/src/redteam/index.js +3 -1
- package/dist/src/redteam/index.js.map +1 -1
- package/dist/src/redteam/plugins/base.d.ts +1 -1
- package/dist/src/redteam/plugins/base.d.ts.map +1 -1
- package/dist/src/redteam/plugins/base.js +3 -1
- package/dist/src/redteam/plugins/base.js.map +1 -1
- package/dist/src/redteam/plugins/bfla.d.ts +16 -0
- package/dist/src/redteam/plugins/bfla.d.ts.map +1 -0
- package/dist/src/redteam/plugins/bfla.js +118 -0
- package/dist/src/redteam/plugins/bfla.js.map +1 -0
- package/dist/src/redteam/plugins/bola.d.ts +16 -0
- package/dist/src/redteam/plugins/bola.d.ts.map +1 -0
- package/dist/src/redteam/plugins/bola.js +138 -0
- package/dist/src/redteam/plugins/bola.js.map +1 -0
- package/dist/src/redteam/plugins/contracts.d.ts.map +1 -1
- package/dist/src/redteam/plugins/contracts.js +27 -1
- package/dist/src/redteam/plugins/contracts.js.map +1 -1
- package/dist/src/redteam/plugins/excessiveAgency.d.ts.map +1 -1
- package/dist/src/redteam/plugins/excessiveAgency.js +41 -1
- package/dist/src/redteam/plugins/excessiveAgency.js.map +1 -1
- package/dist/src/redteam/plugins/harmful.d.ts +1 -1
- package/dist/src/redteam/plugins/harmful.d.ts.map +1 -1
- package/dist/src/redteam/plugins/harmful.js +22 -5
- package/dist/src/redteam/plugins/harmful.js.map +1 -1
- package/dist/src/redteam/plugins/imitation.d.ts.map +1 -1
- package/dist/src/redteam/plugins/imitation.js +7 -1
- package/dist/src/redteam/plugins/imitation.js.map +1 -1
- package/dist/src/redteam/plugins/index.d.ts.map +1 -1
- package/dist/src/redteam/plugins/index.js +10 -0
- package/dist/src/redteam/plugins/index.js.map +1 -1
- package/dist/src/redteam/plugins/policy.d.ts +2 -3
- package/dist/src/redteam/plugins/policy.d.ts.map +1 -1
- package/dist/src/redteam/plugins/policy.js +2 -2
- package/dist/src/redteam/plugins/policy.js.map +1 -1
- package/dist/src/redteam/plugins/politics.js +1 -1
- package/dist/src/redteam/plugins/rbac.d.ts.map +1 -1
- package/dist/src/redteam/plugins/rbac.js +8 -0
- package/dist/src/redteam/plugins/rbac.js.map +1 -1
- package/dist/src/redteam/providers/iterative.d.ts +1 -1
- package/dist/src/redteam/providers/iterative.d.ts.map +1 -1
- package/dist/src/redteam/providers/iterative.js.map +1 -1
- package/dist/src/redteam/providers/iterativeImage.d.ts +1 -1
- package/dist/src/redteam/providers/iterativeImage.d.ts.map +1 -1
- package/dist/src/redteam/providers/iterativeImage.js.map +1 -1
- package/dist/src/redteam/providers/iterativeTree.d.ts +1 -1
- package/dist/src/redteam/providers/iterativeTree.d.ts.map +1 -1
- package/dist/src/redteam/providers/iterativeTree.js.map +1 -1
- package/dist/src/types/index.d.ts +68 -59
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +7 -5
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/providers.d.ts +1 -0
- package/dist/src/types/providers.d.ts.map +1 -1
- package/dist/src/types/providers.js.map +1 -1
- package/dist/src/types/redteam.d.ts +0 -2
- package/dist/src/types/redteam.d.ts.map +1 -1
- package/dist/src/util/index.d.ts +1 -0
- package/dist/src/util/index.d.ts.map +1 -1
- package/dist/src/util/index.js +77 -72
- package/dist/src/util/index.js.map +1 -1
- package/dist/src/validators/redteam.d.ts.map +1 -1
- package/dist/src/validators/redteam.js +12 -2
- package/dist/src/validators/redteam.js.map +1 -1
- package/dist/src/web/nextui/404/index.html +1 -1
- package/dist/src/web/nextui/404.html +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/{layout-71ac2a3c45b74676.js → layout-a749f6361f84152a.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/report/page-a7dd52951b145b11.js +1 -0
- package/dist/src/web/nextui/auth/login/index.html +1 -1
- package/dist/src/web/nextui/auth/login/index.txt +2 -2
- package/dist/src/web/nextui/auth/signup/index.html +1 -1
- package/dist/src/web/nextui/auth/signup/index.txt +2 -2
- package/dist/src/web/nextui/datasets/index.html +1 -1
- package/dist/src/web/nextui/datasets/index.txt +2 -2
- package/dist/src/web/nextui/eval/index.html +1 -1
- package/dist/src/web/nextui/eval/index.txt +3 -3
- package/dist/src/web/nextui/index.html +1 -1
- package/dist/src/web/nextui/index.txt +2 -2
- package/dist/src/web/nextui/progress/index.html +1 -1
- package/dist/src/web/nextui/progress/index.txt +2 -2
- package/dist/src/web/nextui/prompts/index.html +1 -1
- package/dist/src/web/nextui/prompts/index.txt +2 -2
- package/dist/src/web/nextui/report/index.html +1 -1
- package/dist/src/web/nextui/report/index.txt +3 -3
- package/dist/src/web/nextui/setup/index.html +1 -1
- package/dist/src/web/nextui/setup/index.txt +2 -2
- package/dist/test/config.test.js +23 -0
- package/dist/test/config.test.js.map +1 -1
- package/dist/test/providers.shared.test.js +11 -0
- package/dist/test/providers.shared.test.js.map +1 -1
- package/dist/test/redteam/plugins/base.test.js +83 -3
- package/dist/test/redteam/plugins/base.test.js.map +1 -1
- package/dist/test/redteam/plugins/imitation.test.js +3 -3
- package/dist/test/redteam/plugins/imitation.test.js.map +1 -1
- package/dist/test/redteam/validators.test.js +3 -2
- package/dist/test/redteam/validators.test.js.map +1 -1
- package/dist/test/types.test.d.ts +2 -0
- package/dist/test/types.test.d.ts.map +1 -0
- package/dist/test/types.test.js +133 -0
- package/dist/test/types.test.js.map +1 -0
- package/package.json +2 -2
- package/dist/src/database/operations.d.ts.map +0 -1
- package/dist/src/database/operations.js.map +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/report/page-f98183d5136adf05.js +0 -1
- /package/dist/src/web/nextui/_next/static/chunks/{258-53afc87c8ef7af40.js → 258-62f675217b82626c.js} +0 -0
- /package/dist/src/web/nextui/_next/static/{qZKTWTsUGx61Y9FXa4D_i → rznp6ATZbrfeCiJE-WYrp}/_buildManifest.js +0 -0
- /package/dist/src/web/nextui/_next/static/{qZKTWTsUGx61Y9FXa4D_i → rznp6ATZbrfeCiJE-WYrp}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[420],{58004:function(e,i,t){Promise.resolve().then(t.bind(t,69914))},49532:function(e,i,t){"use strict";let a,s;async function n(){if(a||(s||(s=fetch("/api/config").then(e=>e.json()).then(e=>a=e.apiBaseUrl)),await s),void 0===a)throw Error("API base URL is undefined");return a}t.d(i,{b:function(){return n}})},69914:function(e,i,t){"use strict";t.r(i),t.d(i,{default:function(){return em}});var a,s,n=t(24004),r=t(14978),l=t(49532),o=t(49567),c=t(80661),d=t(885),m=t(11520),u=t(32414),h=t(63147),p=t(49578);let g={"Brand Risk":["competitors","excessive-agency","hallucination","harmful:graphic-content","harmful:harassment-bullying","harmful:indiscriminate-weapons","harmful:insults","harmful:misinformation-disinformation","harmful:non-violent-crime","harmful:profanity","harmful:radicalization","harmful:unsafe-practices","imitation","overreliance","politics"],"Legal Risk":["contracts","harmful:child-exploitation","harmful:copyright-violations","harmful:cybercrime","harmful:hate","harmful:illegal-activities","harmful:illegal-drugs","harmful:intellectual-property","harmful:privacy","harmful:self-harm","harmful:sex-crime","harmful:sexual-content","harmful:specialized-advice","harmful:violent-crime"],"Technical Risk":["debug-access","hijacking","jailbreak","pii","prompt-injection","rbac","shell-injection","sql-injection"]},f={"Brand Risk":"Risks that can affect the brand reputation and trustworthiness.","Legal Risk":"Risks that can lead to legal consequences or violations.","Technical Risk":"Risks involving malicious activities targeting the system or users."};(a=s||(s={})).Critical="Critical",a.High="High",a.Medium="Medium",a.Low="Low";let v={"debug-access":s.High,"excessive-agency":s.Medium,"harmful:child-exploitation":s.Critical,"harmful:copyright-violations":s.Low,"harmful:cybercrime":s.Low,"harmful:graphic-content":s.Medium,"harmful:harassment-bullying":s.Low,"harmful:hate":s.Critical,"harmful:illegal-activities":s.Medium,"harmful:illegal-drugs":s.Medium,"harmful:indiscriminate-weapons":s.Medium,"harmful:insults":s.Low,"harmful:intellectual-property":s.Medium,"harmful:misinformation-disinformation":s.Medium,"harmful:non-violent-crime":s.Medium,"harmful:privacy":s.High,"harmful:profanity":s.Low,"harmful:radicalization":s.Low,"harmful:self-harm":s.Critical,"harmful:sex-crime":s.High,"harmful:sexual-content":s.Medium,"harmful:specialized-advice":s.Medium,"harmful:unsafe-practices":s.Low,"harmful:violent-crime":s.High,"prompt-injection":s.Medium,"shell-injection":s.High,"sql-injection":s.High,competitors:s.Low,contracts:s.Medium,hallucination:s.Medium,hijacking:s.High,imitation:s.Low,jailbreak:s.Medium,overreliance:s.Low,pii:s.High,politics:s.Low,rbac:s.High},x=Object.entries(g).reduce((e,i)=>{let[t,a]=i;return a.forEach(i=>{e[i]=t}),e},{});Object.keys(x);let j={"debug-access":"DebugAccess","excessive-agency":"ExcessiveAgency","harmful:child-exploitation":"Child Exploitation","harmful:cybercrime":"Cybercrime & Unauthorized Intrusion - Hacking and Malware","harmful:graphic-content":"Graphic & age-restricted content","harmful:harassment-bullying":"Harassment & Bullying","harmful:hate":"Hate","harmful:illegal-activities":"Illegal Activities - Fraud & scams","harmful:illegal-drugs":"Illegal Drugs","harmful:indiscriminate-weapons":"Indiscriminate Weapons","harmful:insults":"Insults and personal attacks","harmful:intellectual-property":"Intellectual Property violation","harmful:misinformation-disinformation":"Misinformation & Disinformation - Harmful lies and propaganda","harmful:non-violent-crime":"Non-Violent Crimes","harmful:privacy":"Privacy violations","harmful:profanity":"Requests containing profanity","harmful:radicalization":"Radicalization","harmful:self-harm":"Self-Harm","harmful:sex-crime":"Sex Crimes","harmful:sexual-content":"Sexual Content","harmful:specialized-advice":"Specialized Advice - Financial","harmful:unsafe-practices":"Promotion of unsafe practices","harmful:violent-crime":"Violent Crimes","harmful:chemical-biological-weapons":"Chemical & Biological Weapons","harmful:copyright-violations":"Copyright Violations - Copyrighted text","prompt-injection":"Harmful/Injection","shell-injection":"ShellInjection","sql-injection":"SqlInjection",competitors:"CompetitorEndorsement",contracts:"ContractualCommitment",hallucination:"Hallucination",hijacking:"Hijacking",imitation:"Imitation",jailbreak:"Harmful/Iterative",overreliance:"Overreliance",pii:"PIILeak",politics:"PoliticalStatement",rbac:"RbacEnforcement"},y=Object.entries(j).reduce((e,i)=>{let[t,a]=i;return e[a]=t,e},{}),b={"excessive-agency":"Excessive Agency","prompt-injection":"Prompt Injection",competitors:"Competitor Endorsements",contracts:"Unsupervised Contracts",jailbreak:"Jailbreak",pii:"PII Leaks",politics:"Political Opinions","shell-injection":"Shell Injection","sql-injection":"SQL Injection",rbac:"RBAC Enforcement","debug-access":"Debug Access","harmful:specialized-advice":"Specialized Advice","harmful:illegal-activities":"Illegal Activities","harmful:cybercrime":"Cybercrime","harmful:copyright-violations":"Copyright Violations","harmful:misinformation-disinformation":"Misinformation & disinformation"},w={default:"Includes common plugins","debug-access":"Attempts to access or use debugging commands.","excessive-agency":"Model taking excessive initiative or misunderstanding its capabilities.","harmful:chemical-biological-weapons":"Content related to chemical or biological weapons","harmful:child-exploitation":"Content exploiting or harming children.","harmful:copyright-violations":"Content violating copyright laws.","harmful:cybercrime":"Content related to cybercriminal activities.","harmful:graphic-content":"Displaying graphic or violent content.","harmful:harassment-bullying":"Content that harasses or bullies individuals.","harmful:hate":"Content that promotes hate or discrimination.","harmful:illegal-activities":"Content promoting illegal activities.","harmful:illegal-drugs":"Content related to illegal drug use or trade.","harmful:indiscriminate-weapons":"Content related to weapons without context.","harmful:insults":"Content that insults or demeans individuals.","harmful:intellectual-property":"Content violating intellectual property rights.","harmful:misinformation-disinformation":"Spreading false or misleading information.","harmful:non-violent-crime":"Content related to non-violent criminal activities.","harmful:privacy":"Content violating privacy rights.","harmful:profanity":"Content containing profane or inappropriate language.","harmful:radicalization":"Content that promotes radical or extremist views.","harmful:self-harm":"Content that encourages self-harm or suicide.","harmful:sex-crime":"Content related to sexual crimes.","harmful:sexual-content":"Explicit or inappropriate sexual content.","harmful:specialized-advice":"Providing advice in specialized fields without expertise.","harmful:unsafe-practices":"Content promoting unsafe or harmful practices.","harmful:violent-crime":"Content related to violent criminal activities.","jailbreak:tree":"Experimental: More expensive and time-consuming jailbreak technique for improved results.","pii:api-db":"PII exposed through API or database","pii:direct":"Direct exposure of PII","pii:session":"PII exposed in session data","pii:social":"PII exposed through social engineering","prompt-injection":"Malicious inputs designed to manipulate the model's behavior.","shell-injection":"Attempts to execute shell commands through the model.","sql-injection":"Attempts to perform SQL injection attacks to manipulate database queries.",base64:"Attempts to obfuscate malicious content using Base64 encoding.",competitors:"Competitor mentions and endorsements",contracts:"Enters business or legal commitments without supervision.",hallucination:"Model generating false or misleading information.",harmful:"All harmful categories",hijacking:"Unauthorized or off-topic resource use.",imitation:"Imitates people, brands, or organizations.",jailbreak:"Attempts to bypass security measures through iterative prompt refinement.",leetspeak:"Attempts to obfuscate malicious content using leetspeak.",overreliance:"Model susceptible to relying on an incorrect user assumption or input.",pii:"All PII categories",policy:"Violates a custom configured policy.",politics:"Makes political statements.",rbac:"Tests whether the model properly implements Role-Based Access Control (RBAC).",rot13:"Attempts to obfuscate malicious content using ROT13 encoding."};t(4309);var Z=e=>{let{categoryStats:i}=e,t=[s.Critical,s.High,s.Medium,s.Low],a=t.reduce((e,t)=>(e[t]=Object.keys(i).reduce((e,i)=>v[i]===t?e+1:e,0),e),{});return(0,n.jsx)(u.Z,{spacing:2,direction:{xs:"column",sm:"row"},children:t.map(e=>(0,n.jsx)(o.Z,{flex:1,children:(0,n.jsx)(c.Z,{className:"severity-card card-".concat(e.toLowerCase()),children:(0,n.jsxs)(p.Z,{onClick:()=>window.location.hash="#table",children:[(0,n.jsx)(h.Z,{variant:"h6",gutterBottom:!0,children:e}),(0,n.jsx)(h.Z,{variant:"h4",color:"text.primary",children:a[e]}),(0,n.jsx)(h.Z,{variant:"body2",color:"text.secondary",children:"issues"})]})})},e))})},k=t(48931),C=t(77656),R=t(65969),I=t(35193),P=t.n(I),A=t(21629),L=e=>{let{evalDescription:i}=e,t=async()=>{let e=document.documentElement,t=await P()(e,{height:Math.max(e.scrollHeight,e.offsetHeight),windowHeight:document.documentElement.scrollHeight}),a=t.toDataURL("image/png"),s=new A.ZP("p","pt",[t.width,t.height]);s.addImage(a,"PNG",0,0,t.width,t.height);let n=i?"report_".concat(i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),".pdf"):"report.pdf";s.save(n)};return(0,n.jsx)(R.Z,{title:"Download report as PDF",placement:"top",children:(0,n.jsx)(C.Z,{onClick:t,sx:{mt:"4px"},"aria-label":"download report",children:(0,n.jsx)(k.Z,{})})})},S=t(75307),M=t(40982),N=t(29794),F=t(22701),H=t(51956),z=t(82669),D=t(97540),E=t(37204),T=t(79685),U=t(74595);let O={getItem:async e=>await (0,E.U2)(e)||null,setItem:async(e,i)=>{await (0,E.t8)(e,i)},removeItem:async e=>{await (0,E.IV)(e)}},W=(0,T.Ue)()((0,U.tJ)(e=>({showPercentagesOnRiskCards:!1,setShowPercentagesOnRiskCards:i=>e(()=>({showPercentagesOnRiskCards:i})),pluginPassRateThreshold:1,setPluginPassRateThreshold:i=>e(()=>({pluginPassRateThreshold:i}))}),{name:"ReportViewStorage",storage:(0,U.FL)(()=>O)}));var q=()=>{let{showPercentagesOnRiskCards:e,setShowPercentagesOnRiskCards:i,pluginPassRateThreshold:t,setPluginPassRateThreshold:a}=W(),[s,l]=r.useState(!1),o=()=>{l(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.Z,{title:"Report Settings",placement:"top",children:(0,n.jsx)(C.Z,{onClick:()=>{l(!0)},"aria-label":"settings",children:(0,n.jsx)(S.Z,{})})}),(0,n.jsxs)(N.Z,{open:s,onClose:o,fullWidth:!0,maxWidth:"sm",children:[(0,n.jsx)(z.Z,{children:"Report Settings"}),(0,n.jsxs)(H.Z,{children:[(0,n.jsx)(h.Z,{component:"div",sx:{padding:"16px 0"},children:(0,n.jsxs)("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[(0,n.jsx)("input",{type:"checkbox",checked:e,onChange:e=>i(e.target.checked),style:{marginRight:"10px"}}),"Show percentages on risk cards"]})}),(0,n.jsxs)(h.Z,{component:"div",sx:{padding:"16px 0"},children:[(0,n.jsxs)("label",{children:["Plugin Pass Rate Threshold: ",(100*t).toFixed(0),"%"]}),(0,n.jsx)(h.Z,{variant:"body2",color:"textSecondary",sx:{mt:1},children:"Sets the threshold for considering a plugin as passed on the risk cards."}),(0,n.jsx)(D.ZP,{value:t,onChange:(e,i)=>a(i),"aria-labelledby":"plugin-pass-rate-threshold-slider",step:.05,marks:!0,min:0,max:1,valueLabelDisplay:"auto",valueLabelFormat:e=>"".concat((100*e).toFixed(0),"%")})]})]}),(0,n.jsx)(F.Z,{children:(0,n.jsx)(M.Z,{onClick:o,variant:"contained",color:"primary",children:"Close"})})]})]})},B=t(63362),V=t(18845),_=t(69555),G=t(93650),J=t(47908),K=t(85912),Q=t(94941),$=t(48670);t(46553);var X=e=>{let{title:i,subtitle:t,progressValue:a,numTestsPassed:s,numTestsFailed:r,testTypes:l}=e,{showPercentagesOnRiskCards:d,pluginPassRateThreshold:m}=W();return(0,n.jsx)(c.Z,{children:(0,n.jsx)(p.Z,{className:"risk-card-container",children:(0,n.jsxs)(G.ZP,{container:!0,spacing:3,children:[(0,n.jsxs)(G.ZP,{item:!0,xs:12,md:6,style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[(0,n.jsx)(h.Z,{variant:"h5",className:"risk-card-title",children:i}),(0,n.jsx)(h.Z,{variant:"subtitle1",color:"textSecondary",mb:2,children:t}),(0,n.jsx)(o.Z,{sx:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:100,height:100},children:(0,n.jsx)($.a,{value:a,max:100,thickness:10,arc:{startAngle:-90,endAngle:90,color:"primary.main"},text:Number.isNaN(a)?"-":"".concat(Math.round(a),"%"),sx:{width:"100%",height:"100%"}})}),(0,n.jsxs)(h.Z,{variant:"h6",className:"risk-card-issues",children:[r," failed probes"]}),(0,n.jsxs)(h.Z,{variant:"subtitle1",color:"textSecondary",className:"risk-card-tests-passed",children:[s,"/",s+r," passed"]})]}),(0,n.jsx)(G.ZP,{item:!0,xs:6,md:4,children:(0,n.jsx)(J.Z,{dense:!0,children:l.map((e,i)=>(0,n.jsx)(R.Z,{title:w[e.name],placement:"left",arrow:!0,children:(0,n.jsxs)(K.ZP,{className:"risk-card-list-item",onClick:i=>{let t=new URLSearchParams(window.location.search),a=t.get("evalId"),s=j[e.name],n="/eval/?evalId=".concat(a,"&search=").concat(encodeURIComponent("(var=".concat(s,"|metric=").concat(s,")")));i.ctrlKey||i.metaKey?window.open(n,"_blank"):window.location.href=n},style:{cursor:"pointer"},children:[(0,n.jsx)(Q.Z,{primary:b[e.name]||j[e.name],primaryTypographyProps:{variant:"body2"}}),d?(0,n.jsx)(h.Z,{variant:"body2",className:"risk-card-percentage ".concat(e.percentage>=.8?"risk-card-percentage-high":e.percentage>=.5?"risk-card-percentage-medium":"risk-card-percentage-low"),children:"".concat(Math.round(100*e.percentage),"%")}):0===e.total?(0,n.jsx)(_.Z,{className:"risk-card-icon-no-tests"}):e.percentage>=m?(0,n.jsx)(V.Z,{className:"risk-card-icon-passed"}):(0,n.jsx)(B.Z,{className:"risk-card-icon-failed"})]})},i))})})]})})})};t(32991);var Y=e=>{let{categoryStats:i}=e,t=Object.keys(g).map(e=>({name:e,passed:g[e].every(e=>{var t,a;return(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total)})}));return(0,n.jsx)(u.Z,{spacing:4,children:t.map((e,t)=>{let a=e.name,s=g[a],r=s.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.pass)||0)},0),l=s.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.total)||0)},0);return(0,n.jsx)(X,{title:e.name,subtitle:f[a],progressValue:r/l*100,numTestsPassed:r,numTestsFailed:l-r,testTypes:s.map(e=>{var t,a,s,n,r;return{name:e,passed:(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total),percentage:((null===(s=i[e])||void 0===s?void 0:s.pass)||1)/((null===(n=i[e])||void 0===n?void 0:n.total)||1),total:(null===(r=i[e])||void 0===r?void 0:r.total)||0}})},t)})})},ee=t(65068),ei=t(70417),et=t(21303),ea=t(61451),es=t(26485),en=t(38592),er=t(30021),el=t(19708),eo=t(28891);t(93091);let ec=e=>{let i=[];for(let[t,a]of Object.entries(g))for(let t of a)i.push({pluginName:t,type:j[t]||t,description:w[t]||"",passRate:e[t]?(e[t].pass/e[t].total*100).toFixed(1)+"%":"N/A",passRateWithFilter:e[t]?(e[t].passWithFilter/e[t].total*100).toFixed(1)+"%":"N/A",severity:v[t]||"Unknown"});return i.sort((e,i)=>"N/A"===e.passRate?1:"N/A"===i.passRate?-1:parseFloat(e.passRate)-parseFloat(i.passRate))};var ed=e=>{let{evalId:i,categoryStats:t}=e;(0,eo.useRouter)();let a=ec(t).filter(e=>"N/A"!==e.passRate),[s,l]=r.useState(0),[c,d]=r.useState(10),[m,u]=r.useState("asc"),[p,g]=r.useState("default"),f=e=>{let i=p===e&&"asc"===m;u(i?"desc":"asc"),g(e)};return(0,n.jsxs)(o.Z,{children:[(0,n.jsx)(h.Z,{variant:"h5",gutterBottom:!0,id:"table",children:"Vulnerabilities and Mitigations"}),(0,n.jsxs)(ea.Z,{children:[(0,n.jsxs)(ee.Z,{children:[(0,n.jsx)(es.Z,{children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(et.Z,{children:"Type"}),(0,n.jsx)(et.Z,{children:"Description"}),(0,n.jsx)(et.Z,{children:(0,n.jsx)(el.Z,{active:"passRate"===p,direction:"passRate"===p?m:"asc",onClick:()=>f("passRate"),children:"Pass rate"})}),(0,n.jsx)(et.Z,{children:(0,n.jsx)(el.Z,{active:"severity"===p,direction:"severity"===p?m:"asc",onClick:()=>f("severity"),children:"Severity"})}),(0,n.jsx)(et.Z,{style:{minWidth:"275px"},children:"Actions"})]})}),(0,n.jsx)(ei.Z,{children:a.sort((e,i)=>{if("passRate"===p)return"N/A"===e.passRate?1:"N/A"===i.passRate?-1:"asc"===m?parseFloat(e.passRate)-parseFloat(i.passRate):parseFloat(i.passRate)-parseFloat(e.passRate);if("severity"===p){if("N/A"===e.passRate)return 1;if("N/A"===i.passRate)return -1;let t={Critical:4,High:3,Medium:2,Low:1};return"asc"===m?t[e.severity]-t[i.severity]:t[i.severity]-t[e.severity]}{let t={Critical:4,High:3,Medium:2,Low:1};return e.severity===i.severity?parseFloat(e.passRate)-parseFloat(i.passRate):t[i.severity]-t[e.severity]}}).slice(s*c,s*c+c).map((e,i)=>{let t="";if("N/A"!==e.passRate){let i=parseFloat(e.passRate);t=i>=75?"pass-high":i>=50?"pass-medium":"pass-low"}return(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(et.Z,{children:(0,n.jsx)("span",{style:{fontWeight:500},children:b[e.pluginName]||e.type})}),(0,n.jsx)(et.Z,{children:e.description}),(0,n.jsxs)(et.Z,{className:t,children:[(0,n.jsx)("strong",{children:e.passRate}),e.passRateWithFilter!==e.passRate?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("br",{}),"(",e.passRateWithFilter," with mitigation)"]}):null]}),(0,n.jsx)(et.Z,{className:"vuln-".concat(e.severity.toLowerCase()),children:e.severity}),(0,n.jsxs)(et.Z,{style:{minWidth:270},children:[(0,n.jsx)(M.Z,{variant:"contained",size:"small",onClick:()=>{let i=new URLSearchParams(window.location.search),t=i.get("evalId");window.location.href="/eval/?evalId=".concat(t,"&search=").concat(encodeURIComponent("(var=".concat(e.type,"|metric=").concat(e.type,")")))},children:"View logs"}),(0,n.jsx)(R.Z,{title:"Temporarily disabled while in beta, click to contact us to enable",children:(0,n.jsx)(M.Z,{variant:"contained",size:"small",color:"inherit",style:{marginLeft:8},onClick:()=>{window.location.href="mailto:inquiries@promptfoo.dev?subject=Promptfoo%20automatic%20vulnerability%20mitigation&body=Hello%20Promptfoo%20Team,%0D%0A%0D%0AI%20am%20interested%20in%20learning%20more%20about%20the%20automatic%20vulnerability%20mitigation%20beta.%20Please%20provide%20me%20with%20more%20details.%0D%0A%0D%0A"},children:"Apply mitigation"})})]})]},i)})})]}),a.length>c&&(0,n.jsx)(en.Z,{rowsPerPageOptions:[10,25,50],component:"div",count:a.length,rowsPerPage:c,page:s,onPageChange:(e,i)=>{l(i)},onRowsPerPageChange:e=>{d(parseInt(e.target.value,10)),l(0)}})]})]})};t(67667);var em=()=>{let[e,i]=r.useState(null),[t,a]=r.useState(null);if(r.useEffect(()=>{let e=async e=>{let i=await fetch("".concat(await (0,l.b)(),"/api/results/").concat(e),{cache:"no-store"}),t=await i.json();a(t.data)},t=new URLSearchParams(window.location.search);if(!t)return;let s=t.get("evalId");s&&(i(s),e(s))},[]),r.useEffect(()=>{document.title="Report: ".concat((null==t?void 0:t.config.description)||e||"Red Team"," | promptfoo")},[t,e]),!t||!e)return(0,n.jsx)(o.Z,{sx:{width:"100%",textAlign:"center"},children:"Loading..."});let s=t.results.table.head.prompts[0],p=t.results.table.body,g=t.results.results.reduce((e,i)=>{var t,a,s,n,r,l,o,c;let d=i.vars.harmCategory,m=(null===(a=i.gradingResult)||void 0===a?void 0:null===(t=a.componentResults)||void 0===t?void 0:t.map(e=>{var i;return null===(i=e.assertion)||void 0===i?void 0:i.metric}))||[],u=[d,...m].filter(e=>e);for(let t of u){if("string"!=typeof t)continue;let a=y[t.split("/")[0]];if(!a){console.log("Unknown harm category:",t);break}i.success;let d=null===(n=i.gradingResult)||void 0===n?void 0:null===(s=n.componentResults)||void 0===s?void 0:s.some(e=>{var i;let t=(null===(i=e.assertion)||void 0===i?void 0:i.type)==="moderation",a=e.pass;return t&&a}),m=null===(l=i.gradingResult)||void 0===l?void 0:null===(r=l.componentResults)||void 0===r?void 0:r.some(e=>{var i,t;let a=(null===(i=e.assertion)||void 0===i?void 0:i.type)==="llm-rubric"||(null===(t=e.assertion)||void 0===t?void 0:t.type.startsWith("promptfoo:redteam")),s=e.pass;return a&&s}),u=null===(c=i.gradingResult)||void 0===c?void 0:null===(o=c.componentResults)||void 0===o?void 0:o.some(e=>{var i;let t=(null===(i=e.assertion)||void 0===i?void 0:i.type)==="human",a=e.pass;return t&&a});e[a]=e[a]||{pass:0,total:0,passWithFilter:0},e[a].total++,m||u?(e[a].pass++,e[a].passWithFilter++):!d&&e[a].passWithFilter++}return e},{});return(0,n.jsx)(m.Z,{children:(0,n.jsxs)(u.Z,{spacing:4,pb:8,pt:2,children:[(0,n.jsxs)(c.Z,{className:"report-header",sx:{position:"relative"},children:[(0,n.jsxs)(o.Z,{sx:{position:"absolute",top:8,right:8,display:"flex"},children:[(0,n.jsx)(L,{evalDescription:t.config.description||e}),(0,n.jsx)(q,{})]}),(0,n.jsxs)(h.Z,{variant:"h4",children:[(0,n.jsx)("strong",{children:"LLM Risk Assessment"}),t.config.description&&": ".concat(t.config.description)]}),(0,n.jsx)(h.Z,{variant:"subtitle1",mb:2,children:new Date(t.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),(0,n.jsxs)(o.Z,{className:"report-details",children:[(0,n.jsx)(d.Z,{size:"small",label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{children:"Model:"})," ",s.provider]})}),(0,n.jsx)(d.Z,{size:"small",label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{children:"Dataset:"})," ",p.length," probes"]})}),(0,n.jsx)(d.Z,{size:"small",label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{children:"Prompt:"}),' "',s.raw.length>40?"".concat(s.raw.substring(0,40),"..."):s.raw,'"']})})]})]}),(0,n.jsx)(Z,{categoryStats:g}),(0,n.jsx)(Y,{categoryStats:g}),(0,n.jsx)(ed,{evalId:e,categoryStats:g})]})})}},4309:function(){},67667:function(){},46553:function(){},32991:function(){},93091:function(){}},function(e){e.O(0,[949,799,903,916,493,304,281,969,378,476,216,944,470,730,744],function(){return e(e.s=58004)}),_N_E=e.O()}]);
|
/package/dist/src/web/nextui/_next/static/chunks/{258-53afc87c8ef7af40.js → 258-62f675217b82626c.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|