promptfoo 0.72.1 → 0.73.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 +5 -5
- package/dist/package.json +14 -8
- package/dist/src/accounts.d.ts.map +1 -1
- package/dist/src/accounts.js +2 -1
- package/dist/src/accounts.js.map +1 -1
- package/dist/src/assertions/validateAssertions.d.ts +1 -1
- package/dist/src/assertions/validateAssertions.d.ts.map +1 -1
- package/dist/src/assertions/validateAssertions.js +7 -7
- package/dist/src/assertions/validateAssertions.js.map +1 -1
- package/dist/src/assertions.d.ts.map +1 -1
- package/dist/src/assertions.js +2 -1
- package/dist/src/assertions.js.map +1 -1
- package/dist/src/cache.js +2 -2
- package/dist/src/cache.js.map +1 -1
- package/dist/src/commands/eval.d.ts.map +1 -1
- package/dist/src/commands/eval.js +10 -0
- package/dist/src/commands/eval.js.map +1 -1
- package/dist/src/commands/export.d.ts.map +1 -1
- package/dist/src/commands/export.js +15 -14
- package/dist/src/commands/export.js.map +1 -1
- package/dist/src/commands/generate/redteam.d.ts +1 -46
- package/dist/src/commands/generate/redteam.d.ts.map +1 -1
- package/dist/src/commands/generate/redteam.js +70 -26
- package/dist/src/commands/generate/redteam.js.map +1 -1
- package/dist/src/commands/import.d.ts.map +1 -1
- package/dist/src/commands/import.js +2 -1
- package/dist/src/commands/import.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +12 -0
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/redteam.d.ts.map +1 -1
- package/dist/src/commands/redteam.js +72 -18
- package/dist/src/commands/redteam.js.map +1 -1
- package/dist/src/commands/view.d.ts.map +1 -1
- package/dist/src/commands/view.js +2 -1
- package/dist/src/commands/view.js.map +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +2 -20
- package/dist/src/config.js.map +1 -1
- package/dist/src/configTypes.d.ts +7 -0
- package/dist/src/configTypes.d.ts.map +1 -0
- package/dist/src/configTypes.js +3 -0
- package/dist/src/configTypes.js.map +1 -0
- package/dist/src/database/index.d.ts +4 -0
- package/dist/src/database/index.d.ts.map +1 -0
- package/dist/src/database/index.js +50 -0
- package/dist/src/database/index.js.map +1 -0
- package/dist/src/{database.d.ts → database/operations.d.ts} +173 -115
- package/dist/src/{database.d.ts.map → database/operations.d.ts.map} +1 -1
- package/dist/src/{database.js → database/operations.js} +1 -25
- package/dist/src/database/operations.js.map +1 -0
- package/dist/src/evaluator.js +2 -2
- package/dist/src/evaluator.js.map +1 -1
- package/dist/src/globalConfig.d.ts +1 -7
- package/dist/src/globalConfig.d.ts.map +1 -1
- package/dist/src/globalConfig.js +3 -3
- package/dist/src/globalConfig.js.map +1 -1
- package/dist/src/matchers.d.ts.map +1 -1
- package/dist/src/matchers.js +6 -2
- package/dist/src/matchers.js.map +1 -1
- package/dist/src/prompts/grading.js +2 -2
- package/dist/src/prompts/processors/python.js +4 -4
- package/dist/src/prompts/processors/python.js.map +1 -1
- package/dist/src/providers/anthropic.d.ts +1 -1
- package/dist/src/providers/anthropic.d.ts.map +1 -1
- package/dist/src/providers/bam.d.ts +1 -1
- package/dist/src/providers/bam.d.ts.map +1 -1
- package/dist/src/providers/bedrock.d.ts +1 -1
- package/dist/src/providers/bedrock.d.ts.map +1 -1
- package/dist/src/providers/cohere.d.ts.map +1 -1
- package/dist/src/providers/cohere.js +4 -1
- package/dist/src/providers/cohere.js.map +1 -1
- package/dist/src/providers/http.d.ts +1 -1
- package/dist/src/providers/http.d.ts.map +1 -1
- package/dist/src/providers/http.js +3 -3
- package/dist/src/providers/http.js.map +1 -1
- package/dist/src/providers/llama.d.ts +1 -1
- package/dist/src/providers/llama.d.ts.map +1 -1
- package/dist/src/providers/localai.d.ts +1 -1
- package/dist/src/providers/localai.d.ts.map +1 -1
- package/dist/src/providers/ollama.d.ts +1 -1
- package/dist/src/providers/ollama.d.ts.map +1 -1
- package/dist/src/providers/openai.d.ts +1 -1
- package/dist/src/providers/openai.d.ts.map +1 -1
- package/dist/src/providers/openai.js +48 -50
- package/dist/src/providers/openai.js.map +1 -1
- package/dist/src/providers/palm.d.ts +1 -1
- package/dist/src/providers/palm.d.ts.map +1 -1
- package/dist/src/providers/pythonCompletion.d.ts.map +1 -1
- package/dist/src/providers/pythonCompletion.js +6 -5
- package/dist/src/providers/pythonCompletion.js.map +1 -1
- package/dist/src/providers/replicate.js +2 -2
- package/dist/src/providers/replicate.js.map +1 -1
- package/dist/src/providers/scriptCompletion.js +3 -3
- package/dist/src/providers/scriptCompletion.js.map +1 -1
- package/dist/src/providers/vertex.d.ts +1 -1
- package/dist/src/providers/vertex.d.ts.map +1 -1
- package/dist/src/providers/vertex.js +23 -10
- package/dist/src/providers/vertex.js.map +1 -1
- package/dist/src/providers/vertexUtil.d.ts +2 -1
- package/dist/src/providers/vertexUtil.d.ts.map +1 -1
- package/dist/src/providers/vertexUtil.js.map +1 -1
- package/dist/src/providers/webhook.d.ts +1 -1
- package/dist/src/providers/webhook.d.ts.map +1 -1
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +5 -2
- package/dist/src/providers.js.map +1 -1
- package/dist/src/python/pythonUtils.d.ts +4 -0
- package/dist/src/python/pythonUtils.d.ts.map +1 -0
- package/dist/src/python/pythonUtils.js +51 -0
- package/dist/src/python/pythonUtils.js.map +1 -0
- package/dist/src/python/wrapper.d.ts +0 -10
- package/dist/src/python/wrapper.d.ts.map +1 -1
- package/dist/src/python/wrapper.js +2 -49
- package/dist/src/python/wrapper.js.map +1 -1
- package/dist/src/redteam/constants.d.ts +60 -3
- package/dist/src/redteam/constants.d.ts.map +1 -1
- package/dist/src/redteam/constants.js +71 -10
- package/dist/src/redteam/constants.js.map +1 -1
- package/dist/src/redteam/index.d.ts +15 -4
- package/dist/src/redteam/index.d.ts.map +1 -1
- package/dist/src/redteam/index.js +110 -33
- package/dist/src/redteam/index.js.map +1 -1
- package/dist/src/redteam/plugins/base.d.ts +10 -13
- package/dist/src/redteam/plugins/base.d.ts.map +1 -1
- package/dist/src/redteam/plugins/base.js +36 -20
- package/dist/src/redteam/plugins/base.js.map +1 -1
- package/dist/src/redteam/plugins/debugInterface.d.ts +7 -0
- package/dist/src/redteam/plugins/debugInterface.d.ts.map +1 -0
- package/dist/src/redteam/plugins/debugInterface.js +49 -0
- package/dist/src/redteam/plugins/debugInterface.js.map +1 -0
- package/dist/src/redteam/plugins/harmful.d.ts +1 -54
- package/dist/src/redteam/plugins/harmful.d.ts.map +1 -1
- package/dist/src/redteam/plugins/harmful.js +8 -51
- package/dist/src/redteam/plugins/harmful.js.map +1 -1
- package/dist/src/redteam/plugins/pii.d.ts +9 -10
- package/dist/src/redteam/plugins/pii.d.ts.map +1 -1
- package/dist/src/redteam/plugins/pii.js +33 -53
- package/dist/src/redteam/plugins/pii.js.map +1 -1
- package/dist/src/redteam/plugins/rbac.d.ts +7 -0
- package/dist/src/redteam/plugins/rbac.d.ts.map +1 -0
- package/dist/src/redteam/plugins/rbac.js +49 -0
- package/dist/src/redteam/plugins/rbac.js.map +1 -0
- package/dist/src/redteam/plugins/shellInjection.d.ts +7 -0
- package/dist/src/redteam/plugins/shellInjection.d.ts.map +1 -0
- package/dist/src/redteam/plugins/shellInjection.js +54 -0
- package/dist/src/redteam/plugins/shellInjection.js.map +1 -0
- package/dist/src/redteam/plugins/sqlInjection.d.ts +7 -0
- package/dist/src/redteam/plugins/sqlInjection.d.ts.map +1 -0
- package/dist/src/redteam/plugins/sqlInjection.js +44 -0
- package/dist/src/redteam/plugins/sqlInjection.js.map +1 -0
- package/dist/src/redteam/providers/iterative.d.ts.map +1 -1
- package/dist/src/redteam/providers/iterative.js +2 -1
- package/dist/src/redteam/providers/iterative.js.map +1 -1
- package/dist/src/redteam/strategies/injections.d.ts.map +1 -0
- package/dist/src/redteam/{methods → strategies}/injections.js +0 -12
- package/dist/src/redteam/strategies/injections.js.map +1 -0
- package/dist/src/redteam/strategies/iterative.d.ts.map +1 -0
- package/dist/src/redteam/strategies/iterative.js.map +1 -0
- package/dist/src/redteam/types.d.ts +196 -0
- package/dist/src/redteam/types.d.ts.map +1 -0
- package/dist/src/redteam/types.js +124 -0
- package/dist/src/redteam/types.js.map +1 -0
- package/dist/src/redteam/util.d.ts +22 -0
- package/dist/src/redteam/util.d.ts.map +1 -0
- package/dist/src/redteam/util.js +56 -0
- package/dist/src/redteam/util.js.map +1 -0
- package/dist/src/testCases.d.ts +1 -2
- package/dist/src/testCases.d.ts.map +1 -1
- package/dist/src/testCases.js.map +1 -1
- package/dist/src/types/databaseTypes.d.ts +17 -0
- package/dist/src/types/databaseTypes.d.ts.map +1 -0
- package/dist/src/types/databaseTypes.js +3 -0
- package/dist/src/types/databaseTypes.js.map +1 -0
- package/dist/src/{types.d.ts → types/index.d.ts} +4296 -1425
- package/dist/src/{types.d.ts.map → types/index.d.ts.map} +1 -1
- package/dist/src/{types.js → types/index.js} +38 -9
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/util/config.d.ts +3 -0
- package/dist/src/util/config.d.ts.map +1 -0
- package/dist/src/util/config.js +42 -0
- package/dist/src/util/config.js.map +1 -0
- package/dist/src/util/index.d.ts +41 -25
- package/dist/src/util/index.d.ts.map +1 -1
- package/dist/src/util/index.js +81 -119
- package/dist/src/util/index.js.map +1 -1
- package/dist/src/util/json.d.ts +3 -0
- package/dist/src/util/json.d.ts.map +1 -0
- package/dist/src/util/json.js +27 -0
- package/dist/src/util/json.js.map +1 -0
- package/dist/src/web/nextui/404/index.html +1 -1
- package/dist/src/web/nextui/404.html +1 -1
- package/dist/src/web/nextui/_next/static/chunks/155-4e319e68476266ee.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/163-93bab94bc04ae71b.js +6 -0
- package/dist/src/web/nextui/_next/static/chunks/{258-4acb452fe85cff6f.js → 258-b6257e5de9d0e2c7.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/281-64d9f1415a301ee5.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/304-cf667fe8f06238b4.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/322-b47b6cc3f5b5fdb8.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/325-0d36870ade5e5263.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/339-79124d204fa988a3.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/378-c135e497df1864cb.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/476-0afb5eb266c57b7f.js +17 -0
- package/dist/src/web/nextui/_next/static/chunks/493-ebd12f00541c4969.js +2 -0
- package/dist/src/web/nextui/_next/static/chunks/497-e280a5610a3d7d42.js +32 -0
- package/dist/src/web/nextui/_next/static/chunks/515-e06d044f12d8a1bd.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/69-5e4d5e60859a86d2.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/737-32d5472455807d7a.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/903-7cc440d9f9e9f95d.js +97 -0
- package/dist/src/web/nextui/_next/static/chunks/905-78cd666f27891ee6.js +28 -0
- package/dist/src/web/nextui/_next/static/chunks/916-b92fea2ab6136411.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/969-6ab6c8f4158da970.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/auth/login/page-7247b17e8f179a46.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/page-8560afaf494f9882.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-6e6ec3c778ccd110.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-fe10d5df88bc44ef.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/{page-0a39d3450aa09dda.js → page-057e5eb83e0f614b.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-88fa70fc5bf755bc.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/layout-15abf0d1049cb47c.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/{page-5650318e57510b6c.js → page-122e9cfa52eb218a.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/app/progress/page-a62ca531a4bb4149.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-10bb2e571670139c.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/report/page-a8b83960f08e2bb2.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/setup/page-6ea3e180c3116fb2.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/{main-app-929a26b3c8cd3f7a.js → main-app-7a1376166cb8b72e.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/{webpack-c9f728822666f852.js → webpack-ee33d95b3e219985.js} +1 -1
- package/dist/src/web/nextui/_next/static/css/13f881e4290b6d59.css +1 -0
- package/dist/src/web/nextui/_next/static/css/87b5e6e04efd27e5.css +1 -0
- package/dist/src/web/nextui/_next/static/css/e17fdafd8599f69b.css +1 -0
- package/dist/src/web/nextui/_next/static/css/eb523daddb89dfc1.css +1 -0
- package/dist/src/web/nextui/auth/login/index.html +1 -1
- package/dist/src/web/nextui/auth/login/index.txt +6 -6
- package/dist/src/web/nextui/auth/signup/index.html +1 -1
- package/dist/src/web/nextui/auth/signup/index.txt +6 -6
- package/dist/src/web/nextui/datasets/index.html +1 -1
- package/dist/src/web/nextui/datasets/index.txt +6 -6
- package/dist/src/web/nextui/eval/index.html +1 -1
- package/dist/src/web/nextui/eval/index.txt +8 -8
- package/dist/src/web/nextui/index.html +1 -1
- package/dist/src/web/nextui/index.txt +5 -5
- package/dist/src/web/nextui/logo-panda.svg +91 -0
- package/dist/src/web/nextui/progress/index.html +1 -1
- package/dist/src/web/nextui/progress/index.txt +6 -6
- package/dist/src/web/nextui/prompts/index.html +1 -1
- package/dist/src/web/nextui/prompts/index.txt +6 -6
- package/dist/src/web/nextui/report/index.html +1 -1
- package/dist/src/web/nextui/report/index.txt +8 -8
- package/dist/src/web/nextui/setup/index.html +1 -1
- package/dist/src/web/nextui/setup/index.txt +7 -7
- package/dist/test/__mocks__/tempCustomModule.d.ts +13 -0
- package/dist/test/__mocks__/tempCustomModule.d.ts.map +1 -0
- package/dist/test/__mocks__/tempCustomModule.js +15 -0
- package/dist/test/__mocks__/tempCustomModule.js.map +1 -0
- package/dist/test/account.test.d.ts +2 -0
- package/dist/test/account.test.d.ts.map +1 -0
- package/dist/test/account.test.js +46 -0
- package/dist/test/account.test.js.map +1 -0
- package/dist/test/assertions/AssertionResult.test.d.ts +2 -0
- package/dist/test/assertions/AssertionResult.test.d.ts.map +1 -0
- package/dist/test/assertions/AssertionResult.test.js +184 -0
- package/dist/test/assertions/AssertionResult.test.js.map +1 -0
- package/dist/test/assertions/validateAssertions.test.d.ts +2 -0
- package/dist/test/assertions/validateAssertions.test.d.ts.map +1 -0
- package/dist/test/assertions/validateAssertions.test.js +40 -0
- package/dist/test/assertions/validateAssertions.test.js.map +1 -0
- package/dist/test/assertions.test.d.ts +2 -0
- package/dist/test/assertions.test.d.ts.map +1 -0
- package/dist/test/assertions.test.js +3162 -0
- package/dist/test/assertions.test.js.map +1 -0
- package/dist/test/cache.test.d.ts +2 -0
- package/dist/test/cache.test.d.ts.map +1 -0
- package/dist/test/cache.test.js +90 -0
- package/dist/test/cache.test.js.map +1 -0
- package/dist/test/checkNodeVersion.test.d.ts +2 -0
- package/dist/test/checkNodeVersion.test.d.ts.map +1 -0
- package/dist/test/checkNodeVersion.test.js +85 -0
- package/dist/test/checkNodeVersion.test.js.map +1 -0
- package/dist/test/commands/eval/filterFailingTests.test.d.ts +2 -0
- package/dist/test/commands/eval/filterFailingTests.test.d.ts.map +1 -0
- package/dist/test/commands/eval/filterFailingTests.test.js +84 -0
- package/dist/test/commands/eval/filterFailingTests.test.js.map +1 -0
- package/dist/test/commands/eval/filterProviders.test.d.ts +2 -0
- package/dist/test/commands/eval/filterProviders.test.d.ts.map +1 -0
- package/dist/test/commands/eval/filterProviders.test.js +50 -0
- package/dist/test/commands/eval/filterProviders.test.js.map +1 -0
- package/dist/test/commands/eval/filterTests.test.d.ts +2 -0
- package/dist/test/commands/eval/filterTests.test.d.ts.map +1 -0
- package/dist/test/commands/eval/filterTests.test.js +51 -0
- package/dist/test/commands/eval/filterTests.test.js.map +1 -0
- package/dist/test/config.test.d.ts +2 -0
- package/dist/test/config.test.d.ts.map +1 -0
- package/dist/test/config.test.js +404 -0
- package/dist/test/config.test.js.map +1 -0
- package/dist/test/csv.test.d.ts +2 -0
- package/dist/test/csv.test.d.ts.map +1 -0
- package/dist/test/csv.test.js +239 -0
- package/dist/test/csv.test.js.map +1 -0
- package/dist/test/evaluator.test.d.ts +2 -0
- package/dist/test/evaluator.test.d.ts.map +1 -0
- package/dist/test/evaluator.test.js +922 -0
- package/dist/test/evaluator.test.js.map +1 -0
- package/dist/test/globalConfig.test.d.ts +2 -0
- package/dist/test/globalConfig.test.d.ts.map +1 -0
- package/dist/test/globalConfig.test.js +91 -0
- package/dist/test/globalConfig.test.js.map +1 -0
- package/dist/test/is-sql-tests/node-sql-parser.test.d.ts +2 -0
- package/dist/test/is-sql-tests/node-sql-parser.test.d.ts.map +1 -0
- package/dist/test/is-sql-tests/node-sql-parser.test.js +179 -0
- package/dist/test/is-sql-tests/node-sql-parser.test.js.map +1 -0
- package/dist/test/matchers.test.d.ts +2 -0
- package/dist/test/matchers.test.d.ts.map +1 -0
- package/dist/test/matchers.test.js +807 -0
- package/dist/test/matchers.test.js.map +1 -0
- package/dist/test/prompts.processors.javascript.test.d.ts +2 -0
- package/dist/test/prompts.processors.javascript.test.d.ts.map +1 -0
- package/dist/test/prompts.processors.javascript.test.js +93 -0
- package/dist/test/prompts.processors.javascript.test.js.map +1 -0
- package/dist/test/prompts.processors.json.test.d.ts +2 -0
- package/dist/test/prompts.processors.json.test.d.ts.map +1 -0
- package/dist/test/prompts.processors.json.test.js +67 -0
- package/dist/test/prompts.processors.json.test.js.map +1 -0
- package/dist/test/prompts.processors.jsonl.test.d.ts +2 -0
- package/dist/test/prompts.processors.jsonl.test.d.ts.map +1 -0
- package/dist/test/prompts.processors.jsonl.test.js +99 -0
- package/dist/test/prompts.processors.jsonl.test.js.map +1 -0
- package/dist/test/prompts.processors.python.test.d.ts +2 -0
- package/dist/test/prompts.processors.python.test.d.ts.map +1 -0
- package/dist/test/prompts.processors.python.test.js +100 -0
- package/dist/test/prompts.processors.python.test.js.map +1 -0
- package/dist/test/prompts.processors.python.utils.test.d.ts +2 -0
- package/dist/test/prompts.processors.python.utils.test.d.ts.map +1 -0
- package/dist/test/prompts.processors.python.utils.test.js +68 -0
- package/dist/test/prompts.processors.python.utils.test.js.map +1 -0
- package/dist/test/prompts.processors.string.test.d.ts +2 -0
- package/dist/test/prompts.processors.string.test.d.ts.map +1 -0
- package/dist/test/prompts.processors.string.test.js +24 -0
- package/dist/test/prompts.processors.string.test.js.map +1 -0
- package/dist/test/prompts.processors.text.test.d.ts +2 -0
- package/dist/test/prompts.processors.text.test.d.ts.map +1 -0
- package/dist/test/prompts.processors.text.test.js +109 -0
- package/dist/test/prompts.processors.text.test.js.map +1 -0
- package/dist/test/prompts.processors.yaml.test.d.ts +2 -0
- package/dist/test/prompts.processors.yaml.test.d.ts.map +1 -0
- package/dist/test/prompts.processors.yaml.test.js +76 -0
- package/dist/test/prompts.processors.yaml.test.js.map +1 -0
- package/dist/test/prompts.test.d.ts +2 -0
- package/dist/test/prompts.test.d.ts.map +1 -0
- package/dist/test/prompts.test.js +562 -0
- package/dist/test/prompts.test.js.map +1 -0
- package/dist/test/prompts.utils.test.d.ts +2 -0
- package/dist/test/prompts.utils.test.d.ts.map +1 -0
- package/dist/test/prompts.utils.test.js +123 -0
- package/dist/test/prompts.utils.test.js.map +1 -0
- package/dist/test/providers.anthropic.test.d.ts +2 -0
- package/dist/test/providers.anthropic.test.d.ts.map +1 -0
- package/dist/test/providers.anthropic.test.js +520 -0
- package/dist/test/providers.anthropic.test.js.map +1 -0
- package/dist/test/providers.azure.test.d.ts +2 -0
- package/dist/test/providers.azure.test.d.ts.map +1 -0
- package/dist/test/providers.azure.test.js +96 -0
- package/dist/test/providers.azure.test.js.map +1 -0
- package/dist/test/providers.bedrock.test.d.ts +2 -0
- package/dist/test/providers.bedrock.test.d.ts.map +1 -0
- package/dist/test/providers.bedrock.test.js +349 -0
- package/dist/test/providers.bedrock.test.js.map +1 -0
- package/dist/test/providers.http.test.d.ts +2 -0
- package/dist/test/providers.http.test.d.ts.map +1 -0
- package/dist/test/providers.http.test.js +130 -0
- package/dist/test/providers.http.test.js.map +1 -0
- package/dist/test/providers.llama.test.d.ts +2 -0
- package/dist/test/providers.llama.test.d.ts.map +1 -0
- package/dist/test/providers.llama.test.js +101 -0
- package/dist/test/providers.llama.test.js.map +1 -0
- package/dist/test/providers.pythonCompletion.test.d.ts +2 -0
- package/dist/test/providers.pythonCompletion.test.d.ts.map +1 -0
- package/dist/test/providers.pythonCompletion.test.js +149 -0
- package/dist/test/providers.pythonCompletion.test.js.map +1 -0
- package/dist/test/providers.test.d.ts +2 -0
- package/dist/test/providers.test.d.ts.map +1 -0
- package/dist/test/providers.test.js +883 -0
- package/dist/test/providers.test.js.map +1 -0
- package/dist/test/providers.vertex.test.d.ts +2 -0
- package/dist/test/providers.vertex.test.d.ts.map +1 -0
- package/dist/test/providers.vertex.test.js +153 -0
- package/dist/test/providers.vertex.test.js.map +1 -0
- package/dist/test/pythonWrapper.test.d.ts +2 -0
- package/dist/test/pythonWrapper.test.d.ts.map +1 -0
- package/dist/test/pythonWrapper.test.js +65 -0
- package/dist/test/pythonWrapper.test.js.map +1 -0
- package/dist/test/redteam/plugins/base.test.d.ts +2 -0
- package/dist/test/redteam/plugins/base.test.d.ts.map +1 -0
- package/dist/test/redteam/plugins/base.test.js +149 -0
- package/dist/test/redteam/plugins/base.test.js.map +1 -0
- package/dist/test/redteam/purpose.test.d.ts +2 -0
- package/dist/test/redteam/purpose.test.d.ts.map +1 -0
- package/dist/test/redteam/purpose.test.js +37 -0
- package/dist/test/redteam/purpose.test.js.map +1 -0
- package/dist/test/redteam/types.test.d.ts +2 -0
- package/dist/test/redteam/types.test.d.ts.map +1 -0
- package/dist/test/redteam/types.test.js +325 -0
- package/dist/test/redteam/types.test.js.map +1 -0
- package/dist/test/redteam/util.test.d.ts +2 -0
- package/dist/test/redteam/util.test.d.ts.map +1 -0
- package/dist/test/redteam/util.test.js +99 -0
- package/dist/test/redteam/util.test.js.map +1 -0
- package/dist/test/telemetry.test.d.ts +2 -0
- package/dist/test/telemetry.test.d.ts.map +1 -0
- package/dist/test/telemetry.test.js +68 -0
- package/dist/test/telemetry.test.js.map +1 -0
- package/dist/test/testCases.test.d.ts +2 -0
- package/dist/test/testCases.test.d.ts.map +1 -0
- package/dist/test/testCases.test.js +362 -0
- package/dist/test/testCases.test.js.map +1 -0
- package/dist/test/updates.test.d.ts +2 -0
- package/dist/test/updates.test.d.ts.map +1 -0
- package/dist/test/updates.test.js +63 -0
- package/dist/test/updates.test.js.map +1 -0
- package/dist/test/util.templates.test.d.ts +2 -0
- package/dist/test/util.templates.test.d.ts.map +1 -0
- package/dist/test/util.templates.test.js +75 -0
- package/dist/test/util.templates.test.js.map +1 -0
- package/dist/test/util.test.d.ts +2 -0
- package/dist/test/util.test.d.ts.map +1 -0
- package/dist/test/util.test.js +661 -0
- package/dist/test/util.test.js.map +1 -0
- package/dist/test/utils.d.ts +6 -0
- package/dist/test/utils.d.ts.map +1 -0
- package/dist/test/utils.js +16 -0
- package/dist/test/utils.js.map +1 -0
- package/package.json +14 -8
- package/dist/src/database.js.map +0 -1
- package/dist/src/redteam/methods/injections.d.ts.map +0 -1
- package/dist/src/redteam/methods/injections.js.map +0 -1
- package/dist/src/redteam/methods/iterative.d.ts.map +0 -1
- package/dist/src/redteam/methods/iterative.js.map +0 -1
- package/dist/src/types.js.map +0 -1
- package/dist/src/web/nextui/_next/static/chunks/163-e65e0f7f442a0c72.js +0 -6
- package/dist/src/web/nextui/_next/static/chunks/180-46db19289d856800.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/304-9d57a2251034b801.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/322-4a0fc9b0508f47e8.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/339-db5bd05e24dde905.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/374-d40afe599198abd3.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/378-e22c8aeb8e031fad.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/448-4da3bf74eae4996a.js +0 -97
- package/dist/src/web/nextui/_next/static/chunks/53-fae6e50ace6c83a1.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/578-8efe57f906f7573c.js +0 -44
- package/dist/src/web/nextui/_next/static/chunks/620-7a5a7bf6e1fe49e5.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/737-538f50dc31cc8c49.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/905-0da344cee75690e7.js +0 -32
- package/dist/src/web/nextui/_next/static/chunks/932-75585b3be8ce494d.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/973-ffe3726c956d08ef.js +0 -2
- package/dist/src/web/nextui/_next/static/chunks/995-803c74b81e7bf6cd.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/auth/login/page-2e2c0c725127ea2d.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/page-ccdb1f6890601666.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/datasets/page-642db4f4a8e8ba40.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-ce320e6d1e6d1d23.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-32eaa14d2384c5b0.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/layout-4282b1d33566e258.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/progress/page-462526776efd6fd6.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-0ae78bc0bf7c56bc.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/report/page-e4f7851d41eb0f92.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/setup/page-6cde750ec428cd75.js +0 -1
- package/dist/src/web/nextui/_next/static/css/35ab7ce8025438b0.css +0 -1
- package/dist/src/web/nextui/_next/static/css/5bd2f45de1f3ba83.css +0 -1
- package/dist/src/web/nextui/_next/static/css/94b771e23fc5d5f5.css +0 -1
- package/dist/src/web/nextui/_next/static/css/dab5d695b3657d59.css +0 -1
- /package/dist/src/redteam/{methods → strategies}/injections.d.ts +0 -0
- /package/dist/src/redteam/{methods → strategies}/iterative.d.ts +0 -0
- /package/dist/src/redteam/{methods → strategies}/iterative.js +0 -0
- /package/dist/src/web/nextui/_next/static/{8E4q0Tmu22G1wENZyXEq0 → L-tpppAe26U-euPv62afH}/_buildManifest.js +0 -0
- /package/dist/src/web/nextui/_next/static/{8E4q0Tmu22G1wENZyXEq0 → L-tpppAe26U-euPv62afH}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[620],{47908:function(e,t,r){r.d(t,{Z:function(){return P}});var n=r(94312),o=r(79042),i=r(14978),l=r(53468),a=r(3982),s=r(31608),u=r(87286),p=r(11112),d=r(25800),c=r(46213);function f(e){return(0,c.ZP)("MuiList",e)}(0,d.Z)("MuiList",["root","padding","dense","subheader"]);var h=r(24004);let v=["children","className","component","dense","disablePadding","subheader"],m=e=>{let{classes:t,disablePadding:r,dense:n,subheader:o}=e;return(0,a.Z)({root:["root",!r&&"padding",n&&"dense",o&&"subheader"]},f,t)},Z=(0,s.ZP)("ul",{name:"MuiList",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,!r.disablePadding&&t.padding,r.dense&&t.dense,r.subheader&&t.subheader]}})(({ownerState:e})=>(0,o.Z)({listStyle:"none",margin:0,padding:0,position:"relative"},!e.disablePadding&&{paddingTop:8,paddingBottom:8},e.subheader&&{paddingTop:0})),g=i.forwardRef(function(e,t){let r=(0,u.i)({props:e,name:"MuiList"}),{children:a,className:s,component:d="ul",dense:c=!1,disablePadding:f=!1,subheader:g}=r,P=(0,n.Z)(r,v),b=i.useMemo(()=>({dense:c}),[c]),y=(0,o.Z)({},r,{component:d,dense:c,disablePadding:f}),x=m(y);return(0,h.jsx)(p.Z.Provider,{value:b,children:(0,h.jsxs)(Z,(0,o.Z)({as:d,className:(0,l.Z)(x.root,s),ref:t,ownerState:y},P,{children:[g,a]}))})});var P=g},11112:function(e,t,r){var n=r(14978);let o=n.createContext({});t.Z=o},36273:function(e,t,r){r.d(t,{Z:function(){return et}});var n=r(79042),o=r(94312),i=r(14978);r(54184);var l=r(53468),a=r(3982),s=r(80157),u=r(19617),p=r(62302),d=r(47908),c=r(65349).Z,f=r(41776),h=r(16656),v=r(24004);let m=["actions","autoFocus","autoFocusItem","children","className","disabledItemsFocusable","disableListWrap","onKeyDown","variant"];function Z(e,t,r){return e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:r?null:e.firstChild}function g(e,t,r){return e===t?r?e.firstChild:e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:r?null:e.lastChild}function P(e,t){if(void 0===t)return!0;let r=e.innerText;return void 0===r&&(r=e.textContent),0!==(r=r.trim().toLowerCase()).length&&(t.repeating?r[0]===t.keys[0]:0===r.indexOf(t.keys.join("")))}function b(e,t,r,n,o,i){let l=!1,a=o(e,t,!!t&&r);for(;a;){if(a===e.firstChild){if(l)return!1;l=!0}let t=!n&&(a.disabled||"true"===a.getAttribute("aria-disabled"));if(a.hasAttribute("tabindex")&&P(a,i)&&!t)return a.focus(),!0;a=o(e,a,r)}return!1}let y=i.forwardRef(function(e,t){let{actions:r,autoFocus:l=!1,autoFocusItem:a=!1,children:s,className:u,disabledItemsFocusable:y=!1,disableListWrap:x=!1,onKeyDown:M,variant:w="selectedMenu"}=e,E=(0,o.Z)(e,m),C=i.useRef(null),k=i.useRef({keys:[],repeating:!0,previousKeyMatched:!0,lastTime:null});(0,h.Z)(()=>{l&&C.current.focus()},[l]),i.useImperativeHandle(r,()=>({adjustStyleForScrollbar:(e,{direction:t})=>{let r=!C.current.style.width;if(e.clientHeight<C.current.clientHeight&&r){let r=`${c((0,p.Z)(e))}px`;C.current.style["rtl"===t?"paddingLeft":"paddingRight"]=r,C.current.style.width=`calc(100% + ${r})`}return C.current}}),[]);let S=(0,f.Z)(C,t),T=-1;i.Children.forEach(s,(e,t)=>{if(!i.isValidElement(e)){T===t&&(T+=1)>=s.length&&(T=-1);return}e.props.disabled||("selectedMenu"===w&&e.props.selected?T=t:-1!==T||(T=t)),T===t&&(e.props.disabled||e.props.muiSkipListHighlight||e.type.muiSkipListHighlight)&&(T+=1)>=s.length&&(T=-1)});let R=i.Children.map(s,(e,t)=>{if(t===T){let t={};return a&&(t.autoFocus=!0),void 0===e.props.tabIndex&&"selectedMenu"===w&&(t.tabIndex=0),i.cloneElement(e,t)}return e});return(0,v.jsx)(d.Z,(0,n.Z)({role:"menu",ref:S,className:u,onKeyDown:e=>{let t=C.current,r=e.key,n=(0,p.Z)(t).activeElement;if("ArrowDown"===r)e.preventDefault(),b(t,n,x,y,Z);else if("ArrowUp"===r)e.preventDefault(),b(t,n,x,y,g);else if("Home"===r)e.preventDefault(),b(t,null,x,y,Z);else if("End"===r)e.preventDefault(),b(t,null,x,y,g);else if(1===r.length){let o=k.current,i=r.toLowerCase(),l=performance.now();o.keys.length>0&&(l-o.lastTime>500?(o.keys=[],o.repeating=!0,o.previousKeyMatched=!0):o.repeating&&i!==o.keys[0]&&(o.repeating=!1)),o.lastTime=l,o.keys.push(i);let a=n&&!o.repeating&&P(n,o);o.previousKeyMatched&&(a||b(t,n,!1,y,Z,o))?e.preventDefault():o.previousKeyMatched=!1}M&&M(e)},tabIndex:l?0:-1},E,{children:R}))});var x=r(76320),M=r(31608),w=r(87286),E=r(86229),C=r(81729),k=r(96608),S=r(38751),T=r(37803),R=r(25800),L=r(46213);function N(e){return(0,L.ZP)("MuiPopover",e)}(0,R.Z)("MuiPopover",["root","paper"]);let z=["onEntering"],D=["action","anchorEl","anchorOrigin","anchorPosition","anchorReference","children","className","container","elevation","marginThreshold","open","PaperProps","slots","slotProps","transformOrigin","TransitionComponent","transitionDuration","TransitionProps","disableScrollLock"],j=["slotProps"];function F(e,t){let r=0;return"number"==typeof t?r=t:"center"===t?r=e.height/2:"bottom"===t&&(r=e.height),r}function H(e,t){let r=0;return"number"==typeof t?r=t:"center"===t?r=e.width/2:"right"===t&&(r=e.width),r}function O(e){return[e.horizontal,e.vertical].map(e=>"number"==typeof e?`${e}px`:e).join(" ")}function I(e){return"function"==typeof e?e():e}let K=e=>{let{classes:t}=e;return(0,a.Z)({root:["root"],paper:["paper"]},N,t)},A=(0,M.ZP)(S.Z,{name:"MuiPopover",slot:"Root",overridesResolver:(e,t)=>t.root})({}),W=(0,M.ZP)(T.Z,{name:"MuiPopover",slot:"Paper",overridesResolver:(e,t)=>t.paper})({position:"absolute",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",outline:0}),$=i.forwardRef(function(e,t){var r,a,u;let d=(0,w.i)({props:e,name:"MuiPopover"}),{action:c,anchorEl:h,anchorOrigin:m={vertical:"top",horizontal:"left"},anchorPosition:Z,anchorReference:g="anchorEl",children:P,className:b,container:y,elevation:M=8,marginThreshold:S=16,open:T,PaperProps:R={},slots:L,slotProps:N,transformOrigin:$={vertical:"top",horizontal:"left"},TransitionComponent:_=k.Z,transitionDuration:V="auto",TransitionProps:{onEntering:B}={},disableScrollLock:X=!1}=d,U=(0,o.Z)(d.TransitionProps,z),Y=(0,o.Z)(d,D),q=null!=(r=null==N?void 0:N.paper)?r:R,G=i.useRef(),J=(0,f.Z)(G,q.ref),Q=(0,n.Z)({},d,{anchorOrigin:m,anchorReference:g,elevation:M,marginThreshold:S,externalPaperSlotProps:q,transformOrigin:$,TransitionComponent:_,transitionDuration:V,TransitionProps:U}),ee=K(Q),et=i.useCallback(()=>{if("anchorPosition"===g)return Z;let e=I(h),t=e&&1===e.nodeType?e:(0,p.Z)(G.current).body,r=t.getBoundingClientRect();return{top:r.top+F(r,m.vertical),left:r.left+H(r,m.horizontal)}},[h,m.horizontal,m.vertical,Z,g]),er=i.useCallback(e=>({vertical:F(e,$.vertical),horizontal:H(e,$.horizontal)}),[$.horizontal,$.vertical]),en=i.useCallback(e=>{let t={width:e.offsetWidth,height:e.offsetHeight},r=er(t);if("none"===g)return{top:null,left:null,transformOrigin:O(r)};let n=et(),o=n.top-r.vertical,i=n.left-r.horizontal,l=o+t.height,a=i+t.width,s=(0,C.Z)(I(h)),u=s.innerHeight-S,p=s.innerWidth-S;if(null!==S&&o<S){let e=o-S;o-=e,r.vertical+=e}else if(null!==S&&l>u){let e=l-u;o-=e,r.vertical+=e}if(null!==S&&i<S){let e=i-S;i-=e,r.horizontal+=e}else if(a>p){let e=a-p;i-=e,r.horizontal+=e}return{top:`${Math.round(o)}px`,left:`${Math.round(i)}px`,transformOrigin:O(r)}},[h,g,et,er,S]),[eo,ei]=i.useState(T),el=i.useCallback(()=>{let e=G.current;if(!e)return;let t=en(e);null!==t.top&&(e.style.top=t.top),null!==t.left&&(e.style.left=t.left),e.style.transformOrigin=t.transformOrigin,ei(!0)},[en]);i.useEffect(()=>(X&&window.addEventListener("scroll",el),()=>window.removeEventListener("scroll",el)),[h,X,el]),i.useEffect(()=>{T&&el()}),i.useImperativeHandle(c,()=>T?{updatePosition:()=>{el()}}:null,[T,el]),i.useEffect(()=>{if(!T)return;let e=(0,E.Z)(()=>{el()}),t=(0,C.Z)(h);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[h,T,el]);let ea=V;"auto"!==V||_.muiSupportAuto||(ea=void 0);let es=y||(h?(0,p.Z)(I(h)).body:void 0),eu=null!=(a=null==L?void 0:L.root)?a:A,ep=null!=(u=null==L?void 0:L.paper)?u:W,ed=(0,s.y)({elementType:ep,externalSlotProps:(0,n.Z)({},q,{style:eo?q.style:(0,n.Z)({},q.style,{opacity:0})}),additionalProps:{elevation:M,ref:J},ownerState:Q,className:(0,l.Z)(ee.paper,null==q?void 0:q.className)}),ec=(0,s.y)({elementType:eu,externalSlotProps:(null==N?void 0:N.root)||{},externalForwardedProps:Y,additionalProps:{ref:t,slotProps:{backdrop:{invisible:!0}},container:es,open:T},ownerState:Q,className:(0,l.Z)(ee.root,b)}),{slotProps:ef}=ec,eh=(0,o.Z)(ec,j);return(0,v.jsx)(eu,(0,n.Z)({},eh,!(0,x.X)(eu)&&{slotProps:ef,disableScrollLock:X},{children:(0,v.jsx)(_,(0,n.Z)({appear:!0,in:T,onEntering:(e,t)=>{B&&B(e,t),el()},onExited:()=>{ei(!1)},timeout:ea},U,{children:(0,v.jsx)(ep,(0,n.Z)({},ed,{children:P}))}))}))});var _=r(11874);function V(e){return(0,L.ZP)("MuiMenu",e)}(0,R.Z)("MuiMenu",["root","paper","list"]);let B=["onEntering"],X=["autoFocus","children","className","disableAutoFocusItem","MenuListProps","onClose","open","PaperProps","PopoverClasses","transitionDuration","TransitionProps","variant","slots","slotProps"],U={vertical:"top",horizontal:"right"},Y={vertical:"top",horizontal:"left"},q=e=>{let{classes:t}=e;return(0,a.Z)({root:["root"],paper:["paper"],list:["list"]},V,t)},G=(0,M.ZP)($,{shouldForwardProp:e=>(0,_.Z)(e)||"classes"===e,name:"MuiMenu",slot:"Root",overridesResolver:(e,t)=>t.root})({}),J=(0,M.ZP)(W,{name:"MuiMenu",slot:"Paper",overridesResolver:(e,t)=>t.paper})({maxHeight:"calc(100% - 96px)",WebkitOverflowScrolling:"touch"}),Q=(0,M.ZP)(y,{name:"MuiMenu",slot:"List",overridesResolver:(e,t)=>t.list})({outline:0}),ee=i.forwardRef(function(e,t){var r,a;let p=(0,w.i)({props:e,name:"MuiMenu"}),{autoFocus:d=!0,children:c,className:f,disableAutoFocusItem:h=!1,MenuListProps:m={},onClose:Z,open:g,PaperProps:P={},PopoverClasses:b,transitionDuration:y="auto",TransitionProps:{onEntering:x}={},variant:M="selectedMenu",slots:E={},slotProps:C={}}=p,k=(0,o.Z)(p.TransitionProps,B),S=(0,o.Z)(p,X),T=(0,u.V)(),R=(0,n.Z)({},p,{autoFocus:d,disableAutoFocusItem:h,MenuListProps:m,onEntering:x,PaperProps:P,transitionDuration:y,TransitionProps:k,variant:M}),L=q(R),N=d&&!h&&g,z=i.useRef(null),D=-1;i.Children.map(c,(e,t)=>{i.isValidElement(e)&&(e.props.disabled||("selectedMenu"===M&&e.props.selected?D=t:-1!==D||(D=t)))});let j=null!=(r=E.paper)?r:J,F=null!=(a=C.paper)?a:P,H=(0,s.y)({elementType:E.root,externalSlotProps:C.root,ownerState:R,className:[L.root,f]}),O=(0,s.y)({elementType:j,externalSlotProps:F,ownerState:R,className:L.paper});return(0,v.jsx)(G,(0,n.Z)({onClose:Z,anchorOrigin:{vertical:"bottom",horizontal:T?"right":"left"},transformOrigin:T?U:Y,slots:{paper:j,root:E.root},slotProps:{root:H,paper:O},open:g,ref:t,transitionDuration:y,TransitionProps:(0,n.Z)({onEntering:(e,t)=>{z.current&&z.current.adjustStyleForScrollbar(e,{direction:T?"rtl":"ltr"}),x&&x(e,t)}},k),ownerState:R},S,{classes:b,children:(0,v.jsx)(Q,(0,n.Z)({onKeyDown:e=>{"Tab"===e.key&&(e.preventDefault(),Z&&Z(e,"tabKeyDown"))},actions:z,autoFocus:d&&(-1===D||h),autoFocusItem:N,variant:M},m,{className:(0,l.Z)(L.list,m.className),children:c}))}))});var et=ee},86229:function(e,t,r){var n=r(94751);t.Z=n.Z},89261:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(14978),o=function(e,t){var r,o;return n.isValidElement(e)&&-1!==t.indexOf(null!=(r=e.type.muiName)?r:null==(o=e.type)||null==(o=o._payload)||null==(o=o.value)?void 0:o.muiName)}},62302:function(e,t,r){var n=r(16526);t.Z=n.Z},81729:function(e,t,r){var n=r(64469);t.Z=n.Z},16656:function(e,t,r){var n=r(82063);t.Z=n.Z}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[737],{49532:function(e,t,n){"use strict";let s,l;async function a(){if(s||(l||(l=fetch("/api/config").then(e=>e.json()).then(e=>s=e.apiBaseUrl)),await l),void 0===s)throw Error("API base URL is undefined");return s}n.d(t,{b:function(){return a}})},15737:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return tl}});var s=n(24004),l=n(14978),a=n(77580);let r=a.env.NEXT_PUBLIC_PROMPTFOO_REMOTE_API_BASE_URL||a.env.NEXT_PUBLIC_PROMPTFOO_BASE_URL||a.env.PROMPTFOO_REMOTE_API_BASE_URL||"https://api.promptfoo.dev",i=a.env.NEXT_PUBLIC_PROMPTFOO_BASE_URL||a.env.PROMPTFOO_REMOTE_APP_BASE_URL||"https://app.promptfoo.dev";a?.stdout?.columns&&a?.stdout?.columns>10&&a?.stdout?.columns;var o=n(49532);let c=(0,l.createContext)(void 0),d=e=>{let{children:t}=e,[n,a]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=e=>{"Shift"===e.key&&a(!0)},t=e=>{"Shift"===e.key&&a(!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}},[]),(0,s.jsx)(c.Provider,{value:n,children:t})};var u=n(42671),h=n(6363);let p=(0,l.createContext)(void 0),m=()=>{let e=(0,l.useContext)(p);if(!e)throw Error("useToast must be used within a ToastProvider");return e},x=e=>{let{children:t}=e,[n,a]=(0,l.useState)({message:"",severity:"info",open:!1}),r=()=>{a(e=>({...e,open:!1}))};return(0,s.jsxs)(p.Provider,{value:{showToast:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info";a({message:e,severity:t,open:!0})}},children:[t,(0,s.jsx)(u.Z,{open:n.open,autoHideDuration:6e3,onClose:r,children:(0,s.jsx)(h.Z,{onClose:r,severity:n.severity,children:n.message})})]})};var g=n(52428),v=n(11615),j=n(12594),f=n(28891),b=n(74997),y=n(93179),Z=n(47887),w=n(43205),C=n(5592),k=n(14931),S=n(75307),R=n(17178),I=n(42610),N=n(49567),E=n(40982),P=n(24362),F=n(885),T=n(39813),D=n(1852),M=n(57027),O=n(94941),L=n(36273),A=n(96976),U=n(8508),W=n(34304),z=n(32414),_=n(67339),V=n(65969),B=n(63147),J=n(14059),H=n(23223),K=n(94068),G=n(29794),X=n(22701),q=n(51956),Y=n(82669),$=n(37803),Q=n(65068),ee=n(70417),et=n(21303),en=n(61451),es=n(26485),el=n(30021),ea=n(32162),er=n.n(ea),ei=e=>{let{open:t,onClose:n,recentEvals:a,onRecentEvalSelected:r,title:i,description:o}=e,[c,d]=(0,l.useState)(""),[u,h]=(0,l.useState)(-1),p=l.useRef(null),m=l.useRef(null),x=()=>{n(),d(""),h(-1)},g=a.filter(e=>er()(c.toLowerCase(),e.label.toLowerCase())||"string"==typeof e.description&&er()(c.toLowerCase(),e.description.toLowerCase())),v=e=>{r(e),x()},j=l.useCallback(()=>{if(u>=0&&m.current){let e=m.current.querySelectorAll("tbody tr"),t=Math.min(u+3,e.length-1);e[t]&&e[t].scrollIntoView({behavior:"smooth",block:"nearest"})}},[u]);l.useEffect(()=>{j()},[j]),l.useEffect(()=>{t&&(h(0),setTimeout(()=>{var e;null===(e=p.current)||void 0===e||e.focus()},0))},[t]);let f=l.useId();return(0,s.jsxs)(G.Z,{open:t,onClose:x,maxWidth:"md",fullWidth:!0,children:[i?(0,s.jsx)(Y.Z,{children:i}):null,(0,s.jsxs)(q.Z,{children:[o?(0,s.jsx)(N.Z,{sx:{mb:4},children:o}):null,(0,s.jsxs)(N.Z,{sx:{width:"100%",mt:2},children:[(0,s.jsx)(_.Z,{fullWidth:!0,variant:"outlined",placeholder:"Search",value:c,onChange:e=>{d(e.target.value),h(0)},onKeyDown:e=>{if(e.stopPropagation(),t)switch(e.key){case"ArrowDown":e.preventDefault(),h(e=>Math.min(e+1,g.length-1));break;case"ArrowUp":e.preventDefault(),h(e=>Math.max(e-1,0));break;case"Enter":e.preventDefault(),u>=0&&u<g.length?v(g[u].evalId):g.length>0&&v(g[0].evalId);break;case"Escape":e.preventDefault(),x()}},sx:{mb:2},inputRef:p,id:"eval-selector-search-".concat(f)}),(0,s.jsx)(en.Z,{component:$.Z,sx:{height:"600px",overflow:"auto"},ref:m,children:(0,s.jsxs)(Q.Z,{stickyHeader:!0,children:[(0,s.jsx)(es.Z,{children:(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(et.Z,{children:"Created"}),(0,s.jsx)(et.Z,{children:"Description"}),(0,s.jsx)(et.Z,{children:"# Tests"})]})}),(0,s.jsx)(ee.Z,{children:g.length>0?g.map((e,t)=>(0,s.jsxs)(el.Z,{hover:!0,onClick:()=>v(e.evalId),sx:{cursor:"pointer",backgroundColor:t===u?"rgba(255, 255, 0, 0.1)":"inherit"},children:[(0,s.jsx)(et.Z,{children:new Date(e.createdAt).toLocaleString()}),(0,s.jsx)(et.Z,{children:e.description||e.label}),(0,s.jsx)(et.Z,{children:e.numTests})]},e.evalId)):(0,s.jsx)(el.Z,{children:(0,s.jsx)(et.Z,{colSpan:3,align:"center",sx:{py:4},children:(0,s.jsxs)(N.Z,{sx:{textAlign:"center",color:"text.secondary"},children:[(0,s.jsx)(N.Z,{sx:{fontSize:"3rem",mb:2},children:"\uD83D\uDD0D"}),(0,s.jsx)(B.Z,{variant:"h6",gutterBottom:!0,children:"No evaluations found"}),(0,s.jsx)(B.Z,{variant:"body2",children:"Try adjusting your search or create a new evaluation"})]})})})})]})})]})]}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:x,children:"Cancel"})})]})},eo=n(37204),ec=n(79685),ed=n(74595);let eu={getItem:async e=>await (0,eo.U2)(e)||null,setItem:async(e,t)=>{await (0,eo.t8)(e,t)},removeItem:async e=>{await (0,eo.IV)(e)}},eh=(0,ec.Ue)()((0,ed.tJ)((e,t)=>({evalId:null,setEvalId:t=>e(()=>({evalId:t})),author:null,setAuthor:t=>e(()=>({author:t})),table:null,setTable:t=>e(()=>({table:t})),config:null,setConfig:t=>e(()=>({config:t})),maxTextLength:250,setMaxTextLength:t=>e(()=>({maxTextLength:t})),wordBreak:"break-word",setWordBreak:t=>e(()=>({wordBreak:t})),showInferenceDetails:!0,setShowInferenceDetails:t=>e(()=>({showInferenceDetails:t})),renderMarkdown:!1,setRenderMarkdown:t=>e(()=>({renderMarkdown:t})),prettifyJson:!1,setPrettifyJson:t=>e(()=>({prettifyJson:t})),showPrompts:!1,setShowPrompts:t=>e(()=>({showPrompts:t})),showPassFail:!0,setShowPassFail:t=>e(()=>({showPassFail:t})),inComparisonMode:!1,setInComparisonMode:t=>e(()=>({inComparisonMode:t}))}),{name:"ResultsViewStorage",storage:(0,ed.FL)(()=>eu)}));var ep=function(e){let{initialEvals:t,onComparisonEvalSelected:n}=e,{evalId:a}=eh(),[r,i]=(0,l.useState)(!1),[c,d]=(0,l.useState)(t),u=async()=>{try{let e=await (0,o.b)(),n=a||t[0].evalId,s=await fetch("".concat(e,"/api/results/").concat(n),{cache:"no-store"}),l=await s.json(),r=l.data.datasetId;if(!r){console.error("No datasetId found for current eval "+n);return}let i=await fetch("".concat(e,"/api/results?datasetId=").concat(r),{cache:"no-store"}),c=await i.json();d(c.data.filter(e=>e.evalId!==n))}catch(e){console.error("Error fetching recent evals:",e)}},h=()=>{i(!1)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.Z,{title:"Combine this eval with another eval run",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:()=>{u(),i(!0)},children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(K.Z,{fontSize:"small"})}),(0,s.jsx)(O.Z,{children:"Compare with another eval"})]})}),(0,s.jsx)(ei,{open:r,onClose:h,recentEvals:c,onRecentEvalSelected:e=>{n(e),h()},title:"Select an eval to compare",description:"Only evals with the same dataset can be compared."})]})},em=n(26110),ex=n(48931),eg=n(99645),ev=n(77656);function ej(e){let{open:t,onClose:a}=e,{config:r}=eh(),i=l.useRef(null),[o,c]=l.useState(!1),[d,u]=l.useState("");l.useEffect(()=>{t&&(async()=>{let{default:e}=await Promise.resolve().then(n.bind(n,34235));u(e.dump(r))})()},[t,r]);let h=()=>{c(!1),a()};return(0,s.jsxs)(G.Z,{open:t,onClose:h,"aria-labelledby":"config-dialog-title",maxWidth:"md",fullWidth:!0,children:[(0,s.jsx)(Y.Z,{id:"config-dialog-title",children:(0,s.jsxs)(N.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,s.jsx)(B.Z,{variant:"h6",style:{flexGrow:1},children:"Config"}),(0,s.jsxs)(N.Z,{children:[(0,s.jsx)(V.Z,{title:"Copy to clipboard",children:(0,s.jsx)(ev.Z,{onClick:()=>{i.current&&(i.current.select(),document.execCommand("copy"),c(!0))},children:o?(0,s.jsx)(em.Z,{}):(0,s.jsx)(eg.Z,{})})}),(0,s.jsx)(V.Z,{title:"Download .yaml",children:(0,s.jsx)(ev.Z,{onClick:()=>{let e=new Blob([d],{type:"text/yaml;charset=utf-8"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download="config.yaml",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},children:(0,s.jsx)(ex.Z,{})})})]})]})}),(0,s.jsx)(q.Z,{children:(0,s.jsx)(B.Z,{variant:"body1",component:"div",children:(0,s.jsx)("textarea",{ref:i,readOnly:!0,value:d,style:{width:"100%",minHeight:"400px",fontFamily:"monospace",border:"1px solid #ccc"}})})}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:h,color:"primary",children:"Close"})})]})}var ef=n(79715),eb=n(34235),ey=function(){let{table:e,config:t,evalId:n}=eh(),[a,r]=l.useState(!1),i=(e,t)=>{let n=URL.createObjectURL(e),s=document.createElement("a");s.href=n,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(n)},o=()=>{r(!1)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(A.Z,{onClick:()=>{r(!0)},children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(ex.Z,{fontSize:"small"})}),(0,s.jsx)(O.Z,{children:"Download"})]}),(0,s.jsx)(G.Z,{onClose:o,open:a,children:(0,s.jsx)(q.Z,{children:(0,s.jsxs)(z.Z,{direction:"column",spacing:2,sx:{width:"100%"},children:[(0,s.jsx)(E.Z,{onClick:()=>{let e=eb.default.dump(t),n=new Blob([e],{type:"text/yaml;charset=utf-8"});i(n,"promptfooconfig.yaml"),o()},startIcon:(0,s.jsx)(ex.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download YAML Config"}),(0,s.jsx)(E.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=[],s=[...e.head.vars,...e.head.prompts.map(e=>"[".concat(e.provider,"] ").concat(e.label))];t.push(s),e.body.forEach(e=>{let n=[...e.vars,...e.outputs.map(e=>{let{pass:t,text:n}=e;return(t?"[PASS] ":"[FAIL] ")+n})];t.push(n)});let l=(0,ef.P)(t),a=new Blob([l],{type:"text/csv;charset=utf-8;"});i(a,"".concat(n,"-table.csv")),o()},startIcon:(0,s.jsx)(ex.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download Table CSV"}),(0,s.jsx)(E.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"});i(t,"".concat(n,"-table.json")),o()},startIcon:(0,s.jsx)(ex.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download Table JSON"}),(0,s.jsx)(E.Z,{onClick:()=>{if(!e){alert("No table data");return}let t=e.body.map((t,n)=>({chosen:t.outputs.filter(e=>e.pass).map(e=>e.text),rejected:t.outputs.filter(e=>!e.pass).map(e=>e.text),vars:t.test.vars,providers:e.head.prompts.map(e=>e.provider),prompts:e.head.prompts.map(e=>e.label||e.display||e.raw)})),s=new Blob([JSON.stringify(t,null,2)],{type:"application/json"});i(s,"".concat(n,"-dpo.json")),o()},startIcon:(0,s.jsx)(ex.Z,{}),fullWidth:!0,sx:{justifyContent:"flex-start"},children:"Download DPO JSON"})]})})})]})},eZ=n(49653),ew=e=>{let{recentEvals:t,onRecentEvalSelected:n,currentEval:a}=e,[r,i]=(0,l.useState)(!1),o="undefined"!=typeof navigator&&-1!==navigator.platform.toUpperCase().indexOf("MAC"),c=()=>{i(!0)};return l.useEffect(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),c())};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.Z,{title:o?"Search for Evals (⌘ + K)":"Search for Evals (Ctrl + K)",arrow:!0,children:(0,s.jsx)(ev.Z,{onClick:c,color:"primary",size:"small",children:(0,s.jsx)(eZ.Z,{})})}),(0,s.jsx)(ei,{title:"Open an Eval",open:r,onClose:()=>{i(!1)},recentEvals:t,onRecentEvalSelected:n})]})},eC=n(69179),ek=n(92715),eS=n(92863),eR=n(36001);let eI=["#fd7f6f","#7eb0d5","#b2e061","#bd7ebe","#ffb55a","#ffee65","#beb9db","#fdcce5","#8bd3c7"];function eN(e){let{table:t}=e,n=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!n.current)return;a.current&&a.current.destroy();let e=t.body.flatMap(e=>e.outputs.map(e=>e.score)),s=Math.min(...e),l=(Math.ceil(Math.max(...e))-Math.floor(s))/10,r=Array.from({length:11},(e,t)=>parseFloat((Math.floor(s)+t*l).toFixed(2))),i=t.head.prompts.map((e,n)=>{let s=t.body.flatMap(e=>e.outputs[n].score),a=r.map(e=>s.filter(t=>t>=e&&t<e+l).length);return{label:"Column ".concat(n+1),data:a,backgroundColor:eI[n%eI.length]}});a.current=new eR.kL(n.current,{type:"bar",data:{labels:r,datasets:i},options:{animation:!1,plugins:{title:{display:!0,text:"Score Distribution"},legend:{display:!1},tooltip:{callbacks:{title:function(e){let t=e[0].datasetIndex;return"Column ".concat(t+1)},label:function(e){let t=e.dataIndex,n=r[t],s=r[t+1];return s?"".concat(n," <= score < ").concat(s):"".concat(n," <= score")}}}}}})},[t]),(0,s.jsx)("canvas",{ref:n,style:{maxHeight:"300px"}})}function eE(e){let{table:t}=e,n=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!n.current)return;a.current&&a.current.destroy();let e=t.head.prompts.map((e,n)=>{let s=t.body.flatMap(e=>e.outputs[n]),l=s.filter(e=>e.pass).length,a=l/s.length*100;return{label:"Column ".concat(n+1),data:[a],backgroundColor:eI[n%eI.length]}});a.current=new eR.kL(n.current,{type:"bar",data:{labels:["Pass Rate (%)"],datasets:e},options:{animation:!1,plugins:{title:{display:!0,text:"Pass rate"},legend:{display:!0}}}})},[t]),(0,s.jsx)("canvas",{ref:n,style:{maxHeight:"300px"}})}function eP(e){let{table:t}=e,n=(0,l.useRef)(null),a=(0,l.useRef)(null),[r,i]=(0,l.useState)(0),[o,c]=(0,l.useState)(1),[d,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(!n.current)return;a.current&&a.current.destroy();let e=t.body.flatMap(e=>e.outputs.map(e=>e.score)),s=Math.min(...e),l=Math.max(...e),i=t.body.map(e=>{let t=e.outputs[r].score,n=e.outputs[o].score;return{x:t,y:n,backgroundColor:n>t?"green":n<t?"red":"gray"}});a.current=new eR.kL(n.current,{type:"scatter",data:{datasets:[{data:i,backgroundColor:i.map(e=>e.backgroundColor)},{type:"line",data:[{x:s,y:s},{x:l,y:l}],borderColor:"gray",borderWidth:1,borderDash:[5,5],pointRadius:0}]},options:{animation:!1,plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(e){let n=t.body[e.dataIndex],s=n.outputs[0].text,l=n.outputs[1].text;return s.length>30&&(s=s.substring(0,30)+"..."),l.length>30&&(l=l.substring(0,30)+"..."),"Output 1: ".concat(s,"\nOutput 2: ").concat(l)}}}},scales:{x:{title:{display:!0,text:"Prompt ".concat(r+1," Score")},ticks:{callback:function(e,t,n){let s=String(Math.round(100*Number(e)));return t===n.length-1&&(s+="%"),s}}},y:{title:{display:!0,text:"Prompt ".concat(o+1," Score")},ticks:{callback:function(e,t,n){let s=String(Math.round(100*Number(e)));return t===n.length-1&&(s+="%"),s}}}}}})},[t,r,o]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(G.Z,{open:d,onClose:()=>u(!1),children:[(0,s.jsx)(Y.Z,{children:"Compare prompt outputs"}),(0,s.jsxs)(q.Z,{children:[(0,s.jsx)(T.Z,{sx:{m:1,minWidth:120},children:(0,s.jsx)(W.Z,{value:r,onChange:e=>i(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,s.jsxs)(A.Z,{value:t,children:["Prompt ",t+1]},t))})}),(0,s.jsx)(T.Z,{sx:{m:1,minWidth:120},children:(0,s.jsx)(W.Z,{value:o,onChange:e=>c(Number(e.target.value)),children:t.head.prompts.map((e,t)=>(0,s.jsxs)(A.Z,{value:t,children:["Prompt ",t+1]},t))})})]})]}),(0,s.jsx)("canvas",{ref:n,style:{maxHeight:"300px",cursor:"pointer"},onClick:()=>u(!0)})]})}function eF(e){let{table:t}=e,n=(0,l.useRef)(null),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{var e;if(!n.current)return;a.current&&a.current.destroy();let s=Object.keys((null===(e=t.head.prompts[0].metrics)||void 0===e?void 0:e.namedScores)||{}),l=t.head.prompts.map((e,n)=>{let l=s.map(n=>{var s;let l=(null===(s=e.metrics)||void 0===s?void 0:s.namedScores[n])||0,a=Math.max(...t.head.prompts.map(e=>{var t;return(null===(t=e.metrics)||void 0===t?void 0:t.namedScores[n])||0}));return l/a});return{label:"".concat(t.head.prompts[n].provider),data:l,backgroundColor:eI[n%eI.length]}});a.current=new eR.kL(n.current,{type:"bar",data:{labels:s,datasets:l},options:{scales:{x:{grid:{display:!1}},y:{ticks:{callback:function(e,t,n){let s=String(Math.round(100*Number(e)));return t===n.length-1&&(s+="%"),s}}}},plugins:{tooltip:{callbacks:{title:function(e){return e[0].dataset.label},label:function(e){let t=e.parsed.y;return"".concat(s[e.dataIndex],": ").concat((100*t).toFixed(2),"% pass rate")}}}}}})},[t]),(0,s.jsx)("canvas",{ref:n,style:{maxHeight:"300px"}})}eR.kL.register(eR.vn,eR.ST,eR.ho,eR.uw,eR.f$,eR.ZL,eR.jn,eR.od,eR.u,eR.wL);var eT=l.memo(function(e){var t;let{columnVisibility:n}=e,a=(0,eS.Z)();eR.kL.defaults.color="dark"===a.palette.mode?"#aaa":"#666";let[r,i]=(0,l.useState)(!0),{table:o}=eh();if(!o||!r||o.head.prompts.length<2)return null;let c=o.body.flatMap(e=>e.outputs.map(e=>e.score)),d=new Set(c);return 1===d.size?null:(0,s.jsx)(eC.SV,{fallback:null,children:(0,s.jsxs)($.Z,{style:{position:"relative",padding:a.spacing(3)},children:[(0,s.jsx)(ev.Z,{style:{position:"absolute",right:0,top:0},onClick:()=>i(!1),children:(0,s.jsx)(ek.Z,{})}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[(0,s.jsx)("div",{style:{width:"33%"},children:(0,s.jsx)(eE,{table:o})}),(0,s.jsx)("div",{style:{width:"33%"},children:d.size<=3&&Object.keys((null===(t=o.head.prompts[0].metrics)||void 0===t?void 0:t.namedScores)||{}).length>1?(0,s.jsx)(eF,{table:o}):(0,s.jsx)(eN,{table:o})}),(0,s.jsx)("div",{style:{width:"33%"},children:(0,s.jsx)(eP,{table:o})})]})]})})}),eD=n(36128),eM=n(9317),eO=n(20286);n(55974);var eL=e=>{let{lookup:t,metricTotals:n,onSearchTextChange:l}=e;return t&&Object.keys(t).length?(0,s.jsx)("div",{className:"custom-metric-container",children:Object.entries(t).map(e=>{let[t,a]=e;return t&&void 0!==a?(0,s.jsxs)("span",{onClick:()=>l&&l("metric=".concat(t,":")),className:l?"clickable":"",children:[t,":"," ",n&&n[t]?(0,s.jsxs)(s.Fragment,{children:[(a/n[t]*100).toFixed(2),"% (",a,"/",n[t],")"]}):a]},t):null})}):null},eA=n(35185),eU=n(613);function eW(e){let{gradingResults:t}=e;return t?(0,s.jsxs)(N.Z,{mt:2,children:[(0,s.jsx)(B.Z,{variant:"subtitle1",children:"Assertions"}),(0,s.jsx)(en.Z,{children:(0,s.jsxs)(Q.Z,{children:[(0,s.jsx)(es.Z,{children:(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Pass"}),(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Score"}),(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Type"}),(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Value"}),(0,s.jsx)(et.Z,{style:{fontWeight:"bold"},children:"Reason"})]})}),(0,s.jsx)(ee.Z,{children:t.map((e,t)=>{var n,l,a;return e?(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(et.Z,{children:e.pass?"✅":"❌"}),(0,s.jsx)(et.Z,{children:null===(n=e.score)||void 0===n?void 0:n.toFixed(2)}),(0,s.jsx)(et.Z,{children:(null===(l=e.assertion)||void 0===l?void 0:l.type)||""}),(0,s.jsx)(et.Z,{style:{whiteSpace:"pre-wrap"},children:(null===(a=e.assertion)||void 0===a?void 0:a.value)?String(e.assertion.value):"-"}),(0,s.jsx)(et.Z,{style:{whiteSpace:"pre-wrap"},children:e.reason})]},t):null})})]})})]}):null}function ez(e){let{open:t,onClose:n,prompt:a,provider:r,output:i,gradingResults:o,metadata:c}=e,[d,u]=(0,l.useState)(!1);(0,l.useEffect)(()=>{u(!1)},[a]);let h=async e=>{await navigator.clipboard.writeText(e),u(!0)};return(0,s.jsxs)(G.Z,{open:t,onClose:n,fullWidth:!0,maxWidth:"lg",children:[(0,s.jsxs)(Y.Z,{children:["Details",r&&": ".concat(r)]}),(0,s.jsxs)(q.Z,{children:[(0,s.jsxs)(N.Z,{mb:2,children:[(0,s.jsx)(B.Z,{variant:"subtitle1",style:{marginBottom:"1rem"},children:"Prompt"}),(0,s.jsx)(eU.u,{readOnly:!0,value:a,style:{width:"100%",padding:"0.75rem"},maxRows:20}),(0,s.jsx)(ev.Z,{onClick:()=>h(a),style:{position:"absolute",right:"10px",top:"10px"},children:d?(0,s.jsx)(em.Z,{}):(0,s.jsx)(eA.Z,{})})]}),(null==c?void 0:c.redteamFinalPrompt)&&(0,s.jsxs)(N.Z,{my:2,children:[(0,s.jsx)(B.Z,{variant:"subtitle1",style:{marginBottom:"1rem",marginTop:"1rem"},children:"Modified User Input (Red Team)"}),(0,s.jsx)(eU.u,{readOnly:!0,maxRows:20,value:c.redteamFinalPrompt,style:{width:"100%",padding:"0.75rem"}})]}),i&&(0,s.jsxs)(N.Z,{my:2,children:[(0,s.jsx)(B.Z,{variant:"subtitle1",style:{marginBottom:"1rem",marginTop:"1rem"},children:"Output"}),(0,s.jsx)(eU.u,{readOnly:!0,maxRows:20,value:i,style:{width:"100%",padding:"0.75rem"}})]}),(0,s.jsx)(eW,{gradingResults:o})]}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:n,children:"Close"})})]})}var e_=n(12431),eV=n(8541),eB=function(){let e=(0,eS.Z)(),[t,n]=l.useState(!1),a=()=>{n(!1)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{style:{textAlign:"center",marginTop:20,marginBottom:40},children:(0,s.jsx)(E.Z,{variant:"text",color:"primary",startIcon:(0,s.jsx)(e_.Z,{}),onClick:()=>{n(!0)},children:"Generate test cases"})}),(0,s.jsxs)(G.Z,{open:t,onClose:a,children:[(0,s.jsx)(Y.Z,{children:"Run on Command Line"}),(0,s.jsx)(q.Z,{children:(0,s.jsxs)(eV.Z,{children:[(0,s.jsx)("p",{children:"This feature is in beta. UI coming soon."}),(0,s.jsxs)("p",{children:["Run"," ",(0,s.jsx)(N.Z,{component:"code",sx:{backgroundColor:"dark"===e.palette.mode?"#424242":"#f0f0f0",padding:"2px 4px",borderRadius:"4px"},children:"promptfoo generate dataset"}),"to generate test cases on the command line."]})]})}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:a,color:"primary",children:"Close"})})]})]})};function eJ(e){return"string"==typeof e||"number"==typeof e?e.toString().length:Array.isArray(e)?e.reduce((e,t)=>e+eJ(t),0):l.isValidElement(e)&&e.props.children?l.Children.toArray(e.props.children).reduce((e,t)=>e+eJ(t),0):0}let eH=l.memo(function(e){let t,{text:n,maxLength:a}=e,[r,i]=l.useState(!0),o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("string"==typeof e||"number"==typeof e){let n=e.toString();return n.slice(0,a-t)}if(Array.isArray(e)){let n=[],s=t;for(let t of e){let e=eJ(t);if(s+e>a){n.push(o(t,s));break}n.push(t),s+=e}return n}if(l.isValidElement(e)&&e.props.children){let n=eJ(e.props.children);if(n>a-t)return l.cloneElement(e,{...e.props,children:o(e.props.children,t)})}return e};t=l.isValidElement(n)||"string"==typeof n?n:JSON.stringify(n);let c=r?o(t):t,d=eJ(t)>a;return(0,s.jsxs)("div",{style:{cursor:d?"pointer":"normal"},onClick:()=>{i(!r)},children:[c,r&&eJ(t)>a&&(0,s.jsx)("span",{children:"..."})]})});var eK=n(59682),eG=n(62268),eX=n(38640),eq=n.n(eX),eY=n(33352),e$=n(73490),eQ=n(24495);n(16658);var e0=e=>{let{failReasons:t}=e,[n,a]=(0,l.useState)(0);return t.length<1?null:(0,s.jsxs)("div",{className:"fail-reason",children:[t.length>1&&(0,s.jsxs)("span",{className:"fail-reason-carousel-controls",children:[(0,s.jsx)(ev.Z,{onClick:()=>{a(e=>e>0?e-1:t.length-1)},children:(0,s.jsx)(e$.Z,{sx:{fontSize:12}})}),(0,s.jsxs)("span",{children:[n+1,"/",t.length]}),(0,s.jsx)(ev.Z,{onClick:()=>{a(e=>e<t.length-1?e+1:0)},children:(0,s.jsx)(eQ.Z,{sx:{fontSize:12}})})]}),t[n].trim().split("\n").map((e,t)=>(0,s.jsxs)(l.Fragment,{children:[e,(0,s.jsx)("br",{})]},t))]})},e1=e=>{let{open:t,contextText:n,commentText:l,onClose:a,onSave:r,onChange:i}=e;return(0,s.jsxs)(G.Z,{open:t,onClose:a,fullWidth:!0,maxWidth:"sm",children:[(0,s.jsx)(Y.Z,{children:"Edit Comment"}),(0,s.jsxs)(q.Z,{children:[(0,s.jsx)(N.Z,{sx:{backgroundColor:"#f0f0f0",padding:2,marginBottom:2},children:n}),(0,s.jsx)(_.Z,{autoFocus:!0,margin:"dense",type:"text",fullWidth:!0,multiline:!0,rows:4,value:l,onChange:e=>i(e.target.value)})]}),(0,s.jsxs)(X.Z,{children:[(0,s.jsx)(E.Z,{onClick:r,color:"primary",variant:"contained",children:"Save"}),(0,s.jsx)(E.Z,{onClick:a,color:"primary",children:"Cancel"})]})]})};let e2=()=>{let e=(0,l.useContext)(c);if(void 0===e)throw Error("useShiftKey must be used within a ShiftKeyProvider");return e};var e3=n(19116);let e5=l.memo(function(e){var t,n,a,r,i,o,c,d,u,h,p,m,x;let g,v,j,f,b,y,{output:Z,maxTextLength:w,rowIndex:C,promptIndex:k,onRating:S,firstOutput:R,showDiffs:I,searchText:N,showStats:E}=e,{renderMarkdown:P,prettifyJson:F,showPrompts:T,showPassFail:D,inComparisonMode:M}=eh(),[O,L]=l.useState(!1),[A,U]=l.useState(!1),[W,z]=l.useState(null),_=e=>{z(e||null),U(!A)},[B,J]=l.useState(!1),[H,K]=l.useState((null===(t=Z.gradingResult)||void 0===t?void 0:t.comment)||""),G=()=>{J(!0)},X="string"==typeof Z.text?Z.text:JSON.stringify(Z.text),q=[];if(!Z.pass&&X.includes("---")&&(q=((null===(h=Z.gradingResult)||void 0===h?void 0:h.componentResults)||[]).filter(e=>!!e&&!e.pass).map(e=>e.reason),X=X.split("---").slice(1).join("---")),I&&R){let e,t="string"==typeof R.text?R.text:JSON.stringify(R.text);t.includes("---")&&(t=t.split("---").slice(1).join("---"));try{JSON.parse(t),JSON.parse(X),e=(0,e3.CT)(t,X)}catch(n){e=t.includes(". ")&&X.includes(". ")?(0,e3.SY)(t,X):(0,e3.NV)(t,X)}g=(0,s.jsx)(s.Fragment,{children:e.map((e,t)=>e.added?(0,s.jsx)("ins",{children:e.value},t):e.removed?(0,s.jsx)("del",{children:e.value},t):(0,s.jsx)("span",{children:e.value},t))})}if(N)try{let e;let t=RegExp(N,"gi"),n=[];for(;null!==(e=t.exec(X));)n.push({start:e.index,end:t.lastIndex});g=(0,s.jsx)(s.Fragment,{children:n.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:X.substring(0,n[0].start)},"text-before"),n.map((e,t)=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"search-highlight",children:X.substring(e.start,e.end)},"match-"+t),(0,s.jsx)("span",{children:X.substring(e.end,n[t+1]?n[t+1].start:X.length)},"text-after-"+t)]}))]}):(0,s.jsx)("span",{children:X},"no-match")})}catch(e){console.error("Invalid regular expression:",e.message)}else if(P&&!I)g=(0,s.jsx)(eO.U,{remarkPlugins:[eY.Z],components:{img:e=>{let{src:t,alt:n}=e;return(0,s.jsx)("img",{loading:"lazy",src:t,alt:n,onClick:()=>_(t),style:{cursor:"pointer"}})}},children:X});else if(F)try{g=(0,s.jsx)("pre",{children:JSON.stringify(JSON.parse(X),null,2)})}catch(e){}let Y=l.useCallback(e=>{var t;S(e,void 0,null===(t=Z.gradingResult)||void 0===t?void 0:t.comment)},[S,null===(n=Z.gradingResult)||void 0===n?void 0:n.comment]),$=l.useCallback(()=>{let e=prompt("Set test score (0.0 - 1.0):",String(Z.score));if(null!==e){let n=parseFloat(e);if(!isNaN(n)&&n>=0&&n<=1){var t;S(void 0,n,null===(t=Z.gradingResult)||void 0===t?void 0:t.comment)}else alert("Invalid score. Please enter a value between 0.0 and 1.0.")}},[S,Z.score,null===(a=Z.gradingResult)||void 0===a?void 0:a.comment]),[Q,ee]=l.useState(!1),et=l.useCallback(()=>{navigator.clipboard.writeText(Z.text),ee(!0)},[Z.text]);if(Z.latencyMs&&(j=(0,s.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Z.latencyMs)," ms"]})),null===(r=Z.tokenUsage)||void 0===r?void 0:r.completion){let e=Z.tokenUsage.completion/(Z.latencyMs/1e3);f=(0,s.jsx)("span",{children:Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)})}if(Z.cost&&(b=(0,s.jsxs)("span",{children:["$",Z.cost.toPrecision(2)]})),null===(i=Z.tokenUsage)||void 0===i?void 0:i.cached)v=(0,s.jsxs)("span",{children:[Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Z.tokenUsage.cached)," ","(cached)"]});else if(null===(o=Z.tokenUsage)||void 0===o?void 0:o.total){let e=Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(null!==(p=Z.tokenUsage.prompt)&&void 0!==p?p:0),t=Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(null!==(m=Z.tokenUsage.completion)&&void 0!==m?m:0),n=Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Z.tokenUsage.total);v=(0,s.jsx)(V.Z,{title:"".concat(e," prompt tokens + ").concat(t," completion tokens = ").concat(n," total"),children:(0,s.jsxs)("span",{children:[n,("0"!==e||"0"!==t)&&" (".concat(e,"+").concat(t,")")]})})}let en=(null===(c=Z.gradingResult)||void 0===c?void 0:c.comment)&&"!highlight"!==Z.gradingResult.comment?(0,s.jsx)("div",{className:"comment",onClick:G,children:Z.gradingResult.comment}):null,es=E?(0,s.jsxs)("div",{className:"cell-detail",children:[v&&(0,s.jsxs)("div",{className:"stat-item",children:[(0,s.jsx)("strong",{children:"Tokens:"})," ",v]}),j&&(0,s.jsxs)("div",{className:"stat-item",children:[(0,s.jsx)("strong",{children:"Latency:"})," ",j]}),f&&(0,s.jsxs)("div",{className:"stat-item",children:[(0,s.jsx)("strong",{children:"Tokens/Sec:"})," ",f]}),b&&(0,s.jsxs)("div",{className:"stat-item",children:[(0,s.jsx)("strong",{children:"Cost:"})," ",b]})]}):null,el=e2(),ea=(0,s.jsxs)("div",{className:"cell-actions",children:[el&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"action",onClick:et,onMouseDown:e=>e.preventDefault(),children:(0,s.jsx)(V.Z,{title:"Copy output to clipboard",children:(0,s.jsx)("span",{children:Q?"✅":"\uD83D\uDCCB"})})}),(0,s.jsx)("span",{className:"action",onClick:()=>{let e;H.startsWith("!highlight")?S(void 0,void 0,e=H.slice(10).trim()):S(void 0,void 0,e=("!highlight "+H).trim()),K(e)},onMouseDown:e=>e.preventDefault(),children:(0,s.jsx)(V.Z,{title:"Toggle test highlight",children:(0,s.jsx)("span",{children:"\uD83C\uDF1F"})})})]}),Z.prompt&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"action",onClick:()=>{L(!0)},children:(0,s.jsx)(V.Z,{title:"View output and test details",children:(0,s.jsx)("span",{children:"\uD83D\uDD0E"})})}),(0,s.jsx)(ez,{open:O,onClose:()=>{L(!1)},prompt:Z.prompt,provider:Z.provider,gradingResults:null===(d=Z.gradingResult)||void 0===d?void 0:d.componentResults,output:X,metadata:Z.metadata})]}),(0,s.jsx)("span",{className:"action",onClick:()=>Y(!0),children:(0,s.jsx)(V.Z,{title:"Mark test passed (score 1.0)",children:(0,s.jsx)("span",{children:"\uD83D\uDC4D"})})}),(0,s.jsx)("span",{className:"action",onClick:()=>Y(!1),children:(0,s.jsx)(V.Z,{title:"Mark test failed (score 0.0)",children:(0,s.jsx)("span",{children:"\uD83D\uDC4E"})})}),(0,s.jsx)("span",{className:"action",onClick:$,children:(0,s.jsx)(V.Z,{title:"Set test score",children:(0,s.jsx)("span",{children:"\uD83D\uDD22"})})}),(0,s.jsx)("span",{className:"action",onClick:G,children:(0,s.jsx)(V.Z,{title:"Edit comment",children:(0,s.jsx)("span",{children:"✏️"})})})]}),er={};(null===(u=Z.gradingResult)||void 0===u?void 0:u.comment)==="!highlight"&&(er.backgroundColor="#ffffeb");let ei=0,eo=0,ec=Z.gradingResult;if(ec?ec.componentResults?ec.componentResults.forEach(e=>{(null==e?void 0:e.pass)?ei++:eo++}):(ei=ec.pass?1:0,eo=ec.pass?0:1):Z.pass?ei=1:Z.pass||(eo=1),1===eo&&1===ei)y=(0,s.jsxs)(s.Fragment,{children:["".concat(eo," FAIL")," ","".concat(ei," PASS")]});else{let e="";eo>1||ei>1&&eo>0?e="".concat(eo," FAIL"):1===eo&&(e="FAIL");let t="";ei>1||eo>1&&ei>0?t="".concat(ei," PASS"):1===ei&&0===eo&&(t="PASS");let n=e&&t?" ":"";y=(0,s.jsxs)(s.Fragment,{children:[e,n,t]})}let ed=null===(x=Z.score)||0===x||1===x?"":"(".concat(x.toFixed(2),")");return(0,s.jsxs)("div",{className:"cell",style:er,children:[D&&(0,s.jsx)(s.Fragment,{children:Z.pass?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"status pass",children:[(0,s.jsxs)("div",{className:"pill",children:[y,ed&&(0,s.jsxs)("span",{className:"score",children:[" ",ed]})]}),(0,s.jsx)(eL,{lookup:Z.namedScores})]})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"status fail",children:[(0,s.jsxs)("div",{className:"pill",children:[y,ed&&(0,s.jsxs)("span",{className:"score",children:[" ",ed]})]}),(0,s.jsx)(eL,{lookup:Z.namedScores}),(0,s.jsx)("span",{className:"fail-reason",children:(0,s.jsx)(e0,{failReasons:q})})]})})}),T&&R.prompt&&(0,s.jsxs)("div",{className:"prompt",children:[(0,s.jsx)("span",{className:"pill",children:"Prompt"}),Z.prompt]}),(0,s.jsx)(eH,{text:g||X,maxLength:w}),en,es,ea,A&&W&&(0,s.jsx)("div",{className:"lightbox",onClick:()=>_(),children:(0,s.jsx)("img",{src:W,alt:"Lightbox"})}),(0,s.jsx)(e1,{open:B,contextText:Z.text,commentText:H,onClose:()=>{J(!1)},onSave:()=>{S(void 0,void 0,H),J(!1)},onChange:K})]})});function e4(e){let{text:t,maxLength:n,expandedText:a,resourceId:r,className:i}=e,[o,c]=l.useState(!1);return(0,s.jsxs)("div",{className:"".concat(i||""),children:[(0,s.jsx)(eH,{text:t,maxLength:n}),a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.Z,{title:"View prompt",children:(0,s.jsx)("span",{className:"action",onClick:()=>{c(!0)},children:"\uD83D\uDD0E"})}),(0,s.jsx)(ez,{open:o,onClose:()=>{c(!1)},prompt:a}),r&&(0,s.jsx)(V.Z,{title:"View other evals and datasets for this prompt",children:(0,s.jsx)("span",{className:"action",children:(0,s.jsx)(eq(),{href:"/prompts/?id=".concat(r),target:"_blank",children:(0,s.jsx)(eK.Z,{fontSize:"small"})})})})]})]})}n(93207);var e7=l.memo(function(e){let{maxTextLength:t,columnVisibility:n,wordBreak:a,filterMode:r,failureFilter:i,searchText:c,showStats:d,onFailureFilterToggle:u,onSearchTextChange:h}=e,{evalId:p,table:x,setTable:g,inComparisonMode:v}=eh(),{showToast:j}=m();(0,y.Z)(x,"Table should be defined");let{head:f,body:b}=x,Z=l.useCallback(async(e,t,n,s,l)=>{var a,r;let i=[...b],c={...i[e]},d=[...c.outputs],u=null!=n?n:d[t].pass,h=void 0===s?n?1:0:s||0;d[t].pass=u,d[t].score=h;let m=(null===(a=d[t].gradingResult)||void 0===a?void 0:a.componentResults)||[];if(void 0!==n){let e=m.findIndex(e=>{var t;return(null===(t=e.assertion)||void 0===t?void 0:t.type)==="human"}),t={pass:u,score:h,reason:"Manual result (overrides all other grading results)",comment:l,assertion:{type:"human"}};-1!==e?m[e]=t:m.push(t)}let x={...d[t].gradingResult||{},pass:u,score:h,reason:"Manual result (overrides all other grading results)",comment:l,assertion:(null===(r=d[t].gradingResult)||void 0===r?void 0:r.assertion)||null,componentResults:m};d[t].gradingResult=x,c.outputs=d,i[e]=c;let y={head:f,body:i};if(g(y),v)j("Ratings are not saved in comparison mode","warning");else try{let e=await fetch("".concat(await (0,o.b)(),"/api/eval/").concat(p),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:y})});if(!e.ok)throw Error("Network response was not ok")}catch(e){console.error("Failed to update table:",e)}},[b,f,g,p,v,j]),w=Object.keys(n).length>0,C=l.useMemo(()=>{try{return RegExp(c,"i")}catch(e){return console.error("Invalid regular expression:",e.message),null}},[c]),k=l.useMemo(()=>{try{return b.map((e,t)=>({...e,outputs:e.outputs.map((e,n)=>({...e,originalRowIndex:t,originalPromptIndex:n}))})).filter(e=>{let t=!0;return"failures"===r?t=e.outputs.some((e,t)=>{let s="Prompt ".concat(t+1);return i[s]&&!e.pass&&(!w||n[s])}):"different"===r?t=!e.outputs.every(t=>t.text===e.outputs[0].text):"highlights"===r&&(console.log(e.outputs[0].text),t=e.outputs.some(e=>{var t,n;return null===(n=e.gradingResult)||void 0===n?void 0:null===(t=n.comment)||void 0===t?void 0:t.startsWith("!highlight")})),!!t&&(!c||!C||e.outputs.some(t=>{var n,s;let l=e.vars.map(e=>"var=".concat(e)).join(" "),a="".concat(t.text," ").concat(Object.keys(t.namedScores).map(e=>"metric=".concat(e,":").concat(t.namedScores[e])).join(" ")," ").concat((null===(n=t.gradingResult)||void 0===n?void 0:n.reason)||""," ").concat((null===(s=t.gradingResult)||void 0===s?void 0:s.comment)||""),r="".concat(l," ").concat(a);return C.test(r)}))})}catch(e){return console.error("Invalid regular expression:",e.message),b}},[b,i,r,c,n,w,C]),[S,R]=l.useState({pageIndex:0,pageSize:50});l.useEffect(()=>{R(e=>({...e,pageIndex:0}))},[i,r,c]);let I=l.useMemo(()=>f.prompts.map((e,t)=>b.reduce((e,n)=>e+(n.outputs[t].pass?1:0),0)),[f.prompts,b]),F=l.useMemo(()=>f.prompts.map((e,t)=>b.reduce((e,n)=>{var s,l;return e+((null===(l=n.outputs[t].gradingResult)||void 0===l?void 0:null===(s=l.componentResults)||void 0===s?void 0:s.length)||0)},0)),[f.prompts,b]),T=l.useMemo(()=>f.prompts.map((e,t)=>b.reduce((e,n)=>{var s;let l=null===(s=n.outputs[t].gradingResult)||void 0===s?void 0:s.componentResults;return e+(l?l.filter(e=>null==e?void 0:e.pass).length:0)},0)),[f.prompts,b]),D=l.useMemo(()=>I.reduce((e,t,n,s)=>t>s[e]?n:e,0),[I]),M=I[D],O=l.useMemo(()=>(0,eD.Cl)(),[]),{renderMarkdown:L}=eh(),U=l.useMemo(()=>f.vars.length>0?[O.group({id:"vars",header:()=>(0,s.jsx)("span",{className:"font-bold",children:"Variables"}),columns:f.vars.map((e,n)=>O.accessor(e=>e.vars[n],{id:"Variable ".concat(n+1),header:()=>(0,s.jsx)(e4,{text:e,maxLength:t,className:"font-bold"}),cell:e=>{let n=e.getValue();return(0,s.jsx)("div",{className:"cell",children:L?(0,s.jsx)(eO.U,{remarkPlugins:[eY.Z],children:n}):(0,s.jsx)(eH,{text:n,maxLength:t})})},size:50}))})]:[],[O,f.vars,t,L]),z=l.useCallback((e,t)=>k[e].outputs[t],[k]),V=l.useCallback(e=>k[e].outputs[0],[k]),J=l.useMemo(()=>{let e={};return null==x||x.body.forEach(t=>{var n;null===(n=t.test.assert)||void 0===n||n.forEach(t=>{t.metric&&(e[t.metric]=(e[t.metric]||0)+1),"assert"in t&&Array.isArray(t.assert)&&t.assert.forEach(t=>{"metric"in t&&t.metric&&(e[t.metric]=(e[t.metric]||0)+1)})})}),e},[x]),H=l.useMemo(()=>[O.group({id:"prompts",header:()=>(0,s.jsx)("span",{className:"font-bold",children:"Outputs"}),columns:f.prompts.map((e,n)=>O.accessor(e=>(function(e){if("string"==typeof e){let t=e.startsWith("[PASS]"),n=e;return e.startsWith("[PASS]")?n=n.slice(6):e.startsWith("[FAIL]")&&(n=n.slice(6)),{text:n,pass:t,score:t?1:0}}return e})(e.outputs[n]),{id:"Prompt ".concat(n+1),header:()=>{var l,a,o,c,p,m,x,g;let v=I[n]&&b.length?(I[n]/b.length*100).toFixed(2):"0.00",j=I[n]===M&&0!==M,f="Prompt ".concat(n+1),y=i[f]||!1,Z=d?(0,s.jsxs)("div",{className:"prompt-detail",children:[F[n]?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Asserts:"})," ",T[n],"/",F[n]," passed"]}):null,(null===(l=e.metrics)||void 0===l?void 0:l.totalLatencyMs)?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Avg Latency:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.totalLatencyMs/b.length)," ","ms"]}):null,(null===(o=e.metrics)||void 0===o?void 0:null===(a=o.tokenUsage)||void 0===a?void 0:a.total)?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Avg Tokens:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.tokenUsage.total/b.length)]}):null,(null===(c=e.metrics)||void 0===c?void 0:c.totalLatencyMs)&&(null===(m=e.metrics)||void 0===m?void 0:null===(p=m.tokenUsage)||void 0===p?void 0:p.completion)?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Tokens/Sec:"})," ",Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e.metrics.tokenUsage.completion/(e.metrics.totalLatencyMs/1e3))]}):null,(null===(x=e.metrics)||void 0===x?void 0:x.cost)?(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Cost:"})," $",e.metrics.cost.toPrecision(2)]}):null]}):null,w=e.provider?e.provider.split(":"):[],C=w.length>1?(0,s.jsxs)(s.Fragment,{children:[w[0],":",(0,s.jsx)("strong",{children:w.slice(1).join(":")})]}):(0,s.jsx)("strong",{children:e.provider});return(0,s.jsxs)("div",{className:"output-header",children:[(0,s.jsxs)("div",{className:"pills",children:[e.provider?(0,s.jsx)("div",{className:"provider",children:C}):null,(0,s.jsx)("div",{className:"summary",children:(0,s.jsxs)("div",{className:"highlight ".concat(j?"success":""),children:[(0,s.jsxs)("strong",{children:[v,"% passing"]})," (",I[n],"/",b.length," cases)"]})}),(null===(g=e.metrics)||void 0===g?void 0:g.namedScores)&&Object.keys(e.metrics.namedScores).length>0?(0,s.jsx)(eL,{lookup:e.metrics.namedScores,metricTotals:J,onSearchTextChange:h}):null]}),(0,s.jsx)(e4,{className:"prompt-container",text:e.label||e.display||e.raw,expandedText:e.raw,maxLength:t,resourceId:e.id}),Z,"failures"===r&&(0,s.jsx)(eG.Z,{sx:{"& .MuiFormControlLabel-label":{fontSize:"0.75rem"}},control:(0,s.jsx)(P.Z,{checked:y,onChange:e=>u(f,e.target.checked)}),label:"Show failures"})]})},cell:e=>{var l,a;let i=z(e.row.index,n);return(0,s.jsx)(e5,{output:i,maxTextLength:t,rowIndex:e.row.index,promptIndex:n,onRating:Z.bind(null,null!==(l=i.originalRowIndex)&&void 0!==l?l:e.row.index,null!==(a=i.originalPromptIndex)&&void 0!==a?a:n),firstOutput:V(e.row.index),showDiffs:"different"===r,searchText:c,showStats:d})}}))})],[b.length,O,i,r,V,z,Z,f.prompts,M,t,J,F,T,I,u,h,c,d]),K=l.useMemo(()=>{let e=b.some(e=>e.description);return e?{accessorFn:e=>e.description||"",id:"description",header:()=>(0,s.jsx)("span",{className:"font-bold",children:"Description"}),cell:e=>(0,s.jsx)("div",{className:"cell",children:(0,s.jsx)(eH,{text:String(e.getValue()),maxLength:t})}),size:50}:null},[b,t]),G=l.useMemo(()=>{let e=[];return K&&e.push(K),e.push(...U,...H),e},[K,U,H]),X=(0,eM.b7)({data:k,columns:G,columnResizeMode:"onChange",getCoreRowModel:(0,eD.sC)(),getPaginationRowModel:(0,eD.G_)(),state:{columnVisibility:n,pagination:S}});return(0,s.jsxs)("div",{children:[(0,s.jsxs)("table",{className:"results-table firefox-fix ".concat(t<=25?"compact":""),style:{wordBreak:a},children:[(0,s.jsx)("thead",{children:X.getHeaderGroups().map(e=>(0,s.jsx)("tr",{className:"header",children:e.headers.map(e=>(0,s.jsxs)("th",{colSpan:e.colSpan,style:{width:e.getSize()},children:[e.isPlaceholder?null:(0,eM.ie)(e.column.columnDef.header,e.getContext()),(0,s.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(e.column.getIsResizing()?"isResizing":"")})]},e.id))},e.id))}),(0,s.jsx)("tbody",{children:X.getRowModel().rows.map((e,t)=>{let n=!1;return(0,s.jsx)("tr",{children:e.getVisibleCells().map(e=>{let l=e.column.id.startsWith("Variable")||"description"===e.column.id,a=!l&&!n;return a&&(n=!0),(0,s.jsx)("td",{style:{width:e.column.getSize()},className:"".concat(l?"variable":""," ").concat(0!==t||l?"":"first-prompt-row"," ").concat(a?"first-prompt-col":""),children:(0,eM.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]}),X.getPageCount()>1&&(0,s.jsxs)(N.Z,{className:"pagination",mx:1,sx:{display:"flex",alignItems:"center",gap:2},children:[(0,s.jsx)(E.Z,{onClick:()=>{R(e=>({...e,pageIndex:Math.max(e.pageIndex-1,0)})),window.scrollTo(0,0)},disabled:0===X.getState().pagination.pageIndex,variant:"contained",children:"Previous"}),(0,s.jsxs)(B.Z,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:["Page",(0,s.jsx)(_.Z,{size:"small",type:"number",value:X.getState().pagination.pageIndex+1,onChange:e=>{let t=e.target.value?Number(e.target.value)-1:0;R(e=>({...e,pageIndex:Math.min(Math.max(t,0),X.getPageCount()-1)}))},InputProps:{style:{width:"60px",textAlign:"center"}},variant:"outlined"}),(0,s.jsxs)("span",{children:["of ",X.getPageCount()]})]}),(0,s.jsx)(E.Z,{onClick:()=>{R(e=>({...e,pageIndex:Math.min(e.pageIndex+1,X.getPageCount()-1)})),window.scrollTo(0,0)},disabled:X.getState().pagination.pageIndex+1>=X.getPageCount(),variant:"contained",children:"Next"}),(0,s.jsxs)(B.Z,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[(0,s.jsxs)(W.Z,{value:S.pageSize,onChange:e=>{R({pageIndex:0,pageSize:Number(e.target.value)}),window.scrollTo(0,0)},displayEmpty:!0,inputProps:{"aria-label":"Results per page"},size:"small",sx:{m:1,minWidth:80},children:[(0,s.jsx)(A.Z,{value:10,children:"10"}),(0,s.jsx)(A.Z,{value:50,children:"50"}),(0,s.jsx)(A.Z,{value:100,children:"100"}),(0,s.jsx)(A.Z,{value:500,children:"500"}),(0,s.jsx)(A.Z,{value:1e3,children:"1000"})]}),(0,s.jsx)("span",{children:"results per page"})]})]}),(0,s.jsx)(eB,{})]})}),e6=n(22695),e8=e=>{let{open:t,onClose:n}=e,{maxTextLength:l,setMaxTextLength:a,wordBreak:r,setWordBreak:i,showInferenceDetails:o,setShowInferenceDetails:c,renderMarkdown:d,setRenderMarkdown:u,prettifyJson:h,setPrettifyJson:p,showPrompts:m,setShowPrompts:x,showPassFail:g,setShowPassFail:v}=eh();return(0,s.jsxs)(G.Z,{open:t,onClose:n,fullWidth:!0,maxWidth:"sm",children:[(0,s.jsx)(Y.Z,{children:"Table View Settings"}),(0,s.jsxs)(q.Z,{children:[(0,s.jsx)(N.Z,{children:(0,s.jsx)(V.Z,{title:"Forcing line breaks makes it easier to adjust column widths to your liking",placement:"right",children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:"break-all"===r,onChange:e=>i(e.target.checked?"break-all":"break-word")}),label:"Force line breaks"})})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:d,onChange:e=>u(e.target.checked)}),label:"Render model outputs as Markdown"})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:h,onChange:e=>p(e.target.checked)}),label:"Prettify JSON outputs"})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(V.Z,{title:"Show the final prompt that produced the output in each cell.",placement:"right",children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:m,onChange:e=>x(e.target.checked)}),label:"Show full prompt in output cell"})})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(V.Z,{title:"Show pass/fail status for each output.",placement:"right",children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:g,onChange:e=>v(e.target.checked)}),label:"Show pass/fail status"})})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(V.Z,{title:"Show detailed inference statistics such as latency, tokens used, cost, etc.",placement:"right",children:(0,s.jsx)(eG.Z,{control:(0,s.jsx)(P.Z,{checked:o,onChange:e=>c(e.target.checked)}),label:"Show inference details"})})}),(0,s.jsxs)(N.Z,{maxWidth:"sm",children:[(0,s.jsxs)(B.Z,{mt:2,children:["Max text length: ",l]}),(0,s.jsx)(e6.ZP,{min:25,max:1e3,value:l,onChange:(e,t)=>a(t)})]})]}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:n,children:"Close"})})]})},e9=e=>{let{open:t,onClose:n,shareUrl:a}=e,r=(0,l.useRef)(null),[i,o]=(0,l.useState)(!1),c=()=>{n(),o(!1)};return(0,s.jsxs)(G.Z,{open:t,onClose:c,PaperProps:{style:{minWidth:"min(660px, 100%)"}},children:[(0,s.jsx)(Y.Z,{children:"Your eval is ready to share"}),(0,s.jsxs)(q.Z,{children:[(0,s.jsx)(_.Z,{inputRef:r,value:a,fullWidth:!0,InputProps:{readOnly:!0,endAdornment:(0,s.jsx)(ev.Z,{onClick:()=>{r.current&&(r.current.select(),document.execCommand("copy"),o(!0))},children:i?(0,s.jsx)(em.Z,{}):(0,s.jsx)(eg.Z,{})})}}),(0,s.jsx)(eV.Z,{sx:{fontSize:"0.75rem"},children:"Shared URLs are deleted after 2 weeks."})]}),(0,s.jsx)(X.Z,{children:(0,s.jsx)(E.Z,{onClick:c,color:"primary",children:"Close"})})]})};n(58022);let te=(0,J.Z)(z.Z)(e=>{let{theme:t}=e;return{maxWidth:"100%",flexWrap:"wrap",[t.breakpoints.down("sm")]:{flexDirection:"column"}}});function tt(e){var t;let{recentEvals:n,onRecentEvalSelected:a,defaultEvalId:c}=e,d=(0,f.useRouter)(),h=(0,f.useSearchParams)(),{author:p,table:m,setTable:x,config:g,setConfig:j,maxTextLength:b,wordBreak:z,showInferenceDetails:J,evalId:K,inComparisonMode:G,setInComparisonMode:X}=eh(),{setStateFromConfig:q}=(0,Z.o)(),[Y,$]=l.useState((null==h?void 0:h.get("search"))||""),[Q]=(0,H.Nr)(Y,1e3),ee=e=>{$(e)},[et,en]=l.useState({}),es=l.useCallback((e,t)=>{en(n=>({...n,[e]:t}))},[en]);(0,y.Z)(m,"Table data must be loaded before rendering ResultsView");let{head:el}=m,[ea,er]=l.useState("all"),[ei,eo]=l.useState(!1),[ec,ed]=l.useState(""),[eu,em]=l.useState(!1),[ex,eg]=l.useState(null),ev=async()=>{em(!0);try{let e=await fetch("".concat(r,"/api/eval"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:{version:2,createdAt:new Date().toISOString(),results:{table:m},config:g}})}),{id:t}=await e.json(),n="".concat(i,"/eval/").concat(t);ed(n),eo(!0)}catch(e){alert("Sorry, something went wrong.")}finally{em(!1)}},ef=async e=>{eg(null);try{var t;let s=await fetch("".concat(await (0,o.b)(),"/api/results/").concat(e),{cache:"no-store"}),l=await s.json(),a=l.data.results.table,r={head:{prompts:[...m.head.prompts.map(e=>{var t;return{...e,label:"[".concat(K||c||(null===(t=n[0])||void 0===t?void 0:t.evalId)||"Eval A","] ").concat(e.label||"")}}),...a.head.prompts.map(t=>({...t,label:"[".concat(e,"] ").concat(t.label||"")}))],vars:m.head.vars},body:m.body.map((e,t)=>{var n;return{...e,outputs:[...e.outputs,...(null===(n=a.body[t])||void 0===n?void 0:n.outputs)||[]]}})};x(r),j({...g,...l.data.config,description:'Combined: "'.concat((null==g?void 0:g.description)||"Eval A",'" and "').concat((null===(t=l.data.config)||void 0===t?void 0:t.description)||"Eval B",'"')}),X(!0)}catch(e){console.error("Error fetching comparison eval:",e),alert("Failed to load comparison eval. Please try again.")}},eb=l.useMemo(()=>m.body.some(e=>e.description),[m.body]),eZ=l.useMemo(()=>[...eb?[{value:"description",label:"Description"}]:[],...el.vars.map((e,t)=>({value:"Variable ".concat(t+1),label:"Var ".concat(t+1,": ").concat(el.vars[t].length>100?el.vars[t].slice(0,97)+"...":el.vars[t]),group:"Variables"})),...el.prompts.map((e,t)=>{let n=el.prompts[t],s=n.label||n.display||n.raw;return{value:"Prompt ".concat(t+1),label:"Prompt ".concat(t+1,": ").concat(s.length>100?s.slice(0,97)+"...":s),group:"Prompts"}})],[el.vars,el.prompts,eb]),[eC,ek]=l.useState(!1),[eS,eR]=l.useState(!1),[eI,eN]=l.useState({}),[eE,eP]=l.useState(eZ.map(e=>e.value)),eF=async()=>{(0,y.Z)(g,"Config must be loaded before clicking its description");let e=window.prompt("Enter new description:",g.description);if(null!==e&&e!==g.description){let t={...g,description:e};try{let e=await fetch("".concat(await (0,o.b)(),"/api/eval/").concat(K),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:t})});if(!e.ok)throw Error("Network response was not ok");j(t)}catch(e){console.error("Failed to update table:",e)}}},eD=async()=>{if(window.confirm("Are you sure you want to delete this evaluation?"))try{let e=await fetch("".concat(await (0,o.b)(),"/api/eval/").concat(K),{method:"DELETE"});if(!e.ok)throw Error("Network response was not ok");d.push("/")}catch(e){console.error("Failed to delete evaluation:",e),alert("Failed to delete evaluation")}},[eM,eO]=l.useState(!1),eL=async()=>{K&&(await navigator.clipboard.writeText(K),eO(!0),setTimeout(()=>{eO(!1)},1e3))};return(0,s.jsxs)("div",{style:{marginLeft:"1rem",marginRight:"1rem"},children:[(0,s.jsxs)(te,{direction:"row",mb:2,spacing:1,alignItems:"center",className:"eval-header",children:[n&&n.length>0&&(0,s.jsx)(ew,{recentEvals:n,onRecentEvalSelected:a,currentEval:n.find(e=>e.evalId===K)||null}),!G&&(0,s.jsx)(B.Z,{variant:"h5",sx:{display:"flex",alignItems:"center"},children:(0,s.jsx)(V.Z,{title:"Click to edit description",children:(0,s.jsx)("span",{className:"description",onClick:eF,children:(null==g?void 0:g.description)||K})})}),(null==g?void 0:g.description)&&K&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(V.Z,{title:"Click to copy",children:(0,s.jsx)(F.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"ID:"})," ",K]}),sx:{opacity:.7,cursor:"pointer"},onClick:eL})}),(0,s.jsx)(u.Z,{open:eM,autoHideDuration:1e3,onClose:()=>eO(!1),message:"Eval id copied to clipboard"})]}),(0,s.jsx)(V.Z,{title:p?"":"Set eval author with `promptfoo config set email`",children:(0,s.jsx)(F.Z,{size:"small",label:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("strong",{children:"Author:"})," ",p||"Unknown"]}),sx:{opacity:.7}})})]}),(0,s.jsxs)(te,{direction:"row",spacing:4,alignItems:"center",children:[(0,s.jsx)(N.Z,{children:(0,s.jsxs)(T.Z,{sx:{m:1,minWidth:200,maxWidth:350},size:"small",children:[(0,s.jsx)(D.Z,{id:"visible-columns-label",children:"Columns"}),(0,s.jsx)(W.Z,{labelId:"visible-columns-label",id:"visible-columns",multiple:!0,value:eE,onChange:e=>{let{target:{value:t}}=e;eP("string"==typeof t?t.split(","):t);let n=[...eb?["description"]:[],...el.vars.map((e,t)=>"Variable ".concat(t+1)),...el.prompts.map((e,t)=>"Prompt ".concat(t+1))],s={};n.forEach(e=>{s[e]=("string"==typeof t?t.split(","):t).includes(e)}),eN(s)},input:(0,s.jsx)(U.Z,{label:"Visible columns"}),renderValue:e=>e.join(", "),children:eZ.map(e=>(0,s.jsxs)(A.Z,{dense:!0,value:e.value,children:[(0,s.jsx)(P.Z,{checked:eE.indexOf(e.value)>-1}),(0,s.jsx)(O.Z,{primary:e.label})]},e.value))})]})}),(0,s.jsx)(N.Z,{children:(0,s.jsxs)(T.Z,{sx:{minWidth:180},size:"small",children:[(0,s.jsx)(D.Z,{id:"failure-filter-mode-label",children:"Display"}),(0,s.jsxs)(W.Z,{labelId:"filter-mode-label",id:"filter-mode",value:ea,onChange:e=>{let t=e.target.value;er(t);let n={};el.prompts.forEach((e,s)=>{n["Prompt ".concat(s+1)]="failures"===t}),en(n)},label:"Filter",children:[(0,s.jsx)(A.Z,{value:"all",children:"Show all results"}),(0,s.jsx)(A.Z,{value:"failures",children:"Show failures only"}),(0,s.jsx)(A.Z,{value:"different",children:"Show different only"}),(0,s.jsx)(A.Z,{value:"highlights",children:"Show highlights only"})]})]})}),(0,s.jsx)(N.Z,{children:(0,s.jsx)(_.Z,{sx:{minWidth:180},size:"small",label:"Search",placeholder:"Text or regex",value:Y,onChange:e=>ee(e.target.value)})}),(0,s.jsx)(N.Z,{flexGrow:1}),(0,s.jsx)(N.Z,{display:"flex",justifyContent:"flex-end",children:(0,s.jsxs)(te,{direction:"row",spacing:2,children:[(0,s.jsx)(E.Z,{color:"primary",onClick:e=>{eg(e.currentTarget)},startIcon:(0,s.jsx)(w.Z,{}),children:"Eval actions"}),g&&(0,s.jsxs)(L.Z,{id:"eval-actions-menu",anchorEl:ex,keepMounted:!0,open:!!ex,onClose:()=>{eg(null)},children:[(0,s.jsx)(ep,{initialEvals:n,onComparisonEvalSelected:ef}),(0,s.jsx)(V.Z,{title:"View the configuration that defines this eval",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:()=>ek(!0),children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(I.Z,{fontSize:"small"})}),"View YAML"]})}),(0,s.jsx)(V.Z,{title:"Edit this eval in the web UI",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:()=>{q(g),d.push("/setup/")},children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(k.Z,{fontSize:"small"})}),"Edit Eval"]})}),(0,s.jsx)(ey,{}),(null==g?void 0:g.sharing)&&(0,s.jsx)(V.Z,{title:"Generate a unique URL that others can access",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:ev,disabled:eu,children:[(0,s.jsx)(M.Z,{children:eu?(0,s.jsx)(v.Z,{size:16}):(0,s.jsx)(R.Z,{fontSize:"small"})}),"Share"]})}),(0,s.jsx)(V.Z,{title:"Delete this eval",placement:"left",children:(0,s.jsxs)(A.Z,{onClick:eD,children:[(0,s.jsx)(M.Z,{children:(0,s.jsx)(C.Z,{fontSize:"small"})}),"Delete"]})})]}),(0,s.jsx)(V.Z,{title:"Edit table view settings",placement:"bottom",children:(0,s.jsx)(E.Z,{color:"primary",onClick:()=>eR(!0),startIcon:(0,s.jsx)(S.Z,{}),children:"Table Settings"})}),(null==g?void 0:null===(t=g.metadata)||void 0===t?void 0:t.redteam)&&(0,s.jsx)(V.Z,{title:"View vulnerability scan report",placement:"bottom",children:(0,s.jsx)(E.Z,{color:"primary",startIcon:(0,s.jsx)(I.Z,{}),onClick:()=>{var e;return d.push("/report/?evalId=".concat(K||c||(null===(e=n[0])||void 0===e?void 0:e.evalId)))},children:"Vulnerability Report"})})]})})]}),(0,s.jsx)(eT,{columnVisibility:eI}),(0,s.jsx)(e7,{maxTextLength:b,columnVisibility:eI,wordBreak:z,showStats:J,filterMode:ea,failureFilter:et,searchText:Q,onFailureFilterToggle:es,onSearchTextChange:ee}),(0,s.jsx)(ej,{open:eC,onClose:()=>ek(!1)}),(0,s.jsx)(e9,{open:ei,onClose:()=>eo(!1),shareUrl:ec}),(0,s.jsx)(e8,{open:eS,onClose:()=>eR(!1)})]})}async function tn(){let e=(0,j.createClientComponentClient)(),{data:{user:t}}=await e.auth.getUser();(0,y.Z)(t,"User not logged in");let{data:n,error:s}=await e.from("EvaluationResult").select("id, createdAt").eq("user_id",t.id).order("createdAt",{ascending:!1}).limit(100);return n||[]}async function ts(e){let t=(0,j.createClientComponentClient)(),{data:n,error:s}=await t.from("EvaluationResult").select("*").eq("id",e).single();return n}function tl(e){var t;let{fetchId:n,preloadedData:a,recentEvals:i,defaultEvalId:c}=e,u=(0,f.useRouter)(),{table:h,setTable:p,setConfig:m,setEvalId:j,setAuthor:Z,setInComparisonMode:w}=eh(),[C,k]=l.useState(!1),[S,R]=l.useState(!1),[I,N]=l.useState(i||[]),E=async()=>{let e=await fetch("".concat(await (0,o.b)(),"/api/results"),{cache:"no-store"}),t=await e.json();return N(t.data),t.data},P=l.useCallback(async e=>{let t=await fetch("".concat(await (0,o.b)(),"/api/results/").concat(e),{cache:"no-store"}),n=await t.json();p(n.data.results.table),m(n.data.config),Z(n.data.author),j(e)},[p,m,j,Z]),F=async e=>{g.Ox?(k(!1),u.push("/eval/remote:".concat(encodeURIComponent(e)))):u.push("/eval/?evalId=".concat(encodeURIComponent(e)))},[T,D]=l.useState(c||(null===(t=I[0])||void 0===t?void 0:t.evalId)),M=(0,f.useSearchParams)(),O=M?M.get("evalId"):null;return(l.useEffect(()=>{if(O){let e=async()=>{await P(O),k(!0),D(O),E()};e()}else if(a){var e;p(null===(e=a.data.results)||void 0===e?void 0:e.table),m(a.data.config),Z(a.data.author||null),k(!0)}else if(n){let e=async()=>{var e;let t="".concat(r,"/api/eval/").concat(n);console.log("Fetching eval from remote server",t);let s=await fetch(t);if(!s.ok){R(!0);return}let l=await s.json();p(null===(e=l.data.results)||void 0===e?void 0:e.table),m(l.data.config),Z(l.data.author||null),k(!0)};e()}else if(g.T8)(0,o.b)().then(e=>{let t=(0,b.io)(e);return t.on("init",e=>{console.log("Initialized socket connection",e),k(!0),p(null==e?void 0:e.results.table),m(null==e?void 0:e.config),Z((null==e?void 0:e.author)||null),E().then(e=>{var t,n;D(null===(t=e[0])||void 0===t?void 0:t.id),j(null===(n=e[0])||void 0===n?void 0:n.id)})}),t.on("update",e=>{console.log("Received data update",e),p(e.results.table),m(e.config),Z(e.author||null),E().then(e=>{var t;let n=null===(t=e[0])||void 0===t?void 0:t.id;n&&(D(n),j(n))})}),()=>{t.disconnect()}});else if(g.Ox)tn().then(e=>{N(e.map(e=>({evalId:e.id,datasetId:null,label:e.createdAt,createdAt:new Date(e.createdAt).getTime(),description:"None",numTests:-1}))),e.length>0&&ts(e[0].id).then(t=>{(0,y.Z)(t,"Eval not found");let n=t.results,s=t.config;D(e[0].id),p(n.table),m(s),Z(null),k(!0)})});else{let e=async()=>{let e=await E();if(!(e.length>0))return(0,s.jsx)("div",{className:"notice",children:"No evals yet. Share some evals to this server and they will appear here."});{let t=await (0,o.b)(),n=e[0].id,s=await fetch("".concat(t,"/api/results/").concat(n)),l=await s.json();p(l.data.results.table),m(l.data.config),Z(l.data.author||null),k(!0),D(n),j(n)}};e()}w(!1)},[n,p,m,Z,j,P,a,D,O,w]),S)?(0,s.jsx)("div",{className:"notice",children:"404 Eval not found"}):C&&h?(0,s.jsx)(x,{children:(0,s.jsx)(d,{children:(0,s.jsx)(tt,{defaultEvalId:T,recentEvals:I,onRecentEvalSelected:F})})}):(0,s.jsxs)("div",{className:"notice",children:[(0,s.jsx)("div",{children:(0,s.jsx)(v.Z,{size:22})}),(0,s.jsx)("div",{children:"Waiting for eval data"})]})}n(94455)},52428:function(e,t,n){"use strict";n.d(t,{Ox:function(){return a},T8:function(){return l},eA:function(){return r}});var s=n(77580);let l=!s.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,a=!!s.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,r=""},47887:function(e,t,n){"use strict";n.d(t,{o:function(){return a}});var s=n(79685),l=n(74595);let a=(0,s.Ue)()((0,l.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:s,prompts:l,env:a,scenarios:r}=t();return{env:a,description:e,providers:s,prompts:l,tests:n,scenarios:r}}}),{name:"promptfoo",skipHydration:!0}))},55974:function(){},94455:function(){},16658:function(){},93207:function(){},58022:function(){}}]);
|