promptfoo 0.87.1 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/package.json +29 -29
- package/dist/src/__mocks__/esm.d.ts.map +1 -1
- package/dist/src/__mocks__/esm.js +1 -0
- package/dist/src/__mocks__/esm.js.map +1 -1
- package/dist/src/app/assets/index-DQ5S2Ye6.js +782 -0
- package/dist/src/app/assets/index-Dl-FhnW1.css +1 -0
- package/dist/src/app/assets/index.es-DR-0y8vm.js +18 -0
- package/dist/src/app/assets/purify.es-DGIRlouP.js +3 -0
- package/dist/src/app/assets/sync-D_jwcTYY.js +4 -0
- package/dist/src/app/favicon.png +0 -0
- package/dist/src/app/index.html +16 -0
- package/dist/src/assertions/AssertionsResult.d.ts.map +1 -1
- package/dist/src/assertions/AssertionsResult.js +7 -0
- package/dist/src/assertions/AssertionsResult.js.map +1 -1
- package/dist/src/assertions.d.ts.map +1 -1
- package/dist/src/assertions.js +19 -4
- package/dist/src/assertions.js.map +1 -1
- package/dist/src/cache.js +1 -1
- package/dist/src/cache.js.map +1 -1
- package/dist/src/commands/cache.js +2 -2
- package/dist/src/commands/cache.js.map +1 -1
- package/dist/src/commands/delete.js +2 -2
- package/dist/src/commands/delete.js.map +1 -1
- package/dist/src/commands/eval.d.ts +1 -1
- package/dist/src/commands/eval.d.ts.map +1 -1
- package/dist/src/commands/eval.js +17 -3
- package/dist/src/commands/eval.js.map +1 -1
- package/dist/src/commands/generate/dataset.js +1 -1
- package/dist/src/commands/generate/dataset.js.map +1 -1
- package/dist/src/commands/list.js +3 -3
- package/dist/src/commands/list.js.map +1 -1
- package/dist/src/commands/share.js +2 -2
- package/dist/src/commands/share.js.map +1 -1
- package/dist/src/commands/show.js +1 -1
- package/dist/src/commands/show.js.map +1 -1
- package/dist/src/commands/view.js +2 -2
- package/dist/src/commands/view.js.map +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +47 -57
- package/dist/src/config.js.map +1 -1
- package/dist/src/csv.d.ts.map +1 -1
- package/dist/src/csv.js +40 -15
- package/dist/src/csv.js.map +1 -1
- package/dist/src/database/tables.d.ts +18 -18
- package/dist/src/envars.d.ts +1 -0
- package/dist/src/envars.d.ts.map +1 -1
- package/dist/src/envars.js.map +1 -1
- package/dist/src/evaluator.d.ts.map +1 -1
- package/dist/src/evaluator.js +32 -0
- package/dist/src/evaluator.js.map +1 -1
- package/dist/src/evaluatorHelpers.js +1 -1
- package/dist/src/evaluatorHelpers.js.map +1 -1
- package/dist/src/globalConfig.js +1 -1
- package/dist/src/globalConfig.js.map +1 -1
- package/dist/src/golang/wrapper.go +53 -0
- package/dist/src/main.d.ts.map +1 -1
- package/dist/src/main.js +5 -11
- package/dist/src/main.js.map +1 -1
- package/dist/src/onboarding.d.ts +1 -1
- package/dist/src/onboarding.d.ts.map +1 -1
- package/dist/src/onboarding.js +4 -2
- package/dist/src/onboarding.js.map +1 -1
- package/dist/src/providers/ai21.d.ts.map +1 -1
- package/dist/src/providers/ai21.js +3 -12
- package/dist/src/providers/ai21.js.map +1 -1
- package/dist/src/providers/anthropic.d.ts +3 -3
- package/dist/src/providers/anthropic.d.ts.map +1 -1
- package/dist/src/providers/anthropic.js +44 -34
- package/dist/src/providers/anthropic.js.map +1 -1
- package/dist/src/providers/azureopenai.d.ts +3 -2
- package/dist/src/providers/azureopenai.d.ts.map +1 -1
- package/dist/src/providers/azureopenai.js +129 -3
- package/dist/src/providers/azureopenai.js.map +1 -1
- package/dist/src/providers/bedrock.js +2 -2
- package/dist/src/providers/bedrock.js.map +1 -1
- package/dist/src/providers/cloudflare-ai.d.ts +2 -2
- package/dist/src/providers/cloudflare-ai.d.ts.map +1 -1
- package/dist/src/providers/cloudflare-ai.js.map +1 -1
- package/dist/src/providers/cohere.js +1 -1
- package/dist/src/providers/cohere.js.map +1 -1
- package/dist/src/providers/golangCompletion.d.ts +19 -0
- package/dist/src/providers/golangCompletion.d.ts.map +1 -0
- package/dist/src/providers/golangCompletion.js +105 -0
- package/dist/src/providers/golangCompletion.js.map +1 -0
- package/dist/src/providers/http.js +1 -1
- package/dist/src/providers/http.js.map +1 -1
- package/dist/src/providers/mistral.d.ts.map +1 -1
- package/dist/src/providers/mistral.js +8 -18
- package/dist/src/providers/mistral.js.map +1 -1
- package/dist/src/providers/openai.d.ts +13 -0
- package/dist/src/providers/openai.d.ts.map +1 -1
- package/dist/src/providers/openai.js +28 -24
- package/dist/src/providers/openai.js.map +1 -1
- package/dist/src/providers/openaiUtil.d.ts.map +1 -1
- package/dist/src/providers/openaiUtil.js +1 -1
- package/dist/src/providers/openaiUtil.js.map +1 -1
- package/dist/src/providers/shared.d.ts +41 -0
- package/dist/src/providers/shared.d.ts.map +1 -1
- package/dist/src/providers/shared.js +44 -0
- package/dist/src/providers/shared.js.map +1 -1
- package/dist/src/providers/vertexUtil.js +2 -2
- package/dist/src/providers/vertexUtil.js.map +1 -1
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +5 -0
- package/dist/src/providers.js.map +1 -1
- package/dist/src/python/execAsync.d.ts +10 -0
- package/dist/src/python/execAsync.d.ts.map +1 -0
- package/dist/src/python/execAsync.js +17 -0
- package/dist/src/python/execAsync.js.map +1 -0
- package/dist/src/python/pythonUtils.d.ts +29 -0
- package/dist/src/python/pythonUtils.d.ts.map +1 -1
- package/dist/src/python/pythonUtils.js +85 -6
- package/dist/src/python/pythonUtils.js.map +1 -1
- package/dist/src/python/wrapper.d.ts.map +1 -1
- package/dist/src/python/wrapper.js +8 -5
- package/dist/src/python/wrapper.js.map +1 -1
- package/dist/src/{commands/redteam → redteam/commands}/generate.d.ts +1 -1
- package/dist/src/redteam/commands/generate.d.ts.map +1 -0
- package/dist/src/{commands/redteam → redteam/commands}/generate.js +14 -14
- package/dist/src/redteam/commands/generate.js.map +1 -0
- package/dist/src/redteam/commands/init.d.ts.map +1 -0
- package/dist/src/{commands/redteam → redteam/commands}/init.js +23 -15
- package/dist/src/redteam/commands/init.js.map +1 -0
- package/dist/src/{commands/redteam → redteam/commands}/plugins.d.ts.map +1 -1
- package/dist/src/{commands/redteam → redteam/commands}/plugins.js +1 -1
- package/dist/src/{commands/redteam → redteam/commands}/plugins.js.map +1 -1
- package/dist/src/redteam/constants.d.ts.map +1 -1
- package/dist/src/redteam/constants.js +16 -22
- package/dist/src/redteam/constants.js.map +1 -1
- package/dist/src/redteam/index.d.ts +1 -1
- package/dist/src/redteam/index.d.ts.map +1 -1
- package/dist/src/redteam/index.js.map +1 -1
- package/dist/src/redteam/providers/crescendo/index.js +2 -2
- package/dist/src/redteam/providers/crescendo/index.js.map +1 -1
- package/dist/src/redteam/providers/prompts.d.ts.map +1 -1
- package/dist/src/redteam/providers/prompts.js +23 -0
- package/dist/src/redteam/providers/prompts.js.map +1 -1
- package/dist/src/{types/redteam.d.ts → redteam/types.d.ts} +1 -1
- package/dist/src/redteam/types.d.ts.map +1 -0
- package/dist/src/{types/redteam.js → redteam/types.js} +1 -1
- package/dist/src/redteam/types.js.map +1 -0
- package/dist/src/server/server.d.ts.map +1 -1
- package/dist/src/server/server.js +10 -3
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/share.js +1 -1
- package/dist/src/share.js.map +1 -1
- package/dist/src/suggestions.js +1 -1
- package/dist/src/suggestions.js.map +1 -1
- package/dist/src/telemetry.d.ts.map +1 -1
- package/dist/src/telemetry.js +3 -1
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/testCases.d.ts.map +1 -1
- package/dist/src/testCases.js +4 -3
- package/dist/src/testCases.js.map +1 -1
- package/dist/src/types/index.d.ts +413 -231
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +12 -2
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/util/index.d.ts +19 -5
- package/dist/src/util/index.d.ts.map +1 -1
- package/dist/src/util/index.js +5 -3
- package/dist/src/util/index.js.map +1 -1
- package/dist/src/util/json.js +2 -2
- package/dist/src/util/json.js.map +1 -1
- package/dist/src/validators/prompts.d.ts +2 -2
- package/dist/src/validators/providers.d.ts +166 -20
- package/dist/src/validators/providers.d.ts.map +1 -1
- package/dist/src/validators/providers.js +5 -5
- package/dist/src/validators/providers.js.map +1 -1
- package/dist/src/validators/redteam.d.ts +15 -15
- package/dist/test/assertions.test.js +49 -0
- package/dist/test/assertions.test.js.map +1 -1
- package/dist/test/config.test.js +192 -48
- package/dist/test/config.test.js.map +1 -1
- package/dist/test/csv.test.js +84 -0
- package/dist/test/csv.test.js.map +1 -1
- package/dist/test/envars.test.js +103 -0
- package/dist/test/envars.test.js.map +1 -1
- package/dist/test/matchers.test.js +5 -5
- package/dist/test/matchers.test.js.map +1 -1
- package/dist/test/providers.anthropic.test.js +93 -23
- package/dist/test/providers.anthropic.test.js.map +1 -1
- package/dist/test/providers.azure.test.js +42 -0
- package/dist/test/providers.azure.test.js.map +1 -1
- package/dist/test/providers.bedrock.test.js +2 -1
- package/dist/test/providers.bedrock.test.js.map +1 -1
- package/dist/test/providers.shared.test.d.ts +2 -0
- package/dist/test/providers.shared.test.d.ts.map +1 -0
- package/dist/test/providers.shared.test.js +92 -0
- package/dist/test/providers.shared.test.js.map +1 -0
- package/dist/test/providers.test.js +112 -7
- package/dist/test/providers.test.js.map +1 -1
- package/dist/test/python/pythonUtils.test.d.ts +2 -0
- package/dist/test/python/pythonUtils.test.d.ts.map +1 -0
- package/dist/test/python/pythonUtils.test.js +224 -0
- package/dist/test/python/pythonUtils.test.js.map +1 -0
- package/dist/test/python/wrapper.test.d.ts +2 -0
- package/dist/test/python/wrapper.test.d.ts.map +1 -0
- package/dist/test/python/wrapper.test.js +71 -0
- package/dist/test/python/wrapper.test.js.map +1 -0
- package/dist/test/rateLimit.test.js.map +1 -1
- package/dist/test/redteam/commands/generate.test.d.ts.map +1 -0
- package/dist/test/{commands/redteam → redteam/commands}/generate.test.js +1 -1
- package/dist/test/{commands/redteam → redteam/commands}/generate.test.js.map +1 -1
- package/dist/test/redteam/validators.test.js +2 -2
- package/dist/test/redteam/validators.test.js.map +1 -1
- package/dist/test/testCases.test.js +75 -27
- package/dist/test/testCases.test.js.map +1 -1
- package/dist/test/types.test.js +17 -10
- package/dist/test/types.test.js.map +1 -1
- package/dist/test/util.test.js +10 -0
- package/dist/test/util.test.js.map +1 -1
- package/package.json +29 -29
- package/dist/src/commands/redteam/generate.d.ts.map +0 -1
- package/dist/src/commands/redteam/generate.js.map +0 -1
- package/dist/src/commands/redteam/init.d.ts.map +0 -1
- package/dist/src/commands/redteam/init.js.map +0 -1
- package/dist/src/types/redteam.d.ts.map +0 -1
- package/dist/src/types/redteam.js.map +0 -1
- package/dist/src/web/nextui/404/index.html +0 -1
- package/dist/src/web/nextui/404.html +0 -1
- package/dist/src/web/nextui/_next/static/chunks/113-c691bf7d3a37d865.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/132-d6bea93785831786.js +0 -6
- package/dist/src/web/nextui/_next/static/chunks/15.306496fdcef5f880.js +0 -52
- package/dist/src/web/nextui/_next/static/chunks/167-744b9f585d2d97f7.js +0 -54
- package/dist/src/web/nextui/_next/static/chunks/189-f9d565af9a2b91cb.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/1a53ab81-5e1a018996226f61.js +0 -6
- package/dist/src/web/nextui/_next/static/chunks/235-2bbcbc3cd37eef0f.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/285-1e2a6158b5f0e918.js +0 -32
- package/dist/src/web/nextui/_next/static/chunks/407.42b5daf65ab5dde9.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/417-cbf95fe2bc362650.js +0 -2
- package/dist/src/web/nextui/_next/static/chunks/461-77257ab6b1bb209d.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/565431e5-7b9122ac20f7a0ae.js +0 -140
- package/dist/src/web/nextui/_next/static/chunks/631-d005608c3710a99c.js +0 -6
- package/dist/src/web/nextui/_next/static/chunks/640-0f757e2fe135173d.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/646-62a1d1d5b397d18f.js +0 -28
- package/dist/src/web/nextui/_next/static/chunks/730-3eb7255cd813a727.js +0 -25
- package/dist/src/web/nextui/_next/static/chunks/782-910eb0e09b818816.js +0 -35
- package/dist/src/web/nextui/_next/static/chunks/840.58dde6630f088da4.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/854-c18aaae33bccdc36.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/86-fcb0efd0a19bac7d.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/874-66f90697795eddbc.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/88-f3a7a858d5f4e9a0.js +0 -17
- package/dist/src/web/nextui/_next/static/chunks/887.028187fb318c3e59.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/906-70c43cd62b2efac1.js +0 -97
- package/dist/src/web/nextui/_next/static/chunks/972-15d1ab608a24eebf.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/975-db84f98b8dd028ab.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/a5c829b0-07a2c92898a6780c.js +0 -14
- package/dist/src/web/nextui/_next/static/chunks/app/auth/login/page-c1dbf0abc580796f.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/page-93b80ab19bdaf2cc.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-17e6d3f57945f88a.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-dc8b4f57fd363c1b.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/page-1e54704d75f36e25.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-5295461188ef9b43.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/layout-e465aaafbfe88e82.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/page-81e3b8fee37eaf67.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/progress/page-ac2f99c11e76f5a5.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-296c32f480e84a57.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/report/page-f7c9e46492061e19.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/setup/page-35c95dd67114a045.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/b6261da7-e9d81a4364ddd0c0.js +0 -9
- package/dist/src/web/nextui/_next/static/chunks/fd57813c.8f0e3582250c76c5.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/framework-c3d480eb9ad30ba5.js +0 -25
- package/dist/src/web/nextui/_next/static/chunks/main-6b1ff2291a752212.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/main-app-0dc90092cd7acaaf.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/pages/_app-998b254a061422d4.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/pages/_error-94f0db477e27e000.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/webpack-452ae8c28379ed4c.js +0 -1
- package/dist/src/web/nextui/_next/static/css/48d388184a2f4ce3.css +0 -1
- package/dist/src/web/nextui/_next/static/css/4d76d7cdd9492e1d.css +0 -1
- package/dist/src/web/nextui/_next/static/css/8119d8bd13a8adab.css +0 -1
- package/dist/src/web/nextui/_next/static/css/87b5e6e04efd27e5.css +0 -1
- package/dist/src/web/nextui/_next/static/css/de0307797e31a3e6.css +0 -1
- package/dist/src/web/nextui/_next/static/css/eb523daddb89dfc1.css +0 -1
- package/dist/src/web/nextui/_next/static/css/edcd6f0b6c902fde.css +0 -1
- package/dist/src/web/nextui/_next/static/gtTJhFvE95U20UjbnSnMr/_buildManifest.js +0 -1
- package/dist/src/web/nextui/_next/static/gtTJhFvE95U20UjbnSnMr/_ssgManifest.js +0 -1
- package/dist/src/web/nextui/_next/static/media/26a46d62cd723877-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/55c55f0601d81cf3-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/581909926a08bbc8-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/6d93bde91c0c2823-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/97e0cb1ae144a2a9-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/a34f9d1faa5f3315-s.p.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
- package/dist/src/web/nextui/android-chrome-192x192.png +0 -0
- package/dist/src/web/nextui/android-chrome-512x512.png +0 -0
- package/dist/src/web/nextui/apple-touch-icon.png +0 -0
- package/dist/src/web/nextui/auth/callback +0 -1
- package/dist/src/web/nextui/auth/login/index.html +0 -1
- package/dist/src/web/nextui/auth/login/index.txt +0 -10
- package/dist/src/web/nextui/auth/signup/index.html +0 -1
- package/dist/src/web/nextui/auth/signup/index.txt +0 -10
- package/dist/src/web/nextui/browserconfig.xml +0 -9
- package/dist/src/web/nextui/datasets/index.html +0 -1
- package/dist/src/web/nextui/datasets/index.txt +0 -10
- package/dist/src/web/nextui/eval/index.html +0 -1
- package/dist/src/web/nextui/eval/index.txt +0 -12
- package/dist/src/web/nextui/index.html +0 -1
- package/dist/src/web/nextui/index.txt +0 -11
- package/dist/src/web/nextui/logo.svg +0 -30
- package/dist/src/web/nextui/mstile-144x144.png +0 -0
- package/dist/src/web/nextui/mstile-150x150.png +0 -0
- package/dist/src/web/nextui/mstile-310x150.png +0 -0
- package/dist/src/web/nextui/mstile-310x310.png +0 -0
- package/dist/src/web/nextui/mstile-70x70.png +0 -0
- package/dist/src/web/nextui/progress/index.html +0 -1
- package/dist/src/web/nextui/progress/index.txt +0 -10
- package/dist/src/web/nextui/prompts/index.html +0 -1
- package/dist/src/web/nextui/prompts/index.txt +0 -10
- package/dist/src/web/nextui/report/index.html +0 -1
- package/dist/src/web/nextui/report/index.txt +0 -12
- package/dist/src/web/nextui/safari-pinned-tab.svg +0 -68
- package/dist/src/web/nextui/setup/index.html +0 -1
- package/dist/src/web/nextui/setup/index.txt +0 -12
- package/dist/src/web/nextui/site.webmanifest +0 -19
- package/dist/test/commands/redteam/generate.test.d.ts.map +0 -1
- package/dist/test/pythonWrapper.test.d.ts +0 -2
- package/dist/test/pythonWrapper.test.d.ts.map +0 -1
- package/dist/test/pythonWrapper.test.js +0 -99
- package/dist/test/pythonWrapper.test.js.map +0 -1
- /package/dist/src/{web/nextui/logo-panda.svg → app/assets/logo-panda-BuYvzEyb.svg} +0 -0
- /package/dist/src/{web/nextui → app}/favicon-16x16.png +0 -0
- /package/dist/src/{web/nextui → app}/favicon-32x32.png +0 -0
- /package/dist/src/{web/nextui → app}/favicon.ico +0 -0
- /package/dist/src/{commands/redteam → redteam/commands}/init.d.ts +0 -0
- /package/dist/src/{commands/redteam → redteam/commands}/plugins.d.ts +0 -0
- /package/dist/test/{commands/redteam → redteam/commands}/generate.test.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{84173:function(e,t,r){Promise.resolve().then(r.bind(r,72403)),Promise.resolve().then(r.t.bind(r,5100,23)),Promise.resolve().then(r.t.bind(r,65246,23))},72403:function(e,t,r){"use strict";r.r(t),r.d(t,{PageShell:function(){return ee}});var n=r(24004),o=r(14978),a=r(52428),s=r(26647),i=r(14819),l=r(52653),c=r(78276),u=r(13457),h=r(38640),d=r.n(h),p=r(28891),f=r(82911),x=r(88270),g=r(89394),m=r(91797),j=r(26337),b=r(43226),v=r(21975),Z=r(42834),S=r(49050);function C(e){let{open:t,onClose:r}=e,{apiBaseUrl:a,setApiBaseUrl:s}=(0,f.Z)(),{apiShareBaseUrl:i,setApiShareBaseUrl:l,appShareBaseUrl:c,setAppShareBaseUrl:u}=(0,x.Z)(),[h,d]=(0,o.useState)(a||""),[p,C]=(0,o.useState)(i||""),[k,E]=(0,o.useState)(c||"");return(0,o.useEffect)(()=>{d(a||""),C(i||""),E(c||"")},[a,i,c]),(0,n.jsxs)(g.Z,{open:t,onClose:r,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"api-settings-dialog-title",children:[(0,n.jsx)(m.Z,{id:"api-settings-dialog-title",children:"API and Sharing Settings"}),(0,n.jsxs)(j.Z,{children:[(0,n.jsx)(b.Z,{variant:"h6",children:"API"}),(0,n.jsx)(v.Z,{label:"API Base URL",helperText:"The promptfoo API the webview will connect to",value:h,onChange:e=>{d(e.target.value)},fullWidth:!0,margin:"normal"}),(0,n.jsx)(b.Z,{variant:"h6",children:"Sharing"}),(0,n.jsx)(v.Z,{label:"API Share Base URL",helperText:'Where to send the eval when you click "Share"',value:p,onChange:e=>{C(e.target.value)},fullWidth:!0,margin:"normal"}),(0,n.jsx)(v.Z,{label:"App Share Base URL",helperText:"Set this to the App URL for the promptfoo instance you send shared evals to",value:k,onChange:e=>{E(e.target.value)},fullWidth:!0,margin:"normal"})]}),(0,n.jsxs)(Z.Z,{children:[(0,n.jsx)(S.Z,{onClick:()=>{s(h),l(p),u(k),r()},children:"Save"}),(0,n.jsx)(S.Z,{onClick:r,children:"Close"})]})]})}var k=r(39864),E=r(47028);function P(e){let{darkMode:t,onToggleDarkMode:r}=e;return(0,n.jsx)("div",{className:"dark-mode-toggle",onClick:r,children:t?(0,n.jsx)(k.Z,{}):(0,n.jsx)(E.Z,{})})}r(32854);var w=r(58715),y=r(61443),O=r(14089),I=r(68452),U=r(91018),_=r(25210);let B=[{icon:(0,n.jsx)(U.Z,{fontSize:"small"}),text:"Documentation",href:"https://www.promptfoo.dev/docs/intro"},{icon:(0,n.jsx)(I.Z,{fontSize:"small"}),text:"GitHub Repository",href:"https://github.com/promptfoo/promptfoo"},{icon:(0,n.jsx)(w.Z,{fontSize:"small"}),text:"File an Issue",href:"https://github.com/promptfoo/promptfoo/issues"},{icon:(0,n.jsx)(O.Z,{fontSize:"small"}),text:"Join Our Discord Community",href:"https://discord.gg/gHPS9jjfbs"},{icon:(0,n.jsx)(y.Z,{fontSize:"small"}),text:"Book a Meeting",href:"https://cal.com/team/promptfoo/intro"}];function F(e){let{open:t,onClose:r}=e;return(0,n.jsxs)(g.Z,{open:t,onClose:r,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"about-promptfoo-dialog-title",children:[(0,n.jsx)(m.Z,{id:"about-promptfoo-dialog-title",children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)(b.Z,{variant:"h6",children:"About Promptfoo"}),(0,n.jsx)(_.Z,{href:"https://github.com/promptfoo/promptfoo/releases",underline:"none",sx:{color:"inherit"},target:"_blank",children:(0,n.jsxs)(b.Z,{variant:"subtitle2",children:["Version ","0.87.1"]})})]})}),(0,n.jsxs)(j.Z,{children:[(0,n.jsx)(b.Z,{variant:"body2",gutterBottom:!0,children:"Promptfoo is a MIT licensed open-source tool for evaluating LLMs. We make it easy to track the performance of your models and prompts over time with automated support for dataset generation and grading."}),(0,n.jsx)(u.Z,{spacing:2,mt:2,children:B.map((e,t)=>(0,n.jsxs)(u.Z,{direction:"row",spacing:1,alignItems:"center",sx:{flexWrap:"wrap","& .MuiSvgIcon-root":{color:"text.primary"}},children:[e.icon,(0,n.jsx)(_.Z,{underline:"none",target:"_blank",href:e.href,sx:{color:"inherit"},children:(0,n.jsx)(b.Z,{variant:"body2",children:e.text})})]},t))})]}),(0,n.jsx)(Z.Z,{children:(0,n.jsx)(S.Z,{onClick:r,children:"Close"})})]})}var T=r(1445),A=r(3283),M=r(33932),N=r(74309);function W(){let{user:e,logout:t}=(0,T.aC)(),[r,a]=o.useState(null),s=()=>{a(null)},i=async()=>{null==t||t(),s()};return e?(0,n.jsxs)("div",{children:[(0,n.jsx)(l.Z,{edge:"end","aria-label":"account of current user","aria-controls":"menu-appbar","aria-haspopup":"true",onClick:e=>{a(e.currentTarget)},color:"inherit",children:(0,n.jsx)(A.Z,{sx:{width:"1em",height:"1em",bgcolor:"#1976d2"}})}),(0,n.jsxs)(M.Z,{id:"menu-appbar",anchorEl:r,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!r,onClose:s,children:[(0,n.jsxs)(N.Z,{disabled:!0,children:["Logged in as ",e.email]}),(0,n.jsx)(N.Z,{onClick:i,children:"Logout"})]})]}):(0,n.jsx)(d(),{href:"/auth/signup/",children:(0,n.jsx)(l.Z,{edge:"end","aria-label":"User not logged in","aria-controls":"menu-appbar","aria-haspopup":"true",color:"inherit",children:(0,n.jsx)(A.Z,{sx:{width:"1em",height:"1em"}})})})}var R=r(79245),L=r(47051),D=r.n(L);function z(){return(0,n.jsx)(d(),{href:"https://promptfoo.dev",passHref:!0,children:(0,n.jsxs)(R.Z,{className:"logo",component:"a",children:[(0,n.jsx)(D(),{width:25,height:25,src:"/logo-panda.svg",alt:"Promptfoo logo"})," ",(0,n.jsx)("span",{children:"promptfoo"})]})})}r(17328),r(5008);var H=r(77580);function G(e){let{href:t,label:r}=e,o=(0,p.usePathname)()||"";return(0,n.jsx)(d(),{href:t,className:o.startsWith(t)?"active":"",children:r})}function J(e){let{darkMode:t,onToggleDarkMode:r}=e,[h,d]=(0,o.useState)(!1),[p,f]=(0,o.useState)(!1),x=()=>d(e=>!e),g=()=>f(e=>!e),m=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z,{}),!H.env.NEXT_PUBLIC_NO_BROWSING&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(G,{href:"/setup",label:"New Eval"}),(0,n.jsx)(G,{href:"/eval",label:"Evals"}),(0,n.jsx)(G,{href:"/prompts",label:"Prompts"}),(0,n.jsx)(G,{href:"/datasets",label:"Datasets"}),(0,n.jsx)(G,{href:"/progress",label:"Progress"})]}),(0,n.jsxs)("div",{className:"right-aligned",children:[a.O?(0,n.jsx)(W,{}):null,(0,n.jsx)(l.Z,{onClick:x,sx:{color:"#f0f0f0"},children:(0,n.jsx)(i.Z,{})}),a.T&&(0,n.jsx)(c.Z,{title:"API and Sharing Settings",children:(0,n.jsx)(l.Z,{onClick:g,sx:{color:"#f0f0f0"},children:(0,n.jsx)(s.Z,{})})}),(0,n.jsx)(P,{darkMode:t,onToggleDarkMode:r})]})]});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(F,{open:h,onClose:x}),(0,n.jsx)(C,{open:p,onClose:g}),(0,n.jsx)(u.Z,{direction:"row",spacing:2,className:"nav",children:m})]})}var X=r(30606),V=r(33948),Y=r(42714);r(70894);let Q=e=>(0,X.Z)({typography:{fontFamily:"inherit"},palette:{mode:e?"dark":"light",background:{default:"#ffffff"}},components:{MuiCard:{styleOverrides:{root:{backgroundColor:e?"#121212":"#fff",boxShadow:e?"none":"0 2px 3px rgba(0, 0, 0, 0.1)",borderRadius:"12px"}}},MuiTableContainer:{styleOverrides:{root:{backgroundColor:e?"#121212":"#fff",boxShadow:e?"none":"0 2px 3px rgba(0, 0, 0, 0.1)",borderRadius:"12px"}}},MuiTableHead:{styleOverrides:{root:{backgroundColor:e?"#1E1E1E":"#F5F5F5"}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:"inherit",color:e?"#FFFFFF":"#000000",fontWeight:"bold"},stickyHeader:{backgroundColor:e?"#1E1E1E":"#F5F5F5"}}},MuiInputBase:{styleOverrides:{root:{backgroundColor:e?"#333":"#fff"}}}}}),q=Q(!1),K=Q(!0);function $(e){let{children:t}=e;return(0,n.jsx)("div",{children:t})}function ee(e){let{children:t}=e,r=(0,Y.Z)("(prefers-color-scheme: dark)"),[a,s]=(0,o.useState)(null);(0,o.useEffect)(()=>{let e=localStorage.getItem("darkMode");s(null===e?r:"true"===e)},[r]);let i=(0,o.useCallback)(()=>{s(e=>{let t=!e;return localStorage.setItem("darkMode",String(t)),t})},[]);return((0,o.useEffect)(()=>{null!==a&&(a?document.documentElement.setAttribute("data-theme","dark"):document.documentElement.removeAttribute("data-theme"))},[a]),null===a)?null:(0,n.jsx)(V.Z,{theme:a?K:q,children:(0,n.jsx)(T.Ho,{children:(0,n.jsxs)($,{children:[(0,n.jsx)(J,{darkMode:a,onToggleDarkMode:i}),(0,n.jsx)("div",{children:t})]})})})}},52428:function(e,t,r){"use strict";r.d(t,{O:function(){return a},T:function(){return o}});var n=r(77580);let o=!n.env.NEXT_PUBLIC_HOSTED,a=!!n.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE},82911:function(e,t,r){"use strict";var n=r(94660),o=r(74810);let a=(0,n.Ue)()((0,o.tJ)(e=>({apiBaseUrl:"",setApiBaseUrl:t=>e({apiBaseUrl:t}),fetchingPromise:null,setFetchingPromise:t=>e({fetchingPromise:t})}),{name:"api-config-storage",partialize:e=>({apiBaseUrl:e.apiBaseUrl})}));t.Z=a},88270:function(e,t,r){"use strict";r.d(t,{Y:function(){return s}});var n=r(94660),o=r(74810);let a=(0,n.Ue)()((0,o.tJ)(e=>({apiShareBaseUrl:"https://api.promptfoo.dev",setApiShareBaseUrl:t=>e({apiShareBaseUrl:t}),appShareBaseUrl:"https://app.promptfoo.dev",setAppShareBaseUrl:t=>e({appShareBaseUrl:t})}),{name:"share-config-storage"}));function s(){let{appShareBaseUrl:e}=a();return e||"".concat(window.location.protocol,"//").concat(window.location.host)}t.Z=a},1445:function(e,t,r){"use strict";r.d(t,{Ho:function(){return h},OQ:function(){return s},aC:function(){return l}});var n=r(24004),o=r(14978),a=r(12594);let s=(0,a.createClientComponentClient)(),i=(0,o.createContext)({}),l=()=>(0,o.useContext)(i),c=(e,t)=>s.auth.signInWithPassword({email:e,password:t}),u=()=>s.auth.signOut(),h=e=>{let{children:t}=e,[r,a]=(0,o.useState)(null),[l,h]=(0,o.useState)(!1),d=(0,o.useCallback)(async()=>{let{data:e}=await s.auth.refreshSession();e&&a(e.user)},[]);return(0,o.useEffect)(()=>{d();let{data:e}=s.auth.onAuthStateChange(async(e,t)=>{"PASSWORD_RECOVERY"==e?h(!1):"SIGNED_IN"===e&&t?(a(t.user),h(!0)):"SIGNED_OUT"===e&&(h(!1),a(null))});return()=>{e.subscription.unsubscribe()}},[d]),(0,n.jsx)(i.Provider,{value:{loggedIn:l,user:r,login:c,logout:u},children:t})}},32854:function(){},17328:function(){},5008:function(){},70894:function(){},5100:function(){}},function(e){e.O(0,[906,640,461,88,113,975,132,189,470,730,744],function(){return e(e.s=84173)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{5944:function(e,n,t){Promise.resolve().then(t.t.bind(t,16662,23)),Promise.resolve().then(t.t.bind(t,27924,23)),Promise.resolve().then(t.t.bind(t,30910,23)),Promise.resolve().then(t.t.bind(t,81885,23)),Promise.resolve().then(t.t.bind(t,48607,23))},81885:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(69278),t(14978);let r=t(66995);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},48607:function(){}},function(e){e.O(0,[470,730,744],function(){return e(e.s=5944)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[92],{64738:function(e,t,i){Promise.resolve().then(i.bind(i,19259))},49532:function(e,t,i){"use strict";i.d(t,{t:function(){return r}});var a=i(82911);async function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{apiBaseUrl:i}=a.Z.getState();return fetch("".concat(i,"/api").concat(e),t)}},19259:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return b}});var a=i(24004),r=i(14978),n=i(49532),s=i(52481),o=i(26972),l=i(79245),d=i(49050),c=i(33932),u=i(74309),p=i(7575),v=i(73701),m=i(39279),h=i(30666),x=i(15795),f=i(66988),Z=i(98489),g=i(95781),C=i(21975),I=i(38640),j=i.n(I);function b(){let[e,t]=(0,r.useState)([]),[i,I]=(0,r.useState)(null),[b,y]=(0,r.useState)("asc"),[P,w]=(0,r.useState)(null),[k,M]=r.useState(1),[F,S]=(0,r.useState)({evalId:"",datasetId:"",provider:"",promptId:""}),$=!!P;(0,r.useEffect)(()=>{(async()=>{let e=await (0,n.t)("/progress"),i=await e.json();i&&i.data&&t(i.data)})()},[]);let O=e=>{let t=i===e&&"asc"===b;I(e),y(t?"desc":"asc")},R=e=>(null==e?void 0:e.testPassCount)!=null&&(null==e?void 0:e.testFailCount)!=null?(e.testPassCount/(e.testPassCount+e.testFailCount)*100).toFixed(2):"-",L=e=>{var t,i,a,r,n;let s=e.map(e=>{var s,o,l,d,c,u;return[null!==(t=e.evalId)&&void 0!==t?t:"",null!==(i=null===(s=e.datasetId)||void 0===s?void 0:s.slice(0,6))&&void 0!==i?i:"",null!==(a=e.provider)&&void 0!==a?a:"",(null!==(r=null===(o=e.promptId)||void 0===o?void 0:o.slice(0,6))&&void 0!==r?r:"")+" "+(null!==(n=e.raw)&&void 0!==n?n:""),R(e.metrics),(null===(l=e.metrics)||void 0===l?void 0:l.testPassCount)==null?"-":"".concat(e.metrics.testPassCount),(null===(d=e.metrics)||void 0===d?void 0:d.testFailCount)==null?"-":"".concat(e.metrics.testFailCount),(null===(c=e.metrics)||void 0===c?void 0:c.score)==null?"-":null===(u=e.metrics.score)||void 0===u?void 0:u.toFixed(2)]});return[["Eval","Dataset","Provider","Prompt","Pass Rate %","Pass Count","Fail Count","Raw score"]].concat(s).map(e=>e.map(e=>null!=e?e:"").join(",")).join("\n")},D=t=>{let i="json"===t?JSON.stringify(e):L(e),a=new Blob([i],{type:"text/".concat(t,";charset=utf-8;")}),r=document.createElement("a");r.href=URL.createObjectURL(a),r.download="cols_export.".concat(t),r.click(),URL.revokeObjectURL(r.href),w(null)},N=r.useMemo(()=>e.filter(e=>{var t,i,a,r;return(!F.evalId||(null===(t=e.evalId)||void 0===t?void 0:t.includes(F.evalId)))&&(!F.datasetId||(null===(i=e.datasetId)||void 0===i?void 0:i.startsWith(F.datasetId)))&&(!F.provider||(null===(a=e.provider)||void 0===a?void 0:a.includes(F.provider)))&&(!F.promptId||(null===(r=e.promptId)||void 0===r?void 0:r.startsWith(F.promptId)))}),[e,F]),V=r.useMemo(()=>N.sort((e,t)=>{if(!i)return 0;if("passRate"===i){let i=Number.parseFloat(R(e.metrics)),a=Number.parseFloat(R(t.metrics));return"asc"===b?i-a:a-i}if(i in e&&i in t){let a=e[i]||"",r=t[i]||"";return"asc"===b?a.toString().localeCompare(r.toString()):r.toString().localeCompare(a.toString())}return 0}),[N,i,b]),B=r.useMemo(()=>Array.from(new Set(e.map(e=>e.evalId))),[e]),E=r.useMemo(()=>Array.from(new Set(e.map(e=>e.datasetId))),[e]),z=r.useMemo(()=>Array.from(new Set(e.map(e=>e.provider))),[e]),U=r.useMemo(()=>Array.from(new Set(e.map(e=>e.promptId))),[e]);return(0,a.jsxs)(l.Z,{paddingX:2,children:[(0,a.jsxs)(l.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,a.jsx)("h2",{children:"Progress summary"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(d.Z,{id:"export-button","aria-controls":$?"export-menu":void 0,"aria-haspopup":"true","aria-expanded":$?"true":void 0,onClick:e=>{w(e.currentTarget)},startIcon:(0,a.jsx)(s.Z,{}),children:"Export"}),(0,a.jsxs)(c.Z,{id:"export-menu",anchorEl:P,open:$,onClose:()=>{w(null)},MenuListProps:{"aria-labelledby":"export-button"},children:[(0,a.jsx)(u.Z,{onClick:()=>D("csv"),children:"CSV"}),(0,a.jsx)(u.Z,{onClick:()=>D("json"),children:"JSON"})]})]})]}),(0,a.jsx)(l.Z,{children:"This page shows performance metrics for recent evals."}),(0,a.jsxs)(l.Z,{display:"flex",flexDirection:"row",gap:2,my:2,children:[(0,a.jsx)(o.Z,{options:B,value:F.evalId,onChange:(e,t)=>{S({...F,evalId:t||""})},renderInput:e=>(0,a.jsx)(C.Z,{...e,label:"Eval ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:E,value:F.datasetId,onChange:(e,t)=>{S({...F,datasetId:t||""})},renderInput:e=>(0,a.jsx)(C.Z,{...e,label:"Dataset ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:z,value:F.provider,onChange:(e,t)=>{S({...F,provider:t||""})},renderInput:e=>(0,a.jsx)(C.Z,{...e,label:"Provider",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,a.jsx)(o.Z,{options:U,value:F.promptId,onChange:(e,t)=>{S({...F,promptId:t||""})},renderInput:e=>(0,a.jsx)(C.Z,{...e,label:"Prompt ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(f.Z,{children:(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(h.Z,{children:(0,a.jsx)(g.Z,{active:"evalId"===i,direction:"evalId"===i?b:"asc",onClick:()=>O("evalId"),children:"Eval"})}),(0,a.jsx)(h.Z,{children:"Dataset"}),(0,a.jsx)(h.Z,{children:"Provider"}),(0,a.jsx)(h.Z,{children:"Prompt"}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(g.Z,{active:"passRate"===i,direction:"passRate"===i?b:"asc",onClick:()=>O("passRate"),children:"Pass Rate %"})}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(g.Z,{active:"testPassCount"===i,direction:"testPassCount"===i?b:"asc",onClick:()=>O("testPassCount"),children:"Pass Count"})}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(g.Z,{active:"testFailCount"===i,direction:"testFailCount"===i?b:"asc",onClick:()=>O("testFailCount"),children:"Fail Count"})}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(g.Z,{active:"score"===i,direction:"score"===i?b:"asc",onClick:()=>O("score"),children:"Raw score"})})]})}),(0,a.jsx)(m.Z,{children:V.slice((k-1)*25,25*k).map((e,t)=>{var i,r,n,s,o,l;return(0,a.jsxs)(Z.Z,{hover:!0,onClick:()=>S({...F,evalId:e.evalId,datasetId:e.datasetId||"",promptId:e.promptId||"",provider:e.provider}),children:[(0,a.jsx)(h.Z,{children:(0,a.jsx)(j(),{href:"/eval?evalId=".concat(e.evalId),onClick:e=>e.stopPropagation(),children:e.evalId})}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(j(),{href:"/datasets?id=".concat(e.datasetId),onClick:e=>e.stopPropagation(),children:null===(i=e.datasetId)||void 0===i?void 0:i.slice(0,6)})}),(0,a.jsx)(h.Z,{children:e.provider}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(j(),{href:"/prompts?id=".concat(e.promptId),onClick:e=>e.stopPropagation(),children:["[",null===(r=e.promptId)||void 0===r?void 0:r.slice(0,6),"]"]})," ",e.raw]}),(0,a.jsx)(h.Z,{children:R(e.metrics)}),(0,a.jsx)(h.Z,{children:(null===(n=e.metrics)||void 0===n?void 0:n.testPassCount)==null?"-":"".concat(e.metrics.testPassCount)}),(0,a.jsx)(h.Z,{children:(null===(s=e.metrics)||void 0===s?void 0:s.testFailCount)==null?"-":"".concat(e.metrics.testFailCount)}),(0,a.jsx)(h.Z,{children:(null===(o=e.metrics)||void 0===o?void 0:o.score)==null?"-":null===(l=e.metrics.score)||void 0===l?void 0:l.toFixed(2)})]},t)})})]}),Math.ceil(N.length/25)>1&&(0,a.jsx)(p.Z,{count:Math.ceil(V.length/25),page:k,onChange:(e,t)=>M(t),sx:{pt:2,pb:4,display:"flex",justifyContent:"center"}})]})]})}},82911:function(e,t,i){"use strict";var a=i(94660),r=i(74810);let n=(0,a.Ue)()((0,r.tJ)(e=>({apiBaseUrl:"",setApiBaseUrl:t=>e({apiBaseUrl:t}),fetchingPromise:null,setFetchingPromise:t=>e({fetchingPromise:t})}),{name:"api-config-storage",partialize:e=>({apiBaseUrl:e.apiBaseUrl})}));t.Z=n},52481:function(e,t,i){"use strict";var a=i(71851);t.Z=void 0;var r=a(i(80984)),n=i(24004);t.Z=(0,r.default)((0,n.jsx)("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}),"Download")},55563:function(e,t,i){"use strict";i.d(t,{V:function(){return n}});var a=i(26520),r=i(25702);function n(e){return(0,r.ZP)("MuiDivider",e)}let s=(0,a.Z)("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);t.Z=s},78342:function(e,t,i){"use strict";i.d(t,{f:function(){return n}});var a=i(26520),r=i(25702);function n(e){return(0,r.ZP)("MuiListItemIcon",e)}let s=(0,a.Z)("MuiListItemIcon",["root","alignItemsFlexStart"]);t.Z=s},69660:function(e,t,i){"use strict";i.d(t,{L:function(){return n}});var a=i(26520),r=i(25702);function n(e){return(0,r.ZP)("MuiListItemText",e)}let s=(0,a.Z)("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);t.Z=s},74309:function(e,t,i){"use strict";i.d(t,{Z:function(){return M}});var a=i(94312),r=i(79042),n=i(14978),s=i(53468),o=i(95600),l=i(24871),d=i(35843),c=i(22630),u=i(19996),p=i(77820),v=i(84008),m=i(88519),h=i(37663),x=i(55563),f=i(78342),Z=i(69660),g=i(26520),C=i(25702);function I(e){return(0,C.ZP)("MuiMenuItem",e)}let j=(0,g.Z)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var b=i(24004);let y=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],P=e=>{let{disabled:t,dense:i,divider:a,disableGutters:n,selected:s,classes:l}=e,d=(0,o.Z)({root:["root",i&&"dense",t&&"disabled",!n&&"gutters",a&&"divider",s&&"selected"]},I,l);return(0,r.Z)({},l,d)},w=(0,d.ZP)(v.Z,{shouldForwardProp:e=>(0,c.Z)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:i}=e;return[t.root,i.dense&&t.dense,i.divider&&t.divider,!i.disableGutters&&t.gutters]}})(({theme:e,ownerState:t})=>(0,r.Z)({},e.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!t.disableGutters&&{paddingLeft:16,paddingRight:16},t.divider&&{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${j.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${j.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${j.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${j.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${j.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${x.Z.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${x.Z.inset}`]:{marginLeft:52},[`& .${Z.Z.root}`]:{marginTop:0,marginBottom:0},[`& .${Z.Z.inset}`]:{paddingLeft:36},[`& .${f.Z.root}`]:{minWidth:36}},!t.dense&&{[e.breakpoints.up("sm")]:{minHeight:"auto"}},t.dense&&(0,r.Z)({minHeight:32,paddingTop:4,paddingBottom:4},e.typography.body2,{[`& .${f.Z.root} svg`]:{fontSize:"1.25rem"}}))),k=n.forwardRef(function(e,t){let i;let o=(0,u.i)({props:e,name:"MuiMenuItem"}),{autoFocus:l=!1,component:d="li",dense:c=!1,divider:v=!1,disableGutters:x=!1,focusVisibleClassName:f,role:Z="menuitem",tabIndex:g,className:C}=o,I=(0,a.Z)(o,y),j=n.useContext(p.Z),k=n.useMemo(()=>({dense:c||j.dense||!1,disableGutters:x}),[j.dense,c,x]),M=n.useRef(null);(0,m.Z)(()=>{l&&M.current&&M.current.focus()},[l]);let F=(0,r.Z)({},o,{dense:k.dense,divider:v,disableGutters:x}),S=P(o),$=(0,h.Z)(M,t);return o.disabled||(i=void 0!==g?g:-1),(0,b.jsx)(p.Z.Provider,{value:k,children:(0,b.jsx)(w,(0,r.Z)({ref:$,role:Z,tabIndex:i,component:d,focusVisibleClassName:(0,s.Z)(S.focusVisible,f),className:(0,s.Z)(S.root,C)},I,{ownerState:F,classes:S}))})});var M=k}},function(e){e.O(0,[906,640,461,88,975,417,874,854,972,470,730,744],function(){return e(e.s=64738)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[794],{9458:function(e,t,i){Promise.resolve().then(i.bind(i,73730))},49532:function(e,t,i){"use strict";i.d(t,{t:function(){return n}});var s=i(82911);async function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{apiBaseUrl:i}=s.Z.getState();return fetch("".concat(i,"/api").concat(e),t)}},73730:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return I}});var s=i(24004),n=i(14978),l=i(49532),r=i(79245),c=i(7575),a=i(73701),d=i(39279),o=i(30666),h=i(15795),u=i(66988),x=i(98489),j=i(95781),Z=i(78276),v=i(38640),p=i.n(v),f=i(28891),m=i(49050),w=i(89394),g=i(42834),y=i(26337),C=i(91797),P=i(64748),k=i(43226),E=e=>{var t;let{openDialog:i,handleClose:n,selectedPrompt:l}=e;return(0,s.jsxs)(w.Z,{open:i,onClose:n,fullWidth:!0,maxWidth:"lg",children:[(0,s.jsxs)(C.Z,{children:["Prompt ",l.id.slice(0,6)]}),(0,s.jsxs)(y.Z,{children:[(0,s.jsx)(k.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Prompt"}),(0,s.jsx)(P.Z,{readOnly:!0,value:null==l?void 0:null===(t=l.prompt)||void 0===t?void 0:t.raw,style:{width:"100%",padding:"0.75rem"},maxRows:50}),(0,s.jsx)(k.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,s.jsxs)(a.Z,{children:[(0,s.jsx)(u.Z,{children:(0,s.jsxs)(x.Z,{children:[(0,s.jsx)(o.Z,{children:"Eval ID"}),(0,s.jsx)(o.Z,{children:"Dataset ID"}),(0,s.jsx)(o.Z,{children:"Raw score"}),(0,s.jsx)(o.Z,{children:"Pass rate"}),(0,s.jsx)(o.Z,{children:"Pass count"}),(0,s.jsx)(o.Z,{children:"Fail count"})]})}),(0,s.jsx)(d.Z,{children:null==l?void 0:l.evals.sort((e,t)=>t.id.localeCompare(e.id)).map(e=>{var t,i,n,l,r,c,a;let d=null!==(r=null===(t=e.metrics)||void 0===t?void 0:t.testPassCount)&&void 0!==r?r:0,h=null!==(c=null===(i=e.metrics)||void 0===i?void 0:i.testFailCount)&&void 0!==c?c:0,u=d+h>0?(d/(d+h)*100).toFixed(2)+"%":"-";return(0,s.jsxs)(x.Z,{children:[(0,s.jsx)(o.Z,{children:(0,s.jsx)(p(),{href:"/eval/?evalId=".concat(e.id),children:e.id})}),(0,s.jsx)(o.Z,{children:(0,s.jsx)(p(),{href:"/datasets/?id=".concat(e.datasetId),children:e.datasetId.slice(0,6)})}),(0,s.jsx)(o.Z,{children:null!==(a=null===(l=e.metrics)||void 0===l?void 0:null===(n=l.score)||void 0===n?void 0:n.toFixed(2))&&void 0!==a?a:"-"}),(0,s.jsx)(o.Z,{children:u}),(0,s.jsx)(o.Z,{children:d}),(0,s.jsx)(o.Z,{children:h})]},"eval-".concat(e.id))})})]})]}),(0,s.jsx)(g.Z,{children:(0,s.jsx)(m.Z,{onClick:n,children:"Close"})})]})};function I(){let e=(0,f.useSearchParams)(),[t,i]=(0,n.useState)([]),[v,m]=(0,n.useState)("date"),[w,g]=(0,n.useState)("desc"),[y,C]=(0,n.useState)(1),[P,k]=(0,n.useState)(!1),[I,S]=(0,n.useState)(0),D=e=>{let t=v===e&&"asc"===w?"desc":"asc";m(e),g(t)};(0,n.useEffect)(()=>{(async()=>{let e=await (0,l.t)("/prompts"),t=await e.json();if(t&&t.data){let e=[...t.data].sort((e,t)=>null===v?0:"asc"===w?e[v]>t[v]?1:-1:e[v]<t[v]?1:-1);i(e)}})()},[v,w]);let U=e=>{k(!0),S(e)};return(0,n.useEffect)(()=>{let i=null==e?void 0:e.get("id");if(i){let e=t.findIndex(e=>e.id.startsWith(i));-1!==e&&U(e)}},[t,e]),(0,s.jsx)(r.Z,{paddingX:2,children:(0,s.jsxs)(h.Z,{children:[(0,s.jsxs)(a.Z,{children:[(0,s.jsx)(u.Z,{children:(0,s.jsxs)(x.Z,{children:[(0,s.jsx)(o.Z,{style:{width:"10%"},children:"ID"}),(0,s.jsx)(o.Z,{style:{width:"60%"},children:(0,s.jsx)(j.Z,{active:"raw"===v,direction:"raw"===v?w:"asc",onClick:()=>D("raw"),children:"Prompt"})}),(0,s.jsx)(o.Z,{style:{width:"20%"},children:(0,s.jsx)(Z.Z,{title:"The date of the most recent eval for this prompt",children:(0,s.jsx)(j.Z,{active:"date"===v,direction:"date"===v?w:"asc",onClick:()=>D("date"),children:"Most recent eval"})})}),(0,s.jsx)(o.Z,{style:{width:"10%"},children:(0,s.jsx)(j.Z,{active:"count"===v,direction:"count"===v?w:"asc",onClick:()=>D("count"),children:"# Evals"})})]})}),(0,s.jsx)(d.Z,{children:t.slice((y-1)*10,10*y).map((e,t)=>(0,s.jsxs)(x.Z,{hover:!0,children:[(0,s.jsx)(o.Z,{style:{width:"10%"},children:e.id.slice(0,6)}),(0,s.jsx)(o.Z,{style:{width:"60%",whiteSpace:"pre-wrap",cursor:"pointer"},onClick:()=>U(t),children:e.prompt.raw.length>500?e.prompt.raw.slice(0,500)+"...":e.prompt.raw}),(0,s.jsx)(o.Z,{style:{width:"20%"},children:e.recentEvalDate?(0,s.jsx)(p(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalDate}):"Unknown"}),(0,s.jsx)(o.Z,{style:{width:"10%"},children:e.count})]},t))})]}),Math.ceil(t.length/10)>1&&(0,s.jsx)(c.Z,{count:Math.ceil(t.length/10),page:y,onChange:(e,t)=>C(t)}),t[I]&&(0,s.jsx)(E,{openDialog:P,handleClose:()=>{k(!1)},selectedPrompt:t[I]})]})})}},82911:function(e,t,i){"use strict";var s=i(94660),n=i(74810);let l=(0,s.Ue)()((0,n.tJ)(e=>({apiBaseUrl:"",setApiBaseUrl:t=>e({apiBaseUrl:t}),fetchingPromise:null,setFetchingPromise:t=>e({fetchingPromise:t})}),{name:"api-config-storage",partialize:e=>({apiBaseUrl:e.apiBaseUrl})}));t.Z=l},28891:function(e,t,i){e.exports=i(98556)}},function(e){e.O(0,[906,640,88,113,417,854,470,730,744],function(){return e(e.s=9458)}),_N_E=e.O()}]);
|
|
@@ -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,56129))},49532:function(e,i,t){"use strict";t.d(i,{t:function(){return s}});var a=t(82911);async function s(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{apiBaseUrl:t}=a.Z.getState();return fetch("".concat(t,"/api").concat(e),i)}},56129:function(e,i,t){"use strict";t.r(i),t.d(i,{default:function(){return eS}});var a,s,r=t(24004),n=t(14978),l=t(49532),o=t(79245),c=t(15133),u=t(47827),m=t(88938),d=t(35266),p=t(80356),h=t(38212),g=t(49658),f=t(13457),v=t(43226),x=t(70740),j=t(14565),y=t(48727),b=t(81344),Z=t(88469),w=t(28874),k=t(52653),C=t(8864);let R={"Security Risk":["bola","bfla","debug-access","hijacking","pii","prompt-extraction","rbac","shell-injection","sql-injection","ssrf","indirect-prompt-injection"],"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"],"Brand Risk":["policy","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"]},P={"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 S={"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,policy:s.High,bola:s.High,bfla:s.High,ssrf:s.High,"indirect-prompt-injection":s.High,"prompt-extraction":s.Medium},A=Object.entries(R).reduce((e,i)=>{let[t,a]=i;return a.forEach(i=>{e[i]=t}),e},{});Object.keys(A);let I={bola:"BOLAEnforcement",bfla:"BFLAEnforcement",ssrf:"SSRFEnforcement","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",policy:"PolicyViolation","indirect-prompt-injection":"IndirectPromptInjection","prompt-extraction":"PromptExtraction"},N=Object.entries(I).reduce((e,i)=>{let[t,a]=i;return e[a]=t,e},{}),F={"debug-access":"Debug Access","excessive-agency":"Excessive Agency","harmful:copyright-violations":"Copyright Violations","harmful:cybercrime":"Cybercrime","harmful:illegal-activities":"Illegal Activities","harmful:misinformation-disinformation":"Misinformation & disinformation","harmful:specialized-advice":"Specialized Advice","indirect-prompt-injection":"Indirect Prompt Injection","jailbreak:tree":"Tree-based optimization","prompt-extraction":"Prompt Extraction","prompt-injection":"Prompt Injection","shell-injection":"Shell Injection","sql-injection":"SQL Injection",basic:"Basic",bfla:"Privilege Escalation",bola:"Unauthorized Data Access",competitors:"Competitor Endorsements",contracts:"Unsupervised Contracts",crescendo:"Multi-turn",jailbreak:"Single-shot optimization",multilingual:"Multilingual",pii:"PII Leaks",policy:"Custom Policy",politics:"Political Opinions",rbac:"RBAC Enforcement",ssrf:"Malicious Resource Fetching"},M={default:"Includes common plugins",basic:"Raw attacks without any special attack strategies","ascii-smuggling":"Attempts to obfuscate malicious content using ASCII smuggling","cross-session-leak":"Checks for information sharing between unrelated sessions",multilingual:"Translates the input into low-resource languages",bola:"Broken Object Level Authorization (BOLA) tests",bfla:"Broken Function Level Authorization (BFLA) tests",ssrf:"Server-Side Request Forgery (SSRF) tests","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":"Tree-based jailbreak search","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",crescendo:"Conversational attack strategy","prompt-extraction":"Attempts to get the model to reveal its system prompt","indirect-prompt-injection":"Evaluates how susceptible the prompt is to harmful instructions injected into the prompt"},L={"owasp:llm:01":{plugins:["harmful"],strategies:["prompt-injection","jailbreak"]},"owasp:llm:02":{plugins:["harmful","overreliance"],strategies:[]},"owasp:llm:03":{plugins:["harmful","overreliance","hallucination"],strategies:[]},"owasp:llm:06":{plugins:["harmful:privacy","pii:direct","pii:api-db","pii:session","pii:social"],strategies:["prompt-injection","jailbreak"]},"owasp:llm:07":{plugins:["rbac","bola","bfla","sql-injection","shell-injection","debug-access"],strategies:[]},"owasp:llm:08":{plugins:["excessive-agency","rbac"],strategies:[]},"owasp:llm:09":{plugins:["overreliance","hallucination"],strategies:[]}},H={"owasp:api:01":{plugins:["bola","rbac"],strategies:[]},"owasp:api:02":{plugins:["bfla","rbac"],strategies:[]},"owasp:api:03":{plugins:["excessive-agency","overreliance"],strategies:[]},"owasp:api:04":{plugins:["harmful:privacy","pii:api-db","pii:session"],strategies:[]},"owasp:api:05":{plugins:["rbac","bola","bfla"],strategies:[]},"owasp:api:06":{plugins:["harmful:misinformation-disinformation","overreliance"],strategies:[]},"owasp:api:07":{plugins:["sql-injection","shell-injection"],strategies:[]},"owasp:api:08":{plugins:["harmful:privacy","pii:api-db","pii:session"],strategies:[]},"owasp:api:09":{plugins:["overreliance","harmful:specialized-advice"],strategies:[]},"owasp:api:10":{plugins:["debug-access","harmful:privacy"],strategies:[]}},O={"nist:ai:measure:1.1":{plugins:["harmful:misinformation-disinformation","overreliance","excessive-agency"],strategies:["jailbreak","prompt-injection"]},"nist:ai:measure:1.2":{plugins:["harmful:misinformation-disinformation","overreliance","excessive-agency"],strategies:["jailbreak","prompt-injection"]},"nist:ai:measure:2.1":{plugins:["harmful:privacy","pii:api-db","pii:session","pii:direct","pii:social"],strategies:[]},"nist:ai:measure:2.2":{plugins:["harmful:privacy","pii:api-db","pii:session","pii:direct","pii:social"],strategies:[]},"nist:ai:measure:2.3":{plugins:["overreliance","excessive-agency"],strategies:[]},"nist:ai:measure:2.4":{plugins:["overreliance","excessive-agency","harmful:misinformation-disinformation"],strategies:["jailbreak","prompt-injection"]},"nist:ai:measure:2.5":{plugins:["overreliance","excessive-agency"],strategies:[]},"nist:ai:measure:2.6":{plugins:["harmful:unsafe-practices","harmful:chemical-biological-weapons","harmful:indiscriminate-weapons"],strategies:[]},"nist:ai:measure:2.7":{plugins:["harmful:cybercrime","sql-injection","shell-injection"],strategies:["jailbreak","prompt-injection"]},"nist:ai:measure:2.8":{plugins:["rbac","bola","bfla"],strategies:[]},"nist:ai:measure:2.9":{plugins:["overreliance","excessive-agency"],strategies:[]},"nist:ai:measure:2.10":{plugins:["harmful:privacy","pii:api-db","pii:session","pii:direct","pii:social"],strategies:[]},"nist:ai:measure:2.11":{plugins:["harmful:hate","harmful:harassment-bullying","harmful:insults"],strategies:[]},"nist:ai:measure:2.12":{plugins:[],strategies:[]},"nist:ai:measure:2.13":{plugins:["overreliance","excessive-agency"],strategies:[]},"nist:ai:measure:3.1":{plugins:["overreliance","excessive-agency","harmful:misinformation-disinformation"],strategies:["jailbreak","prompt-injection"]},"nist:ai:measure:3.2":{plugins:["overreliance","excessive-agency"],strategies:[]},"nist:ai:measure:3.3":{plugins:["overreliance","excessive-agency"],strategies:[]},"nist:ai:measure:4.1":{plugins:["overreliance","excessive-agency"],strategies:[]},"nist:ai:measure:4.2":{plugins:["overreliance","excessive-agency","harmful:misinformation-disinformation"],strategies:[]},"nist:ai:measure:4.3":{plugins:["overreliance","excessive-agency"],strategies:[]}},z={"mitre:atlas:reconnaissance":{plugins:["competitors","policy","rbac","prompt-extraction"],strategies:["multilingual"]},"mitre:atlas:resource-development":{plugins:["harmful:cybercrime","harmful:illegal-drugs","harmful:indiscriminate-weapons"],strategies:[]},"mitre:atlas:initial-access":{plugins:["harmful:cybercrime","sql-injection","shell-injection","ssrf","debug-access"],strategies:["jailbreak","prompt-injection","base64","leetspeak","rot13"]},"mitre:atlas:ml-attack-staging":{plugins:["overreliance","excessive-agency","hallucination","ascii-smuggling","indirect-prompt-injection"],strategies:["jailbreak","jailbreak:tree"]},"mitre:atlas:exfiltration":{plugins:["harmful:privacy","pii:api-db","pii:session","pii:direct","pii:social","indirect-prompt-injection","prompt-extraction","ascii-smuggling"],strategies:[]},"mitre:atlas:impact":{plugins:["harmful","overreliance","excessive-agency","hijacking","imitation","politics"],strategies:["crescendo"]}};[...Object.keys(L),...Object.keys(H),...Object.keys(O),...Object.keys(z)];let B={"nist:ai:measure":O,"owasp:llm":L,"owasp:api":H,"mitre:atlas":z},E={"nist:ai:measure":"NIST AI RMF","owasp:llm":"OWASP LLM Top 10","owasp:api":"OWASP API Top 10"};var T=t(37204),W=t(94660),D=t(74810);let U={getItem:async e=>await (0,T.U2)(e)||null,setItem:async(e,i)=>{await (0,T.t8)(e,i)},removeItem:async e=>{await (0,T.IV)(e)}},q=(0,W.Ue)()((0,D.tJ)(e=>({showPercentagesOnRiskCards:!1,setShowPercentagesOnRiskCards:i=>e(()=>({showPercentagesOnRiskCards:i})),pluginPassRateThreshold:1,setPluginPassRateThreshold:i=>e(()=>({pluginPassRateThreshold:i})),showComplianceSection:!1,setShowComplianceSection:i=>e(()=>({showComplianceSection:i}))}),{name:"ReportViewStorage",storage:(0,D.FL)(()=>U)}));t(59598);var V=e=>{let{categoryStats:i,strategyStats:t}=e,{pluginPassRateThreshold:a,showComplianceSection:s}=q(),[l,u]=(0,n.useState)({}),m=n.useCallback(e=>{let s=B[e];return s?Array.from(new Set(Object.entries(s).flatMap(e=>{let[s,{plugins:r,strategies:n}]=e,l=[...r,...n].filter(e=>{let s=i[e]||t[e];return s&&s.total>0&&s.pass/s.total<a});return l}))):[]},[i,t,a]),g=n.useMemo(()=>Object.entries(B).reduce((e,i)=>{let[t,a]=i,s=m(t);return e[t]=0===s.length,e},{}),[m]),f=Object.keys(g).length,R=Object.values(g).filter(Boolean).length,P=e=>{u(i=>({...i,[e]:!i[e]}))};return s?(0,r.jsx)(c.Z,{className:"framework-compliance-card",children:(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(v.Z,{variant:"h6",mb:2,children:["Framework Compliance (",R,"/",f,")"]}),(0,r.jsx)(w.ZP,{container:!0,spacing:3,className:"framework-grid",children:Object.entries(g).map(e=>{let[i,t]=e,a=m(i),s=l[i];return(0,r.jsx)(w.ZP,{item:!0,xs:12,sm:6,md:4,children:(0,r.jsx)(c.Z,{className:"framework-item ".concat(t?"compliant":"non-compliant"),children:(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(o.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1,children:[(0,r.jsx)(v.Z,{variant:"h6",children:E[i]}),t?(0,r.jsx)(j.Z,{className:"icon-compliant"}):(0,r.jsx)(x.Z,{className:"icon-non-compliant"})]}),!t&&(0,r.jsxs)(o.Z,{children:[(0,r.jsxs)(o.Z,{display:"flex",alignItems:"center",mb:1,onClick:()=>P(i),style:{cursor:"pointer"},children:[(0,r.jsxs)(v.Z,{variant:"body2",fontWeight:"bold",children:["Non-compliant plugins: ",a.length]}),(0,r.jsx)(k.Z,{size:"small",children:s?(0,r.jsx)(y.Z,{}):(0,r.jsx)(b.Z,{})})]}),s&&(0,r.jsx)(d.Z,{dense:!0,children:a.map(e=>(0,r.jsxs)(p.ZP,{children:[(0,r.jsx)(C.Z,{children:(0,r.jsx)(x.Z,{fontSize:"small",color:"error"})}),(0,r.jsx)(h.Z,{primary:e})]},e))})]})]})})},i)})})]})}):null};t(4309);var _=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)=>S[i]===t?e+1:e,0),e),{});return(0,r.jsx)(f.Z,{spacing:2,direction:{xs:"column",sm:"row"},children:t.map(e=>(0,r.jsx)(o.Z,{flex:1,children:(0,r.jsx)(c.Z,{className:"severity-card card-".concat(e.toLowerCase()),children:(0,r.jsxs)(Z.Z,{onClick:()=>window.location.hash="#table",children:[(0,r.jsx)(v.Z,{variant:"h6",gutterBottom:!0,children:e}),(0,r.jsx)(v.Z,{variant:"h4",color:"text.primary",children:a[e]}),(0,r.jsx)(v.Z,{variant:"body2",color:"text.secondary",children:"issues"})]})})},e))})},J=t(52481),G=t(6882),K=t(78276),Q=t(35193),Y=t.n(Q),$=t(21629),X=e=>{let{evalDescription:i}=e,[t,a]=(0,n.useState)(!1),[s,l]=(0,n.useState)(!1),o=async()=>{a(!0),setTimeout(async()=>{let e=document.documentElement,t=await Y()(e,{height:Math.max(e.scrollHeight,e.offsetHeight),windowHeight:document.documentElement.scrollHeight}),s=t.toDataURL("image/png"),r=new $.ZP("p","pt",[t.width,t.height]);r.addImage(s,"PNG",0,0,t.width,t.height);let n=i?"report_".concat(i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),".pdf"):"report.pdf";r.save(n),a(!1)},100)};return(0,r.jsx)(K.Z,{title:"Download report as PDF",placement:"top",open:s&&!t,children:(0,r.jsx)(k.Z,{onClick:o,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),sx:{mt:"4px",position:"relative"},"aria-label":"download report",disabled:t,children:t?(0,r.jsx)(G.Z,{size:20}):(0,r.jsx)(J.Z,{})})})},ee=t(93295),ei=t(49050),et=t(89394),ea=t(42834),es=t(26337),er=t(91797),en=t(4451),el=()=>{let{showPercentagesOnRiskCards:e,setShowPercentagesOnRiskCards:i,pluginPassRateThreshold:t,setPluginPassRateThreshold:a,showComplianceSection:s,setShowComplianceSection:l}=q(),[o,c]=n.useState(!1),u=()=>{c(!1)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z,{title:"Report Settings",placement:"top",children:(0,r.jsx)(k.Z,{onClick:()=>{c(!0)},"aria-label":"settings",children:(0,r.jsx)(ee.Z,{})})}),(0,r.jsxs)(et.Z,{open:o,onClose:u,fullWidth:!0,maxWidth:"sm",children:[(0,r.jsx)(er.Z,{children:"Report Settings"}),(0,r.jsxs)(es.Z,{children:[(0,r.jsx)(v.Z,{component:"div",sx:{padding:"16px 0"},children:(0,r.jsxs)("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[(0,r.jsx)("input",{type:"checkbox",checked:s,onChange:e=>l(e.target.checked),style:{marginRight:"10px"}}),"Show compliance section (NIST, OWASP)"]})}),(0,r.jsx)(v.Z,{component:"div",sx:{padding:"16px 0"},children:(0,r.jsxs)("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[(0,r.jsx)("input",{type:"checkbox",checked:e,onChange:e=>i(e.target.checked),style:{marginRight:"10px"}}),"Show percentages on risk cards"]})}),(0,r.jsxs)(v.Z,{component:"div",sx:{padding:"16px 0"},children:[(0,r.jsxs)("label",{children:["Plugin Pass Rate Threshold: ",(100*t).toFixed(0),"%"]}),(0,r.jsx)(v.Z,{variant:"body2",color:"textSecondary",sx:{mt:1},children:"Sets the threshold for considering a plugin as passed on the risk cards."}),(0,r.jsx)(en.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,r.jsx)(ea.Z,{children:(0,r.jsx)(ei.Z,{onClick:u,variant:"contained",color:"primary",children:"Close"})})]})]})},eo=t(48670),ec=t(64111);t(11674);var eu=e=>{let{open:i,onClose:t,category:a,failures:s,evalId:n,numPassed:l,numFailed:c}=e,u=I[a];if(!u)return console.error("[RiskCategoryDrawer] Could not load category",a),null;let m=F[a]||u,h=l+c,g=h>0?Math.round(l/h*100):0;return 0===h?(0,r.jsx)(ec.ZP,{anchor:"right",open:i,onClose:t,children:(0,r.jsxs)(o.Z,{sx:{width:500,p:2},className:"risk-category-drawer",children:[(0,r.jsx)(v.Z,{variant:"h6",gutterBottom:!0,children:m}),(0,r.jsx)(v.Z,{variant:"body1",sx:{mt:2,textAlign:"center"},children:"No tests have been run for this category."})]})}):(0,r.jsx)(ec.ZP,{anchor:"right",open:i,onClose:t,children:(0,r.jsxs)(o.Z,{sx:{width:500,p:2},className:"risk-category-drawer",children:[(0,r.jsx)(v.Z,{variant:"h6",gutterBottom:!0,children:m}),(0,r.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,r.jsxs)(o.Z,{sx:{textAlign:"center",flex:1},children:[(0,r.jsx)(v.Z,{variant:"h4",color:"primary",children:l.toString()}),(0,r.jsx)(v.Z,{variant:"body2",children:"Passed"})]}),(0,r.jsxs)(o.Z,{sx:{textAlign:"center",flex:1},children:[(0,r.jsx)(v.Z,{variant:"h4",children:h.toString()}),(0,r.jsx)(v.Z,{variant:"body2",children:"Total"})]}),(0,r.jsxs)(o.Z,{sx:{textAlign:"center",flex:1},children:[(0,r.jsx)(v.Z,{variant:"h4",color:g>=70?"success.main":"error.main",children:"".concat(g,"%")}),(0,r.jsx)(v.Z,{variant:"body2",children:"Pass Rate"})]})]}),(0,r.jsx)(ei.Z,{variant:"contained",color:"inherit",fullWidth:!0,onClick:e=>{let i="/eval/?evalId=".concat(n,"&search=").concat(encodeURIComponent("(var=".concat(u,"|metric=").concat(u,")")));e.ctrlKey||e.metaKey?window.open(i,"_blank"):window.location.href=i},children:"View All Logs"}),s.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.Z,{variant:"h6",className:"failed-tests-header",children:"Failed Tests"}),(0,r.jsx)(d.Z,{children:s.slice(0,5).map((e,i)=>(0,r.jsx)(p.ZP,{className:"failure-item",children:(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(v.Z,{variant:"subtitle1",className:"prompt",children:function(e){try{let i=JSON.parse(e);if(Array.isArray(i)){let e=i[i.length-1];if(e.content)return e.content||"-"}}catch(e){}return e}(e.prompt)}),(0,r.jsx)(v.Z,{variant:"body2",className:"output",children:function(e){if("string"==typeof e)return e;if(Array.isArray(e)){let i=e.filter(e=>"function"===e.type);if(i.length>0)return i.map(e=>{var i,t;return"".concat(null===(i=e.function)||void 0===i?void 0:i.name,": (").concat(null===(t=e.function)||void 0===t?void 0:t.arguments,")")}).join("\n")}return JSON.stringify(e)}(e.output)})]})},i))})]}):(0,r.jsx)(o.Z,{sx:{mt:2,textAlign:"center"},children:(0,r.jsx)(v.Z,{variant:"body1",children:"All tests passed successfully"})})]})})};t(46553);var em=e=>{var i,t;let{title:a,subtitle:s,progressValue:l,numTestsPassed:u,numTestsFailed:m,testTypes:g,evalId:f,failuresByPlugin:y}=e,{showPercentagesOnRiskCards:b,pluginPassRateThreshold:k}=q(),[C,R]=n.useState(!1),[P,S]=n.useState(""),A=g.filter(e=>e.numPassed+e.numFailed>0);return 0===A.length?null:(0,r.jsx)(c.Z,{children:(0,r.jsxs)(Z.Z,{className:"risk-card-container",children:[(0,r.jsxs)(w.ZP,{container:!0,spacing:3,children:[(0,r.jsxs)(w.ZP,{item:!0,xs:12,md:6,style:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:[(0,r.jsx)(v.Z,{variant:"h5",className:"risk-card-title",children:a}),(0,r.jsx)(v.Z,{variant:"subtitle1",color:"textSecondary",mb:2,children:s}),(0,r.jsx)(o.Z,{sx:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:100,height:100},children:(0,r.jsx)(eo.a,{value:l,max:100,thickness:10,arc:{startAngle:-90,endAngle:90,color:"primary.main"},text:Number.isNaN(l)?"-":"".concat(Math.round(l),"%"),sx:{width:"100%",height:"100%"}})}),(0,r.jsxs)(v.Z,{variant:"h6",className:"risk-card-issues",children:[m," failed probes"]}),(0,r.jsxs)(v.Z,{variant:"subtitle1",color:"textSecondary",className:"risk-card-tests-passed",children:[u,"/",u+m," passed"]})]}),(0,r.jsx)(w.ZP,{item:!0,xs:6,md:4,children:(0,r.jsx)(d.Z,{dense:!0,children:A.map((e,i)=>{let t=e.numPassed/(e.numPassed+e.numFailed);return(0,r.jsx)(K.Z,{title:M[e.name],placement:"left",arrow:!0,children:(0,r.jsxs)(p.ZP,{className:"risk-card-list-item",onClick:()=>{S(e.name),R(!0)},style:{cursor:"pointer"},children:[(0,r.jsx)(h.Z,{primary:F[e.name]||I[e.name],primaryTypographyProps:{variant:"body2"}}),b?(0,r.jsx)(v.Z,{variant:"body2",className:"risk-card-percentage ".concat(t>=.8?"risk-card-percentage-high":t>=.5?"risk-card-percentage-medium":"risk-card-percentage-low"),children:"".concat(Math.round(100*t),"%")}):t>=k?(0,r.jsx)(j.Z,{className:"risk-card-icon-passed"}):(0,r.jsx)(x.Z,{className:"risk-card-icon-failed"})]})},i)})})})]}),P&&(0,r.jsx)(eu,{open:C,onClose:()=>R(!1),category:P,failures:y[P]||[],evalId:f,numPassed:(null===(i=g.find(e=>e.name===P))||void 0===i?void 0:i.numPassed)||0,numFailed:(null===(t=g.find(e=>e.name===P))||void 0===t?void 0:t.numFailed)||0})]})})};t(32991);var ed=e=>{let{categoryStats:i,evalId:t,failuresByPlugin:a}=e,s=Object.keys(R).map(e=>({name:e,passed:R[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,r.jsx)(f.Z,{spacing:4,children:s.map((e,s)=>{let n=e.name,l=R[n],o=l.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.pass)||0)},0),c=l.reduce((e,t)=>{var a;return e+((null===(a=i[t])||void 0===a?void 0:a.total)||0)},0);return(0,r.jsx)(em,{title:e.name,subtitle:P[n],progressValue:o/c*100,numTestsPassed:o,numTestsFailed:c-o,testTypes:l.map(e=>{var t,a,s,r,n;return{name:e,categoryPassed:(null===(t=i[e])||void 0===t?void 0:t.pass)===(null===(a=i[e])||void 0===a?void 0:a.total),numPassed:(null===(s=i[e])||void 0===s?void 0:s.pass)||0,numFailed:((null===(r=i[e])||void 0===r?void 0:r.total)||0)-((null===(n=i[e])||void 0===n?void 0:n.pass)||0)}}),evalId:t,failuresByPlugin:a},s)})})},ep=t(54755),eh=t(12120),eg=t(35843);t(44097);let ef=(0,eg.ZP)(ep.Z)(e=>{let{theme:i}=e;return{height:8,borderRadius:8,["&.".concat(eh.Z.colorPrimary)]:{backgroundColor:"light"===i.palette.mode?"#e0e0e0":"#424242"},["& .".concat(eh.Z.bar)]:{borderRadius:8,backgroundColor:"light"===i.palette.mode?"#ff1744":"#ff8a80"}}});var ev=e=>{let{strategyStats:i}=e,t=Object.entries(i).sort((e,i)=>(i[1].total-i[1].pass)/i[1].total-(e[1].total-e[1].pass)/e[1].total);return(0,r.jsx)(c.Z,{className:"strategy-stats-card",children:(0,r.jsxs)(Z.Z,{className:"strategy-stats-content",children:[(0,r.jsx)(v.Z,{variant:"h5",mb:2,children:"Attack success rates"}),(0,r.jsx)(o.Z,{className:"strategy-grid",children:t.map(e=>{let[i,{pass:t,total:a}]=e,s=(a-t)/a*100;return(0,r.jsxs)(o.Z,{className:"strategy-item",children:[(0,r.jsx)(v.Z,{variant:"body1",className:"strategy-name",children:F[i]||i}),(0,r.jsx)(v.Z,{variant:"body2",color:"text.secondary",className:"strategy-description",children:M[i]||""}),(0,r.jsxs)(o.Z,{display:"flex",alignItems:"center",className:"progress-container",children:[(0,r.jsx)(o.Z,{width:"100%",mr:1,children:(0,r.jsx)(ef,{variant:"determinate",value:s})}),(0,r.jsx)(o.Z,{minWidth:45,className:"fail-rate",children:(0,r.jsxs)(v.Z,{variant:"body2",color:"text.secondary",children:[s.toFixed(1),"%"]})})]}),(0,r.jsxs)(v.Z,{variant:"caption",color:"text.secondary",className:"attack-stats",children:[a-t," / ",a," attacks succeeded"]})]},i)})})]})})},ex=t(73701),ej=t(39279),ey=t(30666),eb=t(15795),eZ=t(66988),ew=t(15646),ek=t(98489),eC=t(95781);t(93091);let eR=e=>{let i=[];for(let t of Object.values(R))for(let a of t)i.push({pluginName:a,type:I[a]||a,description:M[a]||"",passRate:e[a]?(e[a].pass/e[a].total*100).toFixed(1)+"%":"N/A",passRateWithFilter:e[a]?(e[a].passWithFilter/e[a].total*100).toFixed(1)+"%":"N/A",severity:S[a]||"Unknown"});return i.sort((e,i)=>"N/A"===e.passRate?1:"N/A"===i.passRate?-1:Number.parseFloat(e.passRate)-Number.parseFloat(i.passRate))};var eP=e=>{let{evalId:i,categoryStats:t}=e,a=eR(t).filter(e=>"N/A"!==e.passRate),[s,l]=n.useState(0),[c,u]=n.useState(10),[m,d]=n.useState("asc"),[p,h]=n.useState("default"),g=e=>{let i=p===e&&"asc"===m;d(i?"desc":"asc"),h(e)};return(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(v.Z,{variant:"h5",gutterBottom:!0,id:"table",children:"Vulnerabilities and Mitigations"}),(0,r.jsxs)(eb.Z,{children:[(0,r.jsxs)(ex.Z,{children:[(0,r.jsx)(eZ.Z,{children:(0,r.jsxs)(ek.Z,{children:[(0,r.jsx)(ey.Z,{children:"Type"}),(0,r.jsx)(ey.Z,{children:"Description"}),(0,r.jsx)(ey.Z,{children:(0,r.jsx)(eC.Z,{active:"passRate"===p,direction:"passRate"===p?m:"asc",onClick:()=>g("passRate"),children:"Pass rate"})}),(0,r.jsx)(ey.Z,{children:(0,r.jsx)(eC.Z,{active:"severity"===p,direction:"severity"===p?m:"asc",onClick:()=>g("severity"),children:"Severity"})}),(0,r.jsx)(ey.Z,{style:{minWidth:"275px"},children:"Actions"})]})}),(0,r.jsx)(ej.Z,{children:a.sort((e,i)=>{if("passRate"===p)return"N/A"===e.passRate?1:"N/A"===i.passRate?-1:"asc"===m?Number.parseFloat(e.passRate)-Number.parseFloat(i.passRate):Number.parseFloat(i.passRate)-Number.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?Number.parseFloat(e.passRate)-Number.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=Number.parseFloat(e.passRate);t=i>=75?"pass-high":i>=50?"pass-medium":"pass-low"}return(0,r.jsxs)(ek.Z,{children:[(0,r.jsx)(ey.Z,{children:(0,r.jsx)("span",{style:{fontWeight:500},children:F[e.pluginName]||e.type})}),(0,r.jsx)(ey.Z,{children:e.description}),(0,r.jsxs)(ey.Z,{className:t,children:[(0,r.jsx)("strong",{children:e.passRate}),e.passRateWithFilter===e.passRate?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("br",{}),"(",e.passRateWithFilter," with mitigation)"]})]}),(0,r.jsx)(ey.Z,{className:"vuln-".concat(e.severity.toLowerCase()),children:e.severity}),(0,r.jsxs)(ey.Z,{style:{minWidth:270},children:[(0,r.jsx)(ei.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,r.jsx)(K.Z,{title:"Temporarily disabled while in beta, click to contact us to enable",children:(0,r.jsx)(ei.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,r.jsx)(ew.Z,{rowsPerPageOptions:[10,25,50],component:"div",count:a.length,rowsPerPage:c,page:s,onPageChange:(e,i)=>{l(i)},onRowsPerPageChange:e=>{u(Number.parseInt(e.target.value,10)),l(0)}})]})]})};t(67667);var eS=()=>{let[e,i]=n.useState(null),[t,a]=n.useState(null),[s,x]=n.useState(0),[j,y]=n.useState(!1),b=n.useMemo(()=>{let e={};return null==t||t.results.results.forEach(i=>{var t,a,s;let r=function(e){var i,t,a;let s=e.vars.harmCategory;if(s)return N[s];let r=(null===(t=e.gradingResult)||void 0===t?void 0:null===(i=t.componentResults)||void 0===i?void 0:i.map(e=>{var i;return null===(i=e.assertion)||void 0===i?void 0:i.metric}))||[],n=null===(a=r[0])||void 0===a?void 0:a.split("/")[0];return n?N[n]:null}(i);if(!r){console.warn("Could not get failures for plugin ".concat(r));return}!r||(null===(t=i.gradingResult)||void 0===t?void 0:t.pass)||(e[r]||(e[r]=[]),e[r].push({prompt:(null===(a=i.vars.query)||void 0===a?void 0:a.toString())||i.prompt.raw,output:null===(s=i.response)||void 0===s?void 0:s.output}))}),e},[t]);if(n.useEffect(()=>{let e=async e=>{let i=await (0,l.t)("/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))},[]),n.useEffect(()=>{document.title="Report: ".concat((null==t?void 0:t.config.description)||e||"Red Team"," | promptfoo")},[t,e]),!t||!e)return(0,r.jsx)(o.Z,{sx:{width:"100%",textAlign:"center"},children:"Loading..."});let Z=t.results.table.head.prompts,w=Z[s],k=t.results.table.body,C=t.results.results.reduce((e,i)=>{var t,a,s,r,n,l,o,c;let u=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}))||[],d=[u,...m].filter(e=>e);for(let t of d){if("string"!=typeof t)continue;let a=N[t.split("/")[0]];if(!a){console.log("Unknown harm category:",t);break}let u=null===(r=i.gradingResult)||void 0===r?void 0:null===(s=r.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===(n=l.componentResults)||void 0===n?void 0:n.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}),d=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||d?(e[a].pass++,e[a].passWithFilter++):!u&&e[a].passWithFilter++}return e},{}),R=t.results.results.reduce((e,i)=>{var t,a,s,r;let n=(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}))||[];for(let t of n){if("string"!=typeof t)continue;let a=function(e){let i=e.split("/")[1];if(i){if("Iterative"===i)return"jailbreak";if("IterativeTree"===i)return"jailbreak:tree";if("Crescendo"===i)return"crescendo";if("Injection"===i)return"prompt-injection";else if("Rot13"===i)return"rot13";else if("Base64"===i)return"base64";else if("Leetspeak"===i)return"leetspeak";else if(i.startsWith("Multilingual"))return"multilingual"}return null}(t);a||(a="basic"),e[a]||(e[a]={pass:0,total:0}),e[a].total++;let n=null===(r=i.gradingResult)||void 0===r?void 0:null===(s=r.componentResults)||void 0===s?void 0:s.some(e=>{var i;return(null===(i=e.assertion)||void 0===i?void 0:i.metric)===t&&e.pass});n&&e[a].pass++}return e},{}),P=()=>{Z.length>1&&y(!0)},S=e=>{x(e),y(!1)};return(0,r.jsxs)(m.Z,{children:[(0,r.jsxs)(f.Z,{spacing:4,pb:8,pt:2,children:[(0,r.jsxs)(c.Z,{className:"report-header",sx:{position:"relative"},children:[(0,r.jsxs)(o.Z,{sx:{position:"absolute",top:8,right:8,display:"flex"},children:[(0,r.jsx)(X,{evalDescription:t.config.description||e}),(0,r.jsx)(el,{})]}),(0,r.jsxs)(v.Z,{variant:"h4",children:[(0,r.jsx)("strong",{children:"LLM Risk Assessment"}),t.config.description&&": ".concat(t.config.description)]}),(0,r.jsx)(v.Z,{variant:"subtitle1",mb:2,children:new Date(t.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),(0,r.jsxs)(o.Z,{className:"report-details",children:[(0,r.jsx)(u.Z,{size:"small",label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("strong",{children:"Model:"})," ",w.provider]}),onClick:P,style:{cursor:Z.length>1?"pointer":"default"}}),(0,r.jsx)(u.Z,{size:"small",label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("strong",{children:"Dataset:"})," ",k.length," probes"]})}),(0,r.jsx)(u.Z,{size:"small",label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("strong",{children:"Prompt:"}),' "',w.raw.length>40?"".concat(w.raw.substring(0,40),"..."):w.raw,'"']}),onClick:P,style:{cursor:Z.length>1?"pointer":"default"}})]})]}),(0,r.jsx)(_,{categoryStats:C}),(0,r.jsx)(V,{categoryStats:C,strategyStats:R}),(0,r.jsx)(ev,{strategyStats:R}),(0,r.jsx)(ed,{categoryStats:C,evalId:e,failuresByPlugin:b}),(0,r.jsx)(eP,{evalId:e,categoryStats:C})]}),(0,r.jsx)(g.Z,{open:j,onClose:()=>y(!1),"aria-labelledby":"prompt-modal-title",sx:{"& .MuiModal-root":{display:"flex",alignItems:"center",justifyContent:"center"},"& .MuiBox-root":{width:"80%",maxWidth:800,maxHeight:"90vh",overflowY:"auto"}},children:(0,r.jsxs)(o.Z,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:400,bgcolor:"background.paper",boxShadow:24,p:4},children:[(0,r.jsx)(v.Z,{id:"prompt-modal-title",variant:"h6",component:"h2",gutterBottom:!0,children:"View results for..."}),(0,r.jsx)(d.Z,{children:Z.map((e,i)=>(0,r.jsx)(p.ZP,{button:!0,onClick:()=>S(i),selected:i===s,children:(0,r.jsx)(h.Z,{primary:"".concat(e.provider),secondary:e.raw.length>100?"".concat(e.raw.substring(0,100),"..."):e.raw})},i))})]})})]})}},82911:function(e,i,t){"use strict";var a=t(94660),s=t(74810);let r=(0,a.Ue)()((0,s.tJ)(e=>({apiBaseUrl:"",setApiBaseUrl:i=>e({apiBaseUrl:i}),fetchingPromise:null,setFetchingPromise:i=>e({fetchingPromise:i})}),{name:"api-config-storage",partialize:e=>({apiBaseUrl:e.apiBaseUrl})}));i.Z=r},59598:function(){},4309:function(){},67667:function(){},46553:function(){},32991:function(){},11674:function(){},44097:function(){},93091:function(){}},function(e){e.O(0,[949,799,906,461,88,113,417,874,646,167,470,730,744],function(){return e(e.s=58004)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{8458:function(e,t,n){Promise.resolve().then(n.bind(n,83013))},49532:function(e,t,n){"use strict";n.d(t,{t:function(){return r}});var a=n(82911);async function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{apiBaseUrl:n}=a.Z.getState();return fetch("".concat(n,"/api").concat(e),t)}},83013:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return eh}});var a=n(24004),r=n(14978),i=n(69179),l=n(47887),s=n(79245),o=n(49050),c=n(88938),d=n(89394),p=n(42834),u=n(26337),h=n(64173),m=n(91797),x=n(13457),f=n(43226),j=n(93295),v=n(82057),g=n(58768),Z=n(15873),b=n(21975),y=()=>{let{env:e,setEnv:t}=(0,l.o)(),[n,i]=(0,r.useState)(!1),[s,c]=(0,r.useState)(e),h=()=>{i(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Z,{variant:"outlined",startIcon:(0,a.jsx)(j.Z,{}),onClick:()=>{i(!0)},children:"API keys"}),(0,a.jsxs)(d.Z,{open:n,onClose:h,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(m.Z,{children:"Provider settings"}),(0,a.jsxs)(u.Z,{children:[(0,a.jsxs)(v.Z,{defaultExpanded:!0,children:[(0,a.jsx)(Z.Z,{children:"OpenAI"}),(0,a.jsxs)(g.Z,{children:[(0,a.jsx)(b.Z,{label:"OpenAI API key",fullWidth:!0,margin:"normal",value:s.OPENAI_API_KEY,onChange:e=>c({...s,OPENAI_API_KEY:e.target.value})}),(0,a.jsx)(b.Z,{label:"OpenAI API host",fullWidth:!0,margin:"normal",value:s.OPENAI_API_HOST,onChange:e=>c({...s,OPENAI_API_HOST:e.target.value})}),(0,a.jsx)(b.Z,{label:"OpenAI organization",fullWidth:!0,margin:"normal",value:s.OPENAI_ORGANIZATION,onChange:e=>c({...s,OPENAI_ORGANIZATION:e.target.value})})]})]}),(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(Z.Z,{children:"Azure"}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(b.Z,{label:"Azure API key",fullWidth:!0,margin:"normal",value:s.AZURE_OPENAI_API_KEY,onChange:e=>c({...s,AZURE_OPENAI_API_KEY:e.target.value})})})]}),(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(Z.Z,{children:"Amazon Bedrock"}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(b.Z,{label:"Bedrock Region",fullWidth:!0,margin:"normal",value:s.AWS_BEDROCK_REGION,onChange:e=>c({...s,AWS_BEDROCK_REGION:e.target.value})})})]}),(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(Z.Z,{children:"Anthropic"}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(b.Z,{label:"Anthropic API key",fullWidth:!0,margin:"normal",value:s.ANTHROPIC_API_KEY,onChange:e=>c({...s,ANTHROPIC_API_KEY:e.target.value})})})]}),(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(Z.Z,{children:"Google Vertex AI"}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex API Key",fullWidth:!0,margin:"normal",value:s.VERTEX_API_KEY,onChange:e=>c({...s,VERTEX_API_KEY:e.target.value})})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex Project ID",fullWidth:!0,margin:"normal",value:s.VERTEX_PROJECT_ID,onChange:e=>c({...s,VERTEX_PROJECT_ID:e.target.value})})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(b.Z,{label:"Vertex Region",fullWidth:!0,margin:"normal",value:s.VERTEX_REGION,onChange:e=>c({...s,VERTEX_REGION:e.target.value})})})]}),(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(Z.Z,{children:"Replicate"}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(b.Z,{label:"Replicate API key",fullWidth:!0,margin:"normal",value:s.REPLICATE_API_KEY,onChange:e=>c({...s,REPLICATE_API_KEY:e.target.value})})})]})]}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:h,color:"primary",children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{t(s),h()},color:"primary",variant:"contained",children:"Save"})]})]})]})},_=n(39329),C=n(46446),k=n(13391),A=n(71280),E=n(52653),I=n(73701),S=n(39279),P=n(30666),O=n(15795),T=n(98489),w=n(78276),R=e=>{let{open:t,prompt:n,index:i,onAdd:l,onCancel:s}=e,[c,h]=r.useState(n),x=r.useRef(null);r.useEffect(()=>{h(n)},[n]);let f=e=>{l(c),h(""),e?s():x.current&&x.current.focus()};return(0,a.jsxs)(d.Z,{open:t,onClose:s,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(m.Z,{children:"Edit Prompt ".concat(i+1)}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(b.Z,{value:c,onChange:e=>h(e.target.value),fullWidth:!0,margin:"normal",multiline:!0,placeholder:"The quick brown {{animal1}} jumps over the lazy {{animal2}}.",helperText:"Tip: use the {{varname}} syntax to add variables to your prompt.",inputRef:x})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:f.bind(null,!0),color:"primary",variant:"contained",disabled:!c.length,children:"Add"}),(0,a.jsx)(o.Z,{onClick:f.bind(null,!1),color:"primary",variant:"contained",disabled:!c.length,children:"Add Another"}),(0,a.jsx)(o.Z,{onClick:s,color:"secondary",children:"Cancel"})]})]})};n(94499);var W=()=>{let[e,t]=(0,r.useState)(!1),[n,i]=(0,r.useState)(null),{prompts:s,setPrompts:c}=(0,l.o)(),d=(0,r.useRef)(null);(0,r.useEffect)(()=>{null!==n&&n>0&&d.current&&d.current.focus()},[n]);let p=e=>{i(e),t(!0)},u=(e,t)=>{e.stopPropagation();let n=s[t];c([...s,n])},h=(e,t)=>{c(s.map((n,a)=>a===e?t:n))},m=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to remove this prompt?")&&c(s.filter((e,n)=>n!==t))};return(0,a.jsxs)("div",{children:[(0,a.jsxs)(x.Z,{direction:"row",spacing:2,mb:2,justifyContent:"space-between",children:[(0,a.jsx)(f.Z,{variant:"h5",children:"Prompts"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"file-input-add-prompt",children:(0,a.jsx)(w.Z,{title:"Upload prompt from file",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(E.Z,{component:"span",children:(0,a.jsx)(A.Z,{})}),(0,a.jsx)("input",{id:"file-input-add-prompt",type:"file",accept:".txt,.md",onChange:e=>{var t;e.stopPropagation(),e.preventDefault();let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){let e=new FileReader;e.onload=e=>{var t,n;let a=null===(n=e.target)||void 0===n?void 0:null===(t=n.result)||void 0===t?void 0:t.toString();a&&c([...s,a])},e.readAsText(n)}},style:{display:"none"}})]})})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>{t(!0)},variant:"contained",children:"Add Prompt"})]})]}),(0,a.jsx)(O.Z,{children:(0,a.jsx)(I.Z,{children:(0,a.jsx)(S.Z,{children:0===s.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(P.Z,{colSpan:2,align:"center",children:"No prompts added yet."})}):s.map((e,t)=>(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>p(t),children:[(0,a.jsx)(P.Z,{children:(0,a.jsxs)(f.Z,{variant:"body2",children:["Prompt #".concat(t+1,": "),(e.length>250?e.slice(0,250)+" ...":e).split(/({{\w+}})/g).map((e,t)=>/{{\s*(\w+)\s*}}/g.test(e)?(0,a.jsx)("span",{className:"prompt-var-highlight",children:e},t):e)]})}),(0,a.jsxs)(P.Z,{align:"right",sx:{minWidth:150},children:[(0,a.jsx)(E.Z,{onClick:()=>p(t),size:"small",children:(0,a.jsx)(k.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>u(e,t),size:"small",children:(0,a.jsx)(_.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>m(e,t),size:"small",children:(0,a.jsx)(C.Z,{})})]})]},t))})})}),(0,a.jsx)(R,{open:e,prompt:null===n?"":s[n],index:null===n?0:n,onAdd:e=>{null===n?c([...s,e]):h(n,e),i(null)},onCancel:()=>{i(null),t(!1)}})]})},N=n(26972),z=n(47827),F=e=>{let{onChange:t,...n}=e,[i,l]=r.useState(""),[s,o]=r.useState(!1);return(0,a.jsx)(b.Z,{...n,error:s,helperText:s?"Invalid JSON":"",value:i,onChange:e=>{let n=e.target.value;try{let e=JSON.parse(n);l(n),o(!1),t&&t(e)}catch(e){l(n),o(!0)}}})},V=e=>{let{open:t,providerId:n,config:i,onClose:l,onSave:c}=e,[h,x]=r.useState(i);return r.useEffect(()=>{x(i)},[i]),(0,a.jsxs)(d.Z,{open:t,onClose:l,fullWidth:!0,maxWidth:"md",children:[(0,a.jsxs)(m.Z,{children:["Edit ",n.length>50?n.slice(0,50)+"...":n]}),(0,a.jsx)(u.Z,{children:Object.keys(h).map(e=>{let t;let n=h[e];return"number"==typeof n||"boolean"==typeof n||"string"==typeof n?(t="number"==typeof n?t=>x({...h,[e]:Number.parseFloat(t.target.value)}):"boolean"==typeof n?t=>x({...h,[e]:"true"===t.target.value}):t=>{let n=t.target.value.trim();if(n.startsWith("{")||n.startsWith("["))try{x({...h,[e]:JSON.parse(n)})}catch(t){x({...h,[e]:n})}else"null"===n?x({...h,[e]:null}):"undefined"===n?x({...h,[e]:void 0}):x({...h,[e]:n})},(0,a.jsx)(s.Z,{my:2,children:(0,a.jsx)(b.Z,{label:e,value:n,onChange:t,fullWidth:!0,InputLabelProps:{shrink:!0},type:"number"==typeof n?"number":"text"})},e)):(0,a.jsx)(s.Z,{my:2,children:(0,a.jsx)(F,{label:e,defaultValue:JSON.stringify(n),onChange:t=>{x({...h,[e]:t})},fullWidth:!0,multiline:!0,minRows:2,InputLabelProps:{shrink:!0}})},e)})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:l,children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{c(h)},children:"Save"})]})]})};let U=[].concat(["openai:gpt-4o","openai:gpt-4o-2024-05-13","openai:gpt-4o-mini","openai:gpt-4o-mini-2024-07-18","openai:gpt-4-turbo","openai:gpt-4","openai:gpt-3.5-turbo"].map(e=>({id:e,config:{organization:"",temperature:.5,max_tokens:1024,top_p:1,frequency_penalty:0,presence_penalty:0,function_call:void 0,functions:void 0,stop:void 0}}))).concat(["anthropic:messages:claude-3-5-sonnet-20240620","anthropic:messages:claude-3-haiku-20240307","anthropic:messages:claude-3-sonnet-20240229","anthropic:messages:claude-3-opus-20240229"].map(e=>({id:e,config:{max_tokens:1024,temperature:.5}}))).concat(["bedrock:anthropic.claude-3-haiku-20240307-v1:0","bedrock:anthropic.claude-3-sonnet-20240229-v1:0","bedrock:anthropic.claude-3-opus-20240307-v1:0"].map(e=>({id:e,config:{max_tokens_to_sample:256,temperature:.5}}))).concat(["azureopenai:gpt-4o-2024-05-13","azureopenai:gpt-4-turbo-2024-04-09","azureopenai:gpt-4-32k-0613","azureopenai:gpt-4-0613","azureopenai:gpt-35-turbo-0125"].map(e=>({id:e,config:{temperature:.5,max_tokens:1024,top_p:1,frequency_penalty:0,presence_penalty:0,function_call:void 0,functions:void 0,stop:void 0}}))).concat(["vertex:chat-bison@001","vertex:chat-bison","vertex:chat-bison-32k","vertex:chat-bison-32k@001"].map(e=>({id:e,config:{context:void 0,examples:void 0,temperature:0,maxOutputTokens:1024,topP:.95,topK:40,safetySettings:void 0,stopSequence:void 0}}))).concat(["replicate:replicate/flan-t5-small:69716ad8c34274043bf4a135b7315c7c569ec931d8f23d6826e249e1c142a264"].map(e=>({id:e,config:{temperature:.5,max_length:1024,repetition_penality:1}}))).concat(["replicate:replicate/codellama-7b-instruct:0103579e86fc75ba0d65912890fa19ef03c84a68554635319accf2e0ba93d3ae","replicate:replicate/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b","replicate:replicate/llama-2-70b-chat:2796ee9483c3fd7aa2e171d38f4ca12251a30609463dcfd4cd76703f22e96cdf"].map(e=>({id:e,config:{system_prompt:"",temperature:.75,top_p:.9,top_k:50,max_new_tokens:128,min_new_tokens:-1}}))).concat(["replicate:replicate/codellama-7b:6880b103613a9cd23950c5fd6c140197e519905bd0dd00e448c4858bdd06090a","replicate:replicate/codellama-13b-python:09b87c02dfa403e0c3289166dece62286b3bce49bae39a9c9204713cf94b8b7d","replicate:replicate/codellama-13b:1c914d844307b0588599b8393480a3ba917b660c7e9dfae681542b5325f228db","replicate:replicate/codellama-34b-python:9048743d22a7b19cd0abb018066809ea6af4f2b4717bef9aad3c5ae21ceac00d","replicate:replicate/codellama-34b:0666717e5ead8557dff55ee8f11924b5c0309f5f1ca52f64bb8eec405fdb38a7"].map(e=>({id:e,config:{temperature:.75,top_p:.9,top_k:50,max_new_tokens:128,min_new_tokens:-1}}))).concat(["replicate:a16z-infra/llama-2-7b-chat:7b0bfc9aff140d5b75bacbed23e91fd3c34b01a1e958d32132de6e0a19796e2c","replicate:a16z-infra/llama-2-13b-chat:2a7f981751ec7fdf87b5b91ad4db53683a98082e9ff7bfd12c8cd5ea85980a52"].map(e=>({id:e,config:{temperature:.95,top_p:.95,top_k:250,max_new_tokens:500,min_new_tokens:-1,repetition_penalty:1,system_prompt:""}}))).concat(["replicate:mistralai/mistral-7b-v0.1","replicate:mistralai/mistral-7b-instruct-v0.2","replicate:mistralai/mixtral-8x7b-instruct-v0.1"].map(e=>({id:e,config:{temperature:.7,top_p:.9,top_k:-1,max_new_tokens:128,min_new_tokens:-1,repetition_penalty:1.15,prompt_template:"{prompt}"}}))).sort((e,t)=>e.id.localeCompare(t.id)),B={anthropic:"Anthropic",bedrock:"Amazon Web Services",azureopenai:"Azure",openai:"OpenAI",replicate:"Replicate"};var L=e=>{let{providers:t,onChange:n}=e,[i,l]=r.useState(null),o=e=>"string"==typeof e?e:e.id||"Unknown provider",c=(e,t)=>"string"==typeof e?e:e.id||t,d=e=>{"string"==typeof e?alert("Cannot edit custom providers"):e.config?l(e):alert("There is no config for this provider")};return(0,a.jsxs)(s.Z,{mt:2,children:[(0,a.jsx)(N.Z,{multiple:!0,freeSolo:!0,options:U,value:t,groupBy:e=>(function(e){if(!e)return"Other";let t=e.split(":")[0];return B[t]||t})(e.id),onChange:(e,t)=>{n(t.map(e=>"string"==typeof e?{id:e}:e))},getOptionLabel:e=>{if(!e)return"";let t="";"string"==typeof e&&(t=e),e.id&&"string"==typeof e.id&&(t=e.id);let n=t.split(":");return n.length>1?n.length>2&&"anthropic"===n[0]?n[2]:n[1]:"Unknown provider"},renderTags:(e,t)=>e.map((e,n)=>{let a=o(e),i=c(e,n);return(0,r.createElement)(z.Z,{variant:"outlined",label:a,...t({index:n}),key:i,onClick:()=>d(e)})}),renderInput:e=>(0,a.jsx)(b.Z,{...e,variant:"outlined",placeholder:"Select LLM providers",helperText:t.length>0?"Click a provider to configure its settings.":null})}),i&&i.id&&(0,a.jsx)(V,{open:!!i,providerId:i.id,config:i.config,onClose:()=>l(null),onSave:e=>{if(i){let a=t.map(t=>t.id===i.id?{...t,config:e}:t);n(a),l(null)}}})]})},q=n(49532),K=n(52428),Y=n(6882),J=n(28891),D=()=>{let e=(0,J.useRouter)(),{defaultTest:t,description:n,env:i,evaluateOptions:s,prompts:c,providers:d,scenarios:p,testCases:u}=(0,l.o)(),[h,m]=(0,r.useState)(!1),[x,f]=(0,r.useState)(0),j=async()=>{m(!0);try{let a=await (0,q.t)("/eval/job",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultTest:t,description:n,env:i,evaluateOptions:s,prompts:c,providers:d,scenarios:p,tests:u})});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));let r=await a.json(),l=setInterval(async()=>{let t=await (0,q.t)("/eval/job/".concat(r.id,"/"));if(!t.ok)throw clearInterval(l),Error("HTTP error! status: ".concat(t.status));let n=await t.json();if("complete"===n.status)clearInterval(l),m(!1),K.O?e.push("/eval/remote:".concat(encodeURIComponent(r.id))):e.push("/eval");else if("failed"===n.status)throw clearInterval(l),m(!1),Error("Job failed");else{let e=0===n.total?0:Math.round(n.progress/n.total*100);f(e)}},1e3)}catch(e){console.error(e),m(!1),alert("An error occurred: ".concat(e.message))}};return(0,a.jsx)(o.Z,{variant:"contained",color:"primary",onClick:j,disabled:h,children:h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.Z,{size:24,sx:{marginRight:2}}),x.toFixed(0),"% complete"]}):"Run Evaluation"})},X=n(15320),G=n(66988);let H=["equals","contains","icontains","contains-all","contains-any","starts-with","regex","is-json","contains-json","is-sql","contains-sql","similar","llm-rubric","model-graded-closedqa","factuality","webhook","rouge-n","rouge-s","rouge-l","not-equals","not-contains","not-icontains","not-contains-all","not-contains-any","not-starts-with","not-regex","not-is-json","not-contains-json","not-similar","not-webhook","not-rouge-n","not-rouge-s","not-rouge-l","is-valid-openai-function-call","is-valid-openai-tools-call","latency","perplexity","perplexity-score","cost","answer-relevance","context-faithfulness","context-recall","context-relevance","select-best","moderation"];var M=e=>{let{onAdd:t,initialValues:n}=e,[i,l]=(0,r.useState)(n||[]),c=e=>{let n=i.filter((t,n)=>n!==e);l(n),t(n)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Z,{variant:"h6",children:"Asserts"}),(0,a.jsx)(s.Z,{my:i.length>0?2:0,children:(0,a.jsx)(x.Z,{direction:"column",spacing:2,children:i.map((e,n)=>(0,a.jsxs)(x.Z,{direction:"row",spacing:2,alignItems:"center",children:[(0,a.jsx)(N.Z,{value:e.type,options:H,sx:{minWidth:200},onChange:(e,a)=>{let r=i.map((e,t)=>t===n?{...e,type:a}:e);l(r),t(r)},renderInput:e=>(0,a.jsx)(b.Z,{...e,label:"Type"})}),(0,a.jsx)(b.Z,{label:"Value",value:e.value,fullWidth:!0,onChange:e=>{let a=e.target.value,r=i.map((e,t)=>t===n?{...e,value:a}:e);l(r),t(r)}}),(0,a.jsx)(E.Z,{onClick:()=>c(n),size:"small",children:(0,a.jsx)(C.Z,{})})]},n))})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>{let e=[...i,{type:"equals",value:""}];l(e),t(e)},children:"Add Assert"})]})},$=e=>{let{onAdd:t,varsList:n,initialValues:i}=e,[l,o]=r.useState(i||{});return(0,r.useEffect)(()=>{let e={};n.forEach(t=>{e[t]=(null==i?void 0:i[t])||""}),o(e)},[n,i]),(0,a.jsxs)(s.Z,{my:2,children:[(0,a.jsx)(f.Z,{variant:"h6",mb:2,children:"Vars"}),n.length>0?(0,a.jsx)(x.Z,{direction:"row",spacing:2,alignItems:"center",children:Object.keys(l).map((e,n)=>(0,a.jsx)(x.Z,{direction:"row",spacing:2,alignItems:"center",children:(0,a.jsx)(b.Z,{placeholder:e,label:e,value:l[e],fullWidth:!0,onChange:n=>{let a=n.target.value,r={...l,[e]:a};o(r),t(r)}})},n))}):(0,a.jsxs)(f.Z,{variant:"subtitle1",gutterBottom:!0,children:["Add variables to your prompt using the ","{{varname}}"," syntax."]})]})},Q=e=>{let{open:t,onAdd:n,varsList:i,initialValues:l,onCancel:c}=e,[h,x]=(0,r.useState)((null==l?void 0:l.description)||""),[f,j]=(0,r.useState)((null==l?void 0:l.vars)||{}),[v,g]=(0,r.useState)((null==l?void 0:l.assert)||[]),[Z,b]=(0,r.useState)(0);r.useEffect(()=>{l?(x(l.description||""),j(l.vars||{}),g(l.assert||[])):(x(""),j({}),g([]))},[l]);let y=e=>{n({description:h,vars:f,assert:v},e),e&&c(),x(""),j({}),g([]),b(e=>e+1)};return(0,a.jsxs)(d.Z,{open:t,onClose:c,fullWidth:!0,maxWidth:"md",children:[(0,a.jsx)(m.Z,{children:l?"Edit Test Case":"Add Test Case"}),(0,a.jsx)(u.Z,{children:(0,a.jsxs)(s.Z,{children:[(0,a.jsx)($,{onAdd:e=>j(e),varsList:i,initialValues:null==l?void 0:l.vars}),(0,a.jsx)(M,{onAdd:e=>g(e),initialValues:((null==l?void 0:l.assert)||[]).filter(e=>"assert-set"!==e.type)||[]},Z)]})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:y.bind(void 0,!0),color:"primary",variant:"contained",children:l?"Update Test Case":"Add Test Case"}),!l&&(0,a.jsx)(o.Z,{onClick:y.bind(void 0,!1),color:"primary",variant:"contained",children:"Add Another"}),(0,a.jsx)(o.Z,{onClick:c,color:"secondary",children:"Cancel"})]})]})},ee=e=>{let{varsList:t}=e,{testCases:i,setTestCases:s}=(0,l.o)(),[c,d]=r.useState(null),[p,u]=r.useState(!1),h=(e,t)=>{e.stopPropagation(),confirm("Are you sure you want to delete this test case?")&&s(i.filter((e,n)=>n!==t))},m=(e,t)=>{e.stopPropagation();let n=JSON.parse(JSON.stringify(i[t]));s([...i,n])};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(x.Z,{direction:"row",spacing:2,mb:2,justifyContent:"space-between",children:[(0,a.jsx)(f.Z,{variant:"h5",children:"Test Cases"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"file-input-add-test-case",children:(0,a.jsx)(w.Z,{title:"Upload test cases from csv",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(E.Z,{component:"span",children:(0,a.jsx)(A.Z,{})}),(0,a.jsx)("input",{id:"file-input-add-test-case",type:"file",accept:".csv",onChange:e=>{var t;e.stopPropagation(),e.preventDefault();let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(a){let e=new FileReader;e.onload=async e=>{var t,a;let r=null===(a=e.target)||void 0===a?void 0:null===(t=a.result)||void 0===t?void 0:t.toString();if(r){let{parse:e}=await Promise.all([n.e(631),n.e(887)]).then(n.bind(n,83887)),t=e(r,{columns:!0}),a=t.map(e=>(0,X.It)(e));s([...i,...a])}},e.readAsText(a)}},style:{display:"none"}})]})})}),(0,a.jsx)(o.Z,{color:"primary",onClick:()=>u(!0),variant:"contained",children:"Add Test Case"})]})]}),(0,a.jsx)(O.Z,{children:(0,a.jsxs)(I.Z,{children:[(0,a.jsx)(G.Z,{children:(0,a.jsxs)(T.Z,{children:[(0,a.jsx)(P.Z,{children:"Description"}),(0,a.jsx)(P.Z,{children:"Assertions"}),(0,a.jsx)(P.Z,{children:"Variables"}),(0,a.jsx)(P.Z,{align:"right"})]})}),(0,a.jsx)(S.Z,{children:0===i.length?(0,a.jsx)(T.Z,{children:(0,a.jsx)(P.Z,{colSpan:4,align:"center",children:"No test cases added yet."})}):i.map((e,t)=>{var n;return(0,a.jsxs)(T.Z,{sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",cursor:"pointer"}},onClick:()=>{d(t),u(!0)},children:[(0,a.jsx)(P.Z,{children:(0,a.jsx)(f.Z,{variant:"body2",children:e.description||"Test Case #".concat(t+1)})}),(0,a.jsxs)(P.Z,{children:[(null===(n=e.assert)||void 0===n?void 0:n.length)||0," assertions"]}),(0,a.jsx)(P.Z,{children:Object.entries(e.vars||{}).map(e=>{let[t,n]=e;return t+"="+n}).join(", ")}),(0,a.jsxs)(P.Z,{align:"right",sx:{minWidth:150},children:[(0,a.jsx)(E.Z,{onClick:()=>{d(t),u(!0)},size:"small",children:(0,a.jsx)(k.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>m(e,t),size:"small",children:(0,a.jsx)(_.Z,{})}),(0,a.jsx)(E.Z,{onClick:e=>h(e,t),size:"small",children:(0,a.jsx)(C.Z,{})})]})]},t)})})]})}),(0,a.jsx)(Q,{open:p,onAdd:(e,t)=>{if(null===c)s([...i,e]);else{let t=i.map((t,n)=>n===c?e:t);s(t),d(null)}t&&u(!1)},varsList:t,initialValues:null===c?void 0:i[c],onCancel:()=>{d(null),u(!1)}})]})},et=n(71911),en=n.n(et),ea=n(29963),er=n(20505),ei=n(41101),el=n(34235),es=n(38640),eo=n.n(es),ec=n(29270);n(54492),n(55096),n(93486);var ed=()=>{let e="dark"===(0,ei.Z)().palette.mode,{defaultTest:t,setDefaultTest:n,description:i,setDescription:c,env:d,setEnv:p,evaluateOptions:u,setEvaluateOptions:h,prompts:m,setPrompts:x,providers:j,setProviders:v,scenarios:g,setScenarios:Z,testCases:b,setTestCases:y}=(0,l.o)(),[_,C]=r.useState(""),[A,E]=r.useState(!0),I=e=>{n(e.defaultTest||{}),c(e.description||""),p(e.env||{}),h(e.evaluateOptions||{}),x(e.prompts||[]),v(e.providers||[]),Z(e.scenarios||[]),y(e.tests||[])};return r.useEffect(()=>{C(el.default.dump({defaultTest:t,description:i,env:d,evaluateOptions:u,prompts:m,providers:j,scenarios:g,tests:b}))},[t,i,d,u,m,j,g,b]),(0,a.jsxs)(s.Z,{mt:4,children:[(0,a.jsx)(f.Z,{variant:"h5",gutterBottom:!0,children:"Configuration"}),(0,a.jsxs)(f.Z,{variant:"body1",gutterBottom:!0,children:["This is the YAML config that defines the evaluation and is processed by promptfoo. See"," ",(0,a.jsx)(eo(),{target:"_blank",href:"https://promptfoo.dev/docs/configuration/guide",children:"configuration docs"})," ","to learn more."]}),(0,a.jsxs)(s.Z,{display:"flex",gap:2,mb:2,children:[(0,a.jsx)(o.Z,{variant:"text",color:"primary",startIcon:A?(0,a.jsx)(k.Z,{}):(0,a.jsx)(ea.Z,{}),onClick:()=>{if(!A)try{let e=el.default.load(_,{json:!0});I(e)}catch(e){}E(!A)},children:A?"Edit YAML":"Save"}),(0,a.jsxs)(o.Z,{variant:"text",color:"primary",startIcon:(0,a.jsx)(er.Z,{}),component:"label",children:["Upload YAML",(0,a.jsx)("input",{type:"file",hidden:!0,accept:".yaml,.yml",onChange:e=>{var t;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){let e=new FileReader;e.onload=e=>{var t;let n=null===(t=e.target)||void 0===t?void 0:t.result;C(n);try{let e=el.default.load(n,{json:!0});I(e)}catch(e){console.error("Error parsing uploaded YAML:",e)}},e.readAsText(n)}}})]})]}),(0,a.jsx)(en(),{autoCapitalize:"off",value:_,onValueChange:e=>{A||C(e)},highlight:e=>(0,ec.highlight)(e,ec.languages.yaml),padding:10,style:{backgroundColor:e?"#1e1e1e":"#fff",fontFamily:'"Fira code", "Fira Mono", monospace',fontSize:14},disabled:A,className:A?"":"glowing-border"})]})};n(7517);var ep=n(77580);function eu(e){let{error:t,resetErrorBoundary:n}=e;return(0,a.jsxs)("div",{role:"alert",children:[(0,a.jsx)("p",{children:"Something went wrong:"}),(0,a.jsx)("pre",{children:t.message}),(0,a.jsx)("button",{onClick:n,children:"Try again"})]})}var eh=()=>{let[e,t]=(0,r.useState)(!1),{setDescription:n,providers:j,setProviders:v,prompts:g,setPrompts:Z,setTestCases:b}=(0,l.o)();if((0,r.useEffect)(()=>{l.o.persist.rehydrate()},[]),ep.env.NEXT_PUBLIC_NO_BROWSING)return null;let _=(e=>{let t=/{{\s*(\w+)\s*}}/g,n=new Set;return e.forEach(e=>{let a;for(;null!==(a=t.exec(e));)n.add(a[1])}),Array.from(n)})(g);return(0,a.jsxs)(c.Z,{maxWidth:"lg",sx:{marginTop:"2rem"},children:[(0,a.jsxs)(x.Z,{direction:"row",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.Z,{variant:"h4",children:"Set up an evaluation"}),(0,a.jsxs)(x.Z,{direction:"row",spacing:2,children:[(0,a.jsx)(D,{}),(0,a.jsx)(y,{}),(0,a.jsx)(o.Z,{variant:"outlined",color:"primary",onClick:()=>t(!0),children:"Reset"})]})]}),(0,a.jsx)(s.Z,{mt:4}),(0,a.jsx)(s.Z,{mt:2,children:(0,a.jsx)(i.SV,{FallbackComponent:eu,onReset:()=>{v([])},children:(0,a.jsxs)(x.Z,{direction:"column",spacing:2,justifyContent:"space-between",children:[(0,a.jsx)(f.Z,{variant:"h5",children:"Providers"}),(0,a.jsx)(L,{providers:j,onChange:v})]})})}),(0,a.jsx)(s.Z,{mt:4}),(0,a.jsx)(i.SV,{FallbackComponent:eu,onReset:()=>{Z([])},children:(0,a.jsx)(W,{})}),(0,a.jsx)(s.Z,{mt:6}),(0,a.jsx)(i.SV,{FallbackComponent:eu,onReset:()=>{b([])},children:(0,a.jsx)(ee,{varsList:_})}),(0,a.jsx)(ed,{}),(0,a.jsxs)(d.Z,{open:e,onClose:()=>t(!1),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,a.jsx)(m.Z,{id:"alert-dialog-title",children:"Confirm Reset"}),(0,a.jsx)(u.Z,{children:(0,a.jsx)(h.Z,{id:"alert-dialog-description",children:"Are you sure you want to reset all the fields? This action cannot be undone."})}),(0,a.jsxs)(p.Z,{children:[(0,a.jsx)(o.Z,{onClick:()=>t(!1),children:"Cancel"}),(0,a.jsx)(o.Z,{onClick:()=>{n(""),v([]),Z([]),b([]),t(!1)},autoFocus:!0,children:"Reset"})]})]})]})}},52428:function(e,t,n){"use strict";n.d(t,{O:function(){return i},T:function(){return r}});var a=n(77580);let r=!a.env.NEXT_PUBLIC_HOSTED,i=!!a.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE},82911:function(e,t,n){"use strict";var a=n(94660),r=n(74810);let i=(0,a.Ue)()((0,r.tJ)(e=>({apiBaseUrl:"",setApiBaseUrl:t=>e({apiBaseUrl:t}),fetchingPromise:null,setFetchingPromise:t=>e({fetchingPromise:t})}),{name:"api-config-storage",partialize:e=>({apiBaseUrl:e.apiBaseUrl})}));t.Z=i},47887:function(e,t,n){"use strict";n.d(t,{o:function(){return i}});var a=n(94660),r=n(74810);let i=(0,a.Ue)()((0,r.tJ)((e,t)=>({env:{},testCases:[],description:"",providers:[],prompts:[],defaultTest:{},evaluateOptions:{},scenarios:[],setEnv:t=>e({env:t}),setTestCases:t=>e({testCases:t}),setDescription:t=>e({description:t}),setProviders:t=>e({providers:t}),setPrompts:t=>e({prompts:t}),setDefaultTest:t=>e({defaultTest:t}),setEvaluateOptions:t=>e({evaluateOptions:t}),setScenarios:t=>e({scenarios:t}),setStateFromConfig:t=>{let n={};t.description&&(n.description=t.description||""),t.tests&&(n.testCases=t.tests),t.providers&&(n.providers=t.providers),t.prompts&&("string"==typeof t.prompts?n.prompts=[t.prompts]:Array.isArray(t.prompts)?n.prompts=t.prompts.filter(e=>"string"==typeof e&&!e.endsWith(".txt")&&!e.endsWith(".json")&&!e.endsWith(".yaml")):console.warn("Invalid prompts config",t.prompts)),t.defaultTest&&(n.defaultTest=t.defaultTest),t.evaluateOptions&&(n.evaluateOptions=t.evaluateOptions),t.scenarios&&(n.scenarios=t.scenarios),e(n)},getTestSuite:()=>{let{description:e,testCases:n,providers:a,prompts:r,env:i,scenarios:l}=t();return{env:i,description:e,providers:a,prompts:r,tests:n,scenarios:l}}}),{name:"promptfoo",skipHydration:!0}))},94499:function(){},55096:function(){},7517:function(){},15320:function(e,t){"use strict";t.It=function(e){let t,n,a,r;let i={},l=[],s={};for(let[o,c]of Object.entries(e))o.startsWith("__expected")?""!==c.trim()&&l.push(function(e){if(e.startsWith("javascript:")||e.startsWith("fn:")||e.startsWith("eval:")){let t;e.startsWith("javascript:")&&(t=11),e.startsWith("fn:")&&(t=3),e.startsWith("eval:")&&(t=5);let n=e.slice(t).trim();return{type:"javascript",value:n}}if(e.startsWith("grade:")||e.startsWith("llm-rubric:"))return{type:"llm-rubric",value:e.slice(6)};if(e.startsWith("python:")){let t=e.slice(7).trim();return{type:"python",value:t}}let t=e.match(/^(not-)?(equals|contains-any|contains-all|icontains-any|icontains-all|contains-json|is-json|is-sql|regex|icontains|contains|webhook|rouge-n|similar|starts-with|levenshtein|classifier|model-graded-factuality|factuality|model-graded-closedqa|answer-relevance|context-recall|context-relevance|context-faithfulness|is-valid-openai-function-call|is-valid-openai-tools-call|latency|perplexity|perplexity-score|cost)(?:\((\d+(?:\.\d+)?)\))?(?::([\s\S]*))?$/);if(t){let[e,n,a,r,i]=t,l=n?`not-${a}`:a,s=Number.parseFloat(r);return"contains-any"===a||"contains-all"===a||"icontains-any"===a||"icontains-all"===a?{type:l,value:i.split(",").map(e=>e.trim())}:"contains-json"===a||"is-json"===a?{type:l,value:i}:"rouge-n"===a||"similar"===a||"starts-with"===a||"levenshtein"===a||"classifier"===a||"answer-relevance"===a||"context-recall"===a||"context-relevance"===a||"context-faithfulness"===a||"latency"===a||"perplexity"===a||"perplexity-score"===a||"cost"===a?{type:l,value:i,threshold:s||("similar"===a?.8:.75)}:{type:l,value:i}}return{type:"equals",value:e}}(c)):"__prefix"===o?s.prefix=c:"__suffix"===o?s.suffix=c:"__description"===o?n=c:"__providerOutput"===o?t=c:"__metric"===o?a=c:"__threshold"===o?r=Number.parseFloat(c):i[o]=c;for(let e of l)e.metric=a;return{vars:i,assert:l,options:s,...n?{description:n}:{},...t?{providerOutput:t}:{},...r?{threshold:r}:{}}}}},function(e){e.O(0,[906,640,461,88,113,975,417,874,235,972,782,470,730,744],function(){return e(e.s=8458)}),_N_E=e.O()}]);
|