promptfoo 0.20.0 → 0.21.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 +1 -1
- package/dist/package.json +4 -4
- package/dist/src/assertions.d.ts.map +1 -1
- package/dist/src/assertions.js +5 -0
- package/dist/src/assertions.js.map +1 -1
- package/dist/src/evaluator.js +1 -1
- package/dist/src/evaluator.js.map +1 -1
- package/dist/src/index.d.ts +1 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/matchers.d.ts +3 -2
- package/dist/src/matchers.d.ts.map +1 -1
- package/dist/src/matchers.js +37 -9
- package/dist/src/matchers.js.map +1 -1
- package/dist/src/providers/anthropic.d.ts +5 -3
- package/dist/src/providers/anthropic.d.ts.map +1 -1
- package/dist/src/providers/anthropic.js +8 -10
- package/dist/src/providers/anthropic.js.map +1 -1
- package/dist/src/providers/azureopenai.d.ts +9 -8
- package/dist/src/providers/azureopenai.d.ts.map +1 -1
- package/dist/src/providers/azureopenai.js +33 -36
- package/dist/src/providers/azureopenai.js.map +1 -1
- package/dist/src/providers/openai.d.ts +12 -12
- package/dist/src/providers/openai.d.ts.map +1 -1
- package/dist/src/providers/openai.js +54 -65
- package/dist/src/providers/openai.js.map +1 -1
- package/dist/src/providers/replicate.d.ts +4 -2
- package/dist/src/providers/replicate.d.ts.map +1 -1
- package/dist/src/providers/replicate.js +10 -8
- package/dist/src/providers/replicate.js.map +1 -1
- package/dist/src/providers/webhook.d.ts +9 -0
- package/dist/src/providers/webhook.d.ts.map +1 -0
- package/dist/src/providers/webhook.js +54 -0
- package/dist/src/providers/webhook.js.map +1 -0
- package/dist/src/providers.d.ts +1 -1
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +36 -28
- package/dist/src/providers.js.map +1 -1
- package/dist/src/suggestions.d.ts.map +1 -1
- package/dist/src/suggestions.js +1 -3
- package/dist/src/suggestions.js.map +1 -1
- package/dist/src/types.d.ts +7 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/util.js +1 -1
- package/dist/src/util.js.map +1 -1
- package/dist/src/web/nextui/404/index.html +1 -1
- package/dist/src/web/nextui/404.html +1 -1
- package/dist/src/web/nextui/_next/static/Bl3o5lF4ON7Fjki46lPhr/_buildManifest.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/226-7bbb6c98a19542fd.js +37 -0
- package/dist/src/web/nextui/_next/static/chunks/249-ea9c0f034888ccff.js +125 -0
- package/dist/src/web/nextui/_next/static/chunks/339-501c32916b785ef1.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/365-e426ea5bc7e815fc.js +8 -0
- package/dist/src/web/nextui/_next/static/chunks/396-0a51429a01e24cdd.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/596-297f7ff4a0436e87.js +25 -0
- package/dist/src/web/nextui/_next/static/chunks/613-572c22424de64659.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/706-ae1d3352d28419e9.js +9 -0
- package/dist/src/web/nextui/_next/static/chunks/891-7035926a62c1c4e0.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-366629541fd598e9.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/page-319d2ee38d37574e.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-a6b1ff91723b7beb.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/layout-024c4adc71c9feb0.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/page-1ae60660130041b2.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/setup/page-6ef16148040bf4f4.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/{ca377847-cb6ae6a6a073aebb.js → ca377847-26b462611379a4f7.js} +3 -3
- package/dist/src/web/nextui/_next/static/chunks/{fd9d1056-ac777be631f5a9e9.js → fd9d1056-fba4b53a2f01213b.js} +1 -1
- package/dist/src/web/nextui/_next/static/chunks/framework-8883d1e9be70c3da.js +25 -0
- package/dist/src/web/nextui/_next/static/chunks/main-8ea85465d428ecfe.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/main-app-581ccf0003955b21.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/pages/_app-52924524f99094ab.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/pages/_error-c92d5c4bb2b49926.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/webpack-55c264ce2fd85eb7.js +1 -0
- package/dist/src/web/nextui/_next/static/css/4d399fceacd06992.css +1 -0
- package/dist/src/web/nextui/eval/index.html +1 -1
- package/dist/src/web/nextui/eval/index.txt +6 -6
- package/dist/src/web/nextui/index.html +1 -1
- package/dist/src/web/nextui/index.txt +5 -5
- package/dist/src/web/nextui/setup/index.html +27 -1
- package/dist/src/web/nextui/setup/index.txt +9 -9
- package/dist/src/web/server.d.ts.map +1 -1
- package/dist/src/web/server.js +9 -5
- package/dist/src/web/server.js.map +1 -1
- package/package.json +4 -4
- package/dist/src/web/nextui/_next/static/US6gOx8LHTX_Hzm9aYNrC/_buildManifest.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/339-4fc8a80fa840e771.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/373-8a280796c0f2d1af.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/583-125d32af505e9bc4.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/596-07e4a23a5c6cdf04.js +0 -25
- package/dist/src/web/nextui/_next/static/chunks/658-a62210d07dc4dcb6.js +0 -15
- package/dist/src/web/nextui/_next/static/chunks/707-699cbd84b259c37b.js +0 -37
- package/dist/src/web/nextui/_next/static/chunks/858-ceb6fa22e614492b.js +0 -125
- package/dist/src/web/nextui/_next/static/chunks/891-3000ea7c0a292558.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/not-found-50e40614fa05600e.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/page-c19c44ed1b2dfb58.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-d4a1813b2f8c4532.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/layout-664a8d716d2d24b1.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/page-1f8ef6a00a2355f0.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/app/setup/page-182018a3c6397345.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/framework-43665103d101a22d.js +0 -25
- package/dist/src/web/nextui/_next/static/chunks/main-50cc0a98559591ce.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/main-app-c9dc13756d166550.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/pages/_app-6b79a29ad0d63b21.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/pages/_error-9aeb3e4d490fe4b8.js +0 -1
- package/dist/src/web/nextui/_next/static/chunks/webpack-6e474e42be502dd7.js +0 -1
- package/dist/src/web/nextui/_next/static/css/a35c840ac696f161.css +0 -1
- package/dist/src/web/nextui/api +0 -1
- package/src/__mocks__/esm.ts +0 -3
- package/src/assertions.ts +0 -580
- package/src/cache.ts +0 -109
- package/src/esm.ts +0 -13
- package/src/evaluator.ts +0 -500
- package/src/index.ts +0 -52
- package/src/logger.ts +0 -46
- package/src/main.ts +0 -442
- package/src/matchers.ts +0 -120
- package/src/onboarding.ts +0 -69
- package/src/prompts.ts +0 -39
- package/src/providers/anthropic.ts +0 -88
- package/src/providers/azureopenai.ts +0 -299
- package/src/providers/llama.ts +0 -95
- package/src/providers/localai.ts +0 -111
- package/src/providers/ollama.ts +0 -89
- package/src/providers/openai.ts +0 -337
- package/src/providers/replicate.ts +0 -99
- package/src/providers/scriptCompletion.ts +0 -35
- package/src/providers/shared.ts +0 -34
- package/src/providers.ts +0 -192
- package/src/share.ts +0 -27
- package/src/suggestions.ts +0 -63
- package/src/table.ts +0 -43
- package/src/tableOutput.html +0 -52
- package/src/telemetry.ts +0 -70
- package/src/types.ts +0 -299
- package/src/updates.ts +0 -46
- package/src/util.ts +0 -543
- package/src/web/nextui/.eslintrc.json +0 -3
- package/src/web/nextui/next.config.js +0 -14
- package/src/web/nextui/package-lock.json +0 -4644
- package/src/web/nextui/package.json +0 -47
- package/src/web/nextui/public/favicon.ico +0 -0
- package/src/web/nextui/public/logo.svg +0 -30
- package/src/web/nextui/src/app/Home.css +0 -3
- package/src/web/nextui/src/app/api/route.ts +0 -6
- package/src/web/nextui/src/app/components/DarkMode.css +0 -22
- package/src/web/nextui/src/app/components/DarkMode.tsx +0 -17
- package/src/web/nextui/src/app/components/Logo.css +0 -32
- package/src/web/nextui/src/app/components/Logo.tsx +0 -11
- package/src/web/nextui/src/app/components/PageShell.css +0 -33
- package/src/web/nextui/src/app/components/PageShell.tsx +0 -87
- package/src/web/nextui/src/app/eval/ConfigModal.tsx +0 -84
- package/src/web/nextui/src/app/eval/Eval.css +0 -13
- package/src/web/nextui/src/app/eval/Eval.tsx +0 -79
- package/src/web/nextui/src/app/eval/EvalOutputPromptDialog.tsx +0 -127
- package/src/web/nextui/src/app/eval/ResultsCharts.tsx +0 -355
- package/src/web/nextui/src/app/eval/ResultsTable.css +0 -179
- package/src/web/nextui/src/app/eval/ResultsTable.tsx +0 -503
- package/src/web/nextui/src/app/eval/ResultsView.tsx +0 -301
- package/src/web/nextui/src/app/eval/ShareModal.tsx +0 -70
- package/src/web/nextui/src/app/eval/[id]/not-found.tsx +0 -5
- package/src/web/nextui/src/app/eval/[id]/page.css +0 -9
- package/src/web/nextui/src/app/eval/[id]/page.tsx +0 -20
- package/src/web/nextui/src/app/eval/index.css +0 -0
- package/src/web/nextui/src/app/eval/page.tsx +0 -8
- package/src/web/nextui/src/app/eval/store.ts +0 -18
- package/src/web/nextui/src/app/eval/types.ts +0 -20
- package/src/web/nextui/src/app/globals.css +0 -58
- package/src/web/nextui/src/app/layout.tsx +0 -25
- package/src/web/nextui/src/app/page.tsx +0 -7
- package/src/web/nextui/src/app/setup/AssertsForm.tsx +0 -118
- package/src/web/nextui/src/app/setup/PromptDialog.tsx +0 -77
- package/src/web/nextui/src/app/setup/PromptsSection.tsx +0 -190
- package/src/web/nextui/src/app/setup/ProviderConfigDialog.tsx +0 -99
- package/src/web/nextui/src/app/setup/ProviderSelector.tsx +0 -149
- package/src/web/nextui/src/app/setup/RunTestSuiteButton.tsx +0 -88
- package/src/web/nextui/src/app/setup/TestCaseDialog.tsx +0 -108
- package/src/web/nextui/src/app/setup/TestCasesSection.tsx +0 -154
- package/src/web/nextui/src/app/setup/VarsForm.tsx +0 -57
- package/src/web/nextui/src/app/setup/page.css +0 -3
- package/src/web/nextui/src/app/setup/page.tsx +0 -160
- package/src/web/nextui/src/util/api.ts +0 -1
- package/src/web/nextui/src/util/store.ts +0 -53
- package/src/web/nextui/tsconfig.json +0 -28
- package/src/web/server.ts +0 -151
- /package/dist/src/web/nextui/_next/static/{US6gOx8LHTX_Hzm9aYNrC → Bl3o5lF4ON7Fjki46lPhr}/_ssgManifest.js +0 -0
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "nextui",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "next dev",
|
|
7
|
-
"build": "next build",
|
|
8
|
-
"start": "next start",
|
|
9
|
-
"lint": "next lint"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@emotion/react": "^11.11.1",
|
|
13
|
-
"@emotion/styled": "^11.11.0",
|
|
14
|
-
"@mui/icons-material": "^5.14.3",
|
|
15
|
-
"@mui/material": "^5.14.4",
|
|
16
|
-
"@tanstack/react-table": "^8.9.3",
|
|
17
|
-
"@types/diff": "^5.0.3",
|
|
18
|
-
"@types/node": "20.4.10",
|
|
19
|
-
"@types/react": "18.2.20",
|
|
20
|
-
"@types/react-dom": "18.2.7",
|
|
21
|
-
"@types/react-syntax-highlighter": "^15.5.7",
|
|
22
|
-
"@types/uuid": "^9.0.2",
|
|
23
|
-
"chart.js": "^4.3.3",
|
|
24
|
-
"debounce": "^1.2.1",
|
|
25
|
-
"diff": "^5.1.0",
|
|
26
|
-
"eslint": "8.47.0",
|
|
27
|
-
"eslint-config-next": "13.4.13",
|
|
28
|
-
"js-yaml": "^4.1.0",
|
|
29
|
-
"next": "13.4.13",
|
|
30
|
-
"opener": "^1.5.2",
|
|
31
|
-
"react": "18.2.0",
|
|
32
|
-
"react-dnd": "^16.0.1",
|
|
33
|
-
"react-dnd-html5-backend": "^16.0.1",
|
|
34
|
-
"react-dom": "18.2.0",
|
|
35
|
-
"react-error-boundary": "^4.0.11",
|
|
36
|
-
"react-syntax-highlighter": "^15.5.0",
|
|
37
|
-
"socket.io": "^4.7.2",
|
|
38
|
-
"socket.io-client": "^4.7.2",
|
|
39
|
-
"tiny-invariant": "^1.3.1",
|
|
40
|
-
"typescript": "5.1.6",
|
|
41
|
-
"uuid": "^9.0.0",
|
|
42
|
-
"zustand": "^4.4.1"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@types/js-yaml": "^4.0.5"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
Binary file
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" standalone="no"?>
|
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
|
3
|
-
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
|
4
|
-
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
width="700.000000pt" height="700.000000pt" viewBox="0 0 700.000000 700.000000"
|
|
6
|
-
preserveAspectRatio="xMidYMid meet">
|
|
7
|
-
<metadata>
|
|
8
|
-
Created by potrace 1.14, written by Peter Selinger 2001-2017
|
|
9
|
-
</metadata>
|
|
10
|
-
<g transform="translate(0.000000,700.000000) scale(0.100000,-0.100000)"
|
|
11
|
-
fill="#000000" stroke="none">
|
|
12
|
-
<path d="M597 6384 c-77 -13 -152 -51 -204 -103 -44 -43 -88 -101 -77 -101 3
|
|
13
|
-
0 1 -6 -5 -14 -6 -7 -18 -35 -26 -62 -13 -43 -15 -320 -12 -2194 l2 -2145 33
|
|
14
|
-
-67 c53 -109 147 -187 262 -218 33 -9 301 -12 1046 -12 922 0 1004 -1 1017
|
|
15
|
-
-16 8 -10 37 -49 64 -88 274 -400 435 -626 470 -660 124 -118 298 -141 458
|
|
16
|
-
-61 43 21 135 110 187 181 18 24 49 63 69 87 19 24 127 159 238 301 l203 256
|
|
17
|
-
1033 0 c906 0 1040 2 1086 16 130 37 230 136 269 264 20 63 20 95 20 2187 0
|
|
18
|
-
1909 -2 2127 -16 2176 -9 30 -22 61 -30 70 -8 8 -14 19 -14 23 0 17 -55 78
|
|
19
|
-
-99 110 -25 19 -75 44 -111 57 l-65 22 -2868 1 c-1966 1 -2888 -2 -2930 -10z
|
|
20
|
-
m3951 -954 c57 -26 379 -345 411 -408 30 -59 31 -133 3 -196 -26 -58 -220
|
|
21
|
-
-256 -251 -256 -25 0 -599 573 -607 607 -5 19 0 32 23 56 17 18 57 61 89 96
|
|
22
|
-
74 79 106 102 163 117 58 14 111 9 169 -16z m-351 -712 c156 -156 290 -294
|
|
23
|
-
297 -308 8 -15 11 -33 6 -45 -12 -33 -1398 -1412 -1425 -1419 -22 -6 -58 27
|
|
24
|
-
-315 285 -160 160 -295 299 -300 309 -13 24 -14 23 270 310 866 876 1142 1150
|
|
25
|
-
1161 1150 14 0 116 -94 306 -282z m-1617 -1658 c322 -321 325 -326 270 -381
|
|
26
|
-
-16 -16 -37 -29 -47 -30 -22 -1 -12 1 -198 -44 -410 -99 -479 -115 -504 -115
|
|
27
|
-
-16 0 -40 11 -55 25 -25 23 -27 31 -23 73 2 26 8 61 11 77 19 82 79 327 91
|
|
28
|
-
375 8 30 26 101 39 158 27 115 51 152 97 152 24 0 77 -48 319 -290z"/>
|
|
29
|
-
</g>
|
|
30
|
-
</svg>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
nav {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: space-between;
|
|
4
|
-
align-items: center;
|
|
5
|
-
margin-bottom: 1rem;
|
|
6
|
-
color: var(--text-color);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.dark-mode-toggle {
|
|
10
|
-
display: flex;
|
|
11
|
-
background-color: transparent;
|
|
12
|
-
border: none;
|
|
13
|
-
color: var(--text-color);
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
font-size: 16px;
|
|
16
|
-
padding: 8px;
|
|
17
|
-
transition: color 0.3s;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.dark-mode-toggle:hover {
|
|
21
|
-
color: var(--pass-color);
|
|
22
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import DarkModeIcon from '@mui/icons-material/DarkMode';
|
|
2
|
-
import LightModeIcon from '@mui/icons-material/LightMode';
|
|
3
|
-
|
|
4
|
-
import './DarkMode.css';
|
|
5
|
-
|
|
6
|
-
interface NavbarProps {
|
|
7
|
-
darkMode: boolean;
|
|
8
|
-
onToggleDarkMode: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default function NavBar({ darkMode, onToggleDarkMode }: NavbarProps) {
|
|
12
|
-
return (
|
|
13
|
-
<div className="dark-mode-toggle" onClick={onToggleDarkMode}>
|
|
14
|
-
{darkMode ? <DarkModeIcon /> : <LightModeIcon />}
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
.logo {
|
|
2
|
-
display: flex;
|
|
3
|
-
font-family: mono;
|
|
4
|
-
font-size: 0.8rem;
|
|
5
|
-
align-items: center;
|
|
6
|
-
gap: 8px;
|
|
7
|
-
background-color: #f0f0f0;
|
|
8
|
-
padding: 0 2rem 0 0;
|
|
9
|
-
border-radius: 0.5rem;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
[data-theme='dark'] .logo {
|
|
13
|
-
background-color: #333;
|
|
14
|
-
border-color: #444;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.logo img {
|
|
18
|
-
width: 25px;
|
|
19
|
-
margin-top: 2px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
[data-theme='dark'] .logo img {
|
|
23
|
-
filter: invert(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.logo span {
|
|
27
|
-
color: var(--text-color);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
[data-theme='dark'] .logo span {
|
|
31
|
-
color: #f0f0f0;
|
|
32
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
.nav {
|
|
2
|
-
padding: 0.25rem 0 0.25rem 1rem;
|
|
3
|
-
background-color: #eee;
|
|
4
|
-
margin-bottom: 1rem;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
[data-theme='dark'] .nav {
|
|
8
|
-
background-color: #333;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.nav a {
|
|
12
|
-
padding: 0 0.5rem;
|
|
13
|
-
text-decoration: none;
|
|
14
|
-
color: #000;
|
|
15
|
-
align-self: center;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[data-theme='dark'] .nav a {
|
|
19
|
-
color: #f0f0f0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.nav div:last-child {
|
|
23
|
-
margin-left: auto;
|
|
24
|
-
margin-right: 0.5rem;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.nav a:hover {
|
|
28
|
-
text-decoration: underline;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
[data-theme='dark'] .nav a:hover {
|
|
32
|
-
color: #ddd;
|
|
33
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import Link from 'next/link';
|
|
5
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
6
|
-
import { Stack } from '@mui/material';
|
|
7
|
-
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|
8
|
-
|
|
9
|
-
import Logo from './Logo';
|
|
10
|
-
import DarkMode from './DarkMode';
|
|
11
|
-
|
|
12
|
-
import './PageShell.css';
|
|
13
|
-
|
|
14
|
-
export { PageShell };
|
|
15
|
-
|
|
16
|
-
function PageShell({ children }: { children: React.ReactNode }) {
|
|
17
|
-
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
|
|
18
|
-
const [darkMode, setDarkMode] = React.useState(prefersDarkMode);
|
|
19
|
-
|
|
20
|
-
const theme = React.useMemo(
|
|
21
|
-
() =>
|
|
22
|
-
createTheme({
|
|
23
|
-
typography: {
|
|
24
|
-
fontFamily: 'inherit',
|
|
25
|
-
},
|
|
26
|
-
palette: {
|
|
27
|
-
mode: darkMode ? 'dark' : 'light',
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
[darkMode],
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
const toggleDarkMode = () => {
|
|
34
|
-
setDarkMode(!darkMode);
|
|
35
|
-
if (!darkMode) {
|
|
36
|
-
document.documentElement.setAttribute('data-theme', 'dark');
|
|
37
|
-
} else {
|
|
38
|
-
document.documentElement.removeAttribute('data-theme');
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (prefersDarkMode) {
|
|
44
|
-
document.documentElement.setAttribute('data-theme', 'dark');
|
|
45
|
-
}
|
|
46
|
-
}, [prefersDarkMode]);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<React.StrictMode>
|
|
50
|
-
<ThemeProvider theme={theme}>
|
|
51
|
-
<Layout>
|
|
52
|
-
<Navigation darkMode={darkMode} onToggleDarkMode={toggleDarkMode} />
|
|
53
|
-
<div>{children}</div>
|
|
54
|
-
</Layout>
|
|
55
|
-
</ThemeProvider>
|
|
56
|
-
</React.StrictMode>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function Layout({ children }: { children: React.ReactNode }) {
|
|
61
|
-
return <div>{children}</div>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function Navigation({
|
|
65
|
-
darkMode,
|
|
66
|
-
onToggleDarkMode,
|
|
67
|
-
}: {
|
|
68
|
-
darkMode: boolean;
|
|
69
|
-
onToggleDarkMode: () => void;
|
|
70
|
-
}) {
|
|
71
|
-
if (process.env.NEXT_PUBLIC_NO_BROWSING) {
|
|
72
|
-
return (
|
|
73
|
-
<Stack direction="row" spacing={2} className="nav">
|
|
74
|
-
<Logo />
|
|
75
|
-
<DarkMode darkMode={darkMode} onToggleDarkMode={onToggleDarkMode} />
|
|
76
|
-
</Stack>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
return (
|
|
80
|
-
<Stack direction="row" spacing={2} className="nav">
|
|
81
|
-
<Logo />
|
|
82
|
-
<Link href="/setup">New Eval</Link>
|
|
83
|
-
<Link href="/eval">View Evals</Link>
|
|
84
|
-
<DarkMode darkMode={darkMode} onToggleDarkMode={onToggleDarkMode} />
|
|
85
|
-
</Stack>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Box from '@mui/material/Box';
|
|
3
|
-
import Button from '@mui/material/Button';
|
|
4
|
-
import Check from '@mui/icons-material/Check';
|
|
5
|
-
import Dialog from '@mui/material/Dialog';
|
|
6
|
-
import DialogActions from '@mui/material/DialogActions';
|
|
7
|
-
import DialogContent from '@mui/material/DialogContent';
|
|
8
|
-
import DialogTitle from '@mui/material/DialogTitle';
|
|
9
|
-
import FileCopy from '@mui/icons-material/FileCopy';
|
|
10
|
-
import IconButton from '@mui/material/IconButton';
|
|
11
|
-
import Typography from '@mui/material/Typography';
|
|
12
|
-
|
|
13
|
-
import { useStore } from './store';
|
|
14
|
-
|
|
15
|
-
interface ConfigModalProps {
|
|
16
|
-
open: boolean;
|
|
17
|
-
onClose: () => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default function ConfigModal({ open, onClose }: ConfigModalProps) {
|
|
21
|
-
const { config } = useStore();
|
|
22
|
-
const textareaRef = React.useRef<HTMLTextAreaElement>(null);
|
|
23
|
-
const [copied, setCopied] = React.useState(false);
|
|
24
|
-
const [yamlConfig, setYamlConfig] = React.useState('');
|
|
25
|
-
|
|
26
|
-
React.useEffect(() => {
|
|
27
|
-
if (open) {
|
|
28
|
-
(async () => {
|
|
29
|
-
const { default: yaml } = await import('js-yaml');
|
|
30
|
-
setYamlConfig(yaml.dump(config));
|
|
31
|
-
})();
|
|
32
|
-
}
|
|
33
|
-
}, [open, config]);
|
|
34
|
-
|
|
35
|
-
const handleCopyClick = () => {
|
|
36
|
-
if (textareaRef.current) {
|
|
37
|
-
textareaRef.current.select();
|
|
38
|
-
document.execCommand('copy');
|
|
39
|
-
setCopied(true);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const handleClose = () => {
|
|
44
|
-
setCopied(false);
|
|
45
|
-
onClose();
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Dialog
|
|
50
|
-
open={open}
|
|
51
|
-
onClose={handleClose}
|
|
52
|
-
aria-labelledby="config-dialog-title"
|
|
53
|
-
maxWidth="md"
|
|
54
|
-
fullWidth
|
|
55
|
-
>
|
|
56
|
-
<DialogTitle id="config-dialog-title">
|
|
57
|
-
<Box display="flex" justifyContent="space-between" alignItems="center">
|
|
58
|
-
<Typography variant="h6">Config</Typography>
|
|
59
|
-
<IconButton onClick={handleCopyClick}>{copied ? <Check /> : <FileCopy />}</IconButton>
|
|
60
|
-
</Box>
|
|
61
|
-
</DialogTitle>
|
|
62
|
-
<DialogContent>
|
|
63
|
-
<Typography variant="body1" component="div">
|
|
64
|
-
<textarea
|
|
65
|
-
ref={textareaRef}
|
|
66
|
-
readOnly
|
|
67
|
-
value={yamlConfig}
|
|
68
|
-
style={{
|
|
69
|
-
width: '100%',
|
|
70
|
-
minHeight: '400px',
|
|
71
|
-
fontFamily: 'monospace',
|
|
72
|
-
border: '1px solid #ccc',
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
</Typography>
|
|
76
|
-
</DialogContent>
|
|
77
|
-
<DialogActions>
|
|
78
|
-
<Button onClick={handleClose} color="primary">
|
|
79
|
-
Close
|
|
80
|
-
</Button>
|
|
81
|
-
</DialogActions>
|
|
82
|
-
</Dialog>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
|
5
|
-
import { io as SocketIOClient } from 'socket.io-client';
|
|
6
|
-
|
|
7
|
-
import ResultsView from './ResultsView';
|
|
8
|
-
import { API_BASE_URL } from '@/util/api';
|
|
9
|
-
import { useStore } from './store';
|
|
10
|
-
|
|
11
|
-
import type { EvalTable, SharedResults } from './types';
|
|
12
|
-
|
|
13
|
-
import './Eval.css';
|
|
14
|
-
|
|
15
|
-
interface EvalOptions {
|
|
16
|
-
preloadedData?: SharedResults;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default function Eval({ preloadedData }: EvalOptions) {
|
|
20
|
-
const { table, setTable, setConfig } = useStore();
|
|
21
|
-
const [loaded, setLoaded] = React.useState<boolean>(false);
|
|
22
|
-
const [recentFiles, setRecentFiles] = React.useState<string[]>([]);
|
|
23
|
-
|
|
24
|
-
const fetchRecentFiles = async () => {
|
|
25
|
-
if (!window.location.href.includes('localhost')) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const resp = await fetch(`${API_BASE_URL}/results`);
|
|
29
|
-
const body = await resp.json();
|
|
30
|
-
setRecentFiles(body.data);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const handleRecentFileSelection = async (file: string) => {
|
|
34
|
-
const resp = await fetch(`${API_BASE_URL}/results/${file}`);
|
|
35
|
-
const body = await resp.json();
|
|
36
|
-
setTable(body.data.results.table);
|
|
37
|
-
setConfig(body.data.config);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
React.useEffect(() => {
|
|
41
|
-
const socket = SocketIOClient(API_BASE_URL);
|
|
42
|
-
|
|
43
|
-
if (preloadedData) {
|
|
44
|
-
setTable(preloadedData.data.results?.table as EvalTable);
|
|
45
|
-
setConfig(preloadedData.data.config);
|
|
46
|
-
setLoaded(true);
|
|
47
|
-
} else {
|
|
48
|
-
socket.on('init', (data) => {
|
|
49
|
-
console.log('Initialized socket connection', data);
|
|
50
|
-
setLoaded(true);
|
|
51
|
-
setTable(data.results.table);
|
|
52
|
-
setConfig(data.config);
|
|
53
|
-
fetchRecentFiles();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
socket.on('update', (data) => {
|
|
57
|
-
console.log('Received data update', data);
|
|
58
|
-
setTable(data.results.table);
|
|
59
|
-
setConfig(data.config);
|
|
60
|
-
fetchRecentFiles();
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return () => {
|
|
65
|
-
socket.disconnect();
|
|
66
|
-
};
|
|
67
|
-
}, [setTable, setConfig, preloadedData]);
|
|
68
|
-
|
|
69
|
-
return loaded && table ? (
|
|
70
|
-
<ResultsView recentFiles={recentFiles} onRecentFileSelected={handleRecentFileSelection} />
|
|
71
|
-
) : (
|
|
72
|
-
<div className="loading">
|
|
73
|
-
<div>
|
|
74
|
-
<CircularProgress size={22} />
|
|
75
|
-
</div>
|
|
76
|
-
<div>Loading eval data</div>
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import Box from '@mui/material/Box';
|
|
3
|
-
import Button from '@mui/material/Button';
|
|
4
|
-
import Dialog from '@mui/material/Dialog';
|
|
5
|
-
import DialogActions from '@mui/material/DialogActions';
|
|
6
|
-
import DialogContent from '@mui/material/DialogContent';
|
|
7
|
-
import DialogTitle from '@mui/material/DialogTitle';
|
|
8
|
-
import TextareaAutosize from '@mui/material/TextareaAutosize';
|
|
9
|
-
import IconButton from '@mui/material/IconButton';
|
|
10
|
-
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
|
11
|
-
import CheckIcon from '@mui/icons-material/Check';
|
|
12
|
-
import Table from '@mui/material/Table';
|
|
13
|
-
import TableBody from '@mui/material/TableBody';
|
|
14
|
-
import TableCell from '@mui/material/TableCell';
|
|
15
|
-
import TableContainer from '@mui/material/TableContainer';
|
|
16
|
-
import TableHead from '@mui/material/TableHead';
|
|
17
|
-
import TableRow from '@mui/material/TableRow';
|
|
18
|
-
import Typography from '@mui/material/Typography';
|
|
19
|
-
|
|
20
|
-
import type { GradingResult } from './types';
|
|
21
|
-
|
|
22
|
-
interface EvalOutputPromptDialogProps {
|
|
23
|
-
open: boolean;
|
|
24
|
-
onClose: () => void;
|
|
25
|
-
prompt: string;
|
|
26
|
-
output?: string;
|
|
27
|
-
gradingResults?: GradingResult[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function AssertionResults({ gradingResults }: { gradingResults?: GradingResult[] }) {
|
|
31
|
-
if (!gradingResults) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<Box mt={2}>
|
|
37
|
-
<Typography variant="subtitle1">Assertions</Typography>
|
|
38
|
-
<TableContainer>
|
|
39
|
-
<Table>
|
|
40
|
-
<TableHead>
|
|
41
|
-
<TableRow>
|
|
42
|
-
<TableCell style={{ fontWeight: 'bold' }}>Pass</TableCell>
|
|
43
|
-
<TableCell style={{ fontWeight: 'bold' }}>Score</TableCell>
|
|
44
|
-
<TableCell style={{ fontWeight: 'bold' }}>Type</TableCell>
|
|
45
|
-
<TableCell style={{ fontWeight: 'bold' }}>Value</TableCell>
|
|
46
|
-
<TableCell style={{ fontWeight: 'bold' }}>Reason</TableCell>
|
|
47
|
-
</TableRow>
|
|
48
|
-
</TableHead>
|
|
49
|
-
<TableBody>
|
|
50
|
-
{gradingResults.map((result, i) => (
|
|
51
|
-
<TableRow key={i}>
|
|
52
|
-
<TableCell>{result.pass ? '✅' : '❌'}</TableCell>
|
|
53
|
-
<TableCell>{result.score}</TableCell>
|
|
54
|
-
<TableCell>{result.assertion?.type || ''}</TableCell>
|
|
55
|
-
<TableCell>
|
|
56
|
-
{result.assertion?.value ? String(result.assertion.value) : '-'}
|
|
57
|
-
</TableCell>
|
|
58
|
-
<TableCell>{result.reason}</TableCell>
|
|
59
|
-
</TableRow>
|
|
60
|
-
))}
|
|
61
|
-
</TableBody>
|
|
62
|
-
</Table>
|
|
63
|
-
</TableContainer>
|
|
64
|
-
</Box>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default function EvalOutputPromptDialog({
|
|
69
|
-
open,
|
|
70
|
-
onClose,
|
|
71
|
-
prompt,
|
|
72
|
-
output,
|
|
73
|
-
gradingResults,
|
|
74
|
-
}: EvalOutputPromptDialogProps) {
|
|
75
|
-
const [copied, setCopied] = useState(false);
|
|
76
|
-
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
setCopied(false);
|
|
79
|
-
}, [prompt]);
|
|
80
|
-
|
|
81
|
-
const copyToClipboard = async (text: string) => {
|
|
82
|
-
await navigator.clipboard.writeText(text);
|
|
83
|
-
setCopied(true);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<Dialog open={open} onClose={onClose} fullWidth maxWidth="lg">
|
|
88
|
-
<DialogTitle>Details</DialogTitle>
|
|
89
|
-
<DialogContent>
|
|
90
|
-
<Box mb={2}>
|
|
91
|
-
<Typography variant="subtitle1" style={{ marginBottom: '1rem' }}>
|
|
92
|
-
Prompt
|
|
93
|
-
</Typography>
|
|
94
|
-
<TextareaAutosize
|
|
95
|
-
readOnly
|
|
96
|
-
value={prompt}
|
|
97
|
-
style={{ width: '100%', padding: '0.75rem' }}
|
|
98
|
-
maxRows={20}
|
|
99
|
-
/>
|
|
100
|
-
<IconButton
|
|
101
|
-
onClick={() => copyToClipboard(prompt)}
|
|
102
|
-
style={{ position: 'absolute', right: '10px', top: '10px' }}
|
|
103
|
-
>
|
|
104
|
-
{copied ? <CheckIcon /> : <ContentCopyIcon />}
|
|
105
|
-
</IconButton>
|
|
106
|
-
</Box>
|
|
107
|
-
{output && (
|
|
108
|
-
<Box my={2}>
|
|
109
|
-
<Typography variant="subtitle1" style={{ marginBottom: '1rem', marginTop: '1rem' }}>
|
|
110
|
-
Output
|
|
111
|
-
</Typography>
|
|
112
|
-
<TextareaAutosize
|
|
113
|
-
readOnly
|
|
114
|
-
maxRows={20}
|
|
115
|
-
value={output}
|
|
116
|
-
style={{ width: '100%', padding: '0.75rem' }}
|
|
117
|
-
/>
|
|
118
|
-
</Box>
|
|
119
|
-
)}
|
|
120
|
-
<AssertionResults gradingResults={gradingResults} />
|
|
121
|
-
</DialogContent>
|
|
122
|
-
<DialogActions>
|
|
123
|
-
<Button onClick={onClose}>Close</Button>
|
|
124
|
-
</DialogActions>
|
|
125
|
-
</Dialog>
|
|
126
|
-
);
|
|
127
|
-
}
|