promptfoo 0.18.4 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +10 -5
- package/dist/src/evaluator.d.ts.map +1 -1
- package/dist/src/evaluator.js +17 -9
- package/dist/src/evaluator.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/main.js +2 -2
- package/dist/src/main.js.map +1 -1
- package/dist/src/providers.d.ts +1 -1
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +5 -0
- package/dist/src/providers.js.map +1 -1
- package/dist/src/share.d.ts.map +1 -1
- package/dist/src/share.js +8 -7
- package/dist/src/share.js.map +1 -1
- package/dist/src/types.d.ts +9 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/web/nextui/404/index.html +1 -0
- package/dist/src/web/nextui/404.html +1 -0
- package/dist/src/web/nextui/_next/static/P9zzdx-rDJKPcGFq_qOXC/_buildManifest.js +1 -0
- package/dist/src/web/nextui/_next/static/P9zzdx-rDJKPcGFq_qOXC/_ssgManifest.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/121-54cee610700b4756.js +27 -0
- package/dist/src/web/nextui/_next/static/chunks/339-501c32916b785ef1.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/373-6a411db0b05027d3.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/583-507e6d8883bb85ff.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/596-9c29c47b8dee7a50.js +25 -0
- package/dist/src/web/nextui/_next/static/chunks/658-f8f9d18540505edc.js +15 -0
- package/dist/src/web/nextui/_next/static/chunks/858-7255df6dbc44dff9.js +125 -0
- package/dist/src/web/nextui/_next/static/chunks/97-64e11ce2b0607459.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-655bc42ac68b25cc.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/eval/page-d5e8697859d6294e.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/layout-4c714b1a5a3a768d.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/page-4fe8a6342d24ca23.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/app/setup/page-cd35686fe6c12be8.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/fd9d1056-d8847af536b5787b.js +9 -0
- package/dist/src/web/nextui/_next/static/chunks/framework-8883d1e9be70c3da.js +25 -0
- package/dist/src/web/nextui/_next/static/chunks/main-0670de04b1c026b4.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/polyfills-78c92fac7aa8fdd8.js +1 -0
- package/dist/src/web/nextui/_next/static/chunks/webpack-a886dd767c2e76b7.js +1 -0
- package/dist/src/web/nextui/_next/static/css/48d388184a2f4ce3.css +1 -0
- package/dist/src/web/nextui/_next/static/css/7265c36d84346934.css +1 -0
- package/dist/src/web/nextui/_next/static/css/8119d8bd13a8adab.css +1 -0
- package/dist/src/web/nextui/_next/static/css/a35c840ac696f161.css +1 -0
- package/dist/src/web/nextui/_next/static/css/e388dd377baf25ec.css +1 -0
- package/dist/src/web/nextui/_next/static/css/fc460b8a7cadb952.css +1 -0
- package/dist/src/web/nextui/_next/static/media/0e4fe491bf84089c-s.p.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/1c57ca6f5208a29b-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/3dbd163d3bb09d47-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/42d52f46a26971a3-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/5647e4c23315a2d2-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/627622453ef56b0d-s.p.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/7be645d133f3ee22-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/7c53f7419436e04b-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/8fb72f69fba4e3d2-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/912a9cfe43c928d9-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/934c4b7cb736f2a3-s.p.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/a5b77b63ef20339c-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/a6d330d7873e7320-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/baf12dd90520ae41-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/bbdb6f0234009aba-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/cff529cd86cc0276-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/d117eea74e01de14-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/dfa8b99978df7bbc-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/e25729ca87cc7df9-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/eb52b768f62eeeb4-s.woff2 +0 -0
- package/dist/src/web/nextui/_next/static/media/f06116e890b3dadb-s.woff2 +0 -0
- package/dist/src/web/nextui/api +1 -0
- package/dist/src/web/nextui/eval/index.html +1 -0
- package/dist/src/web/nextui/eval/index.txt +13 -0
- package/dist/src/web/nextui/index.html +1 -0
- package/dist/src/web/nextui/index.txt +13 -0
- package/dist/src/web/nextui/setup/index.html +1 -0
- package/dist/src/web/nextui/setup/index.txt +14 -0
- package/dist/src/web/server.d.ts +1 -1
- package/dist/src/web/server.d.ts.map +1 -1
- package/dist/src/web/server.js +47 -4
- package/dist/src/web/server.js.map +1 -1
- package/package.json +10 -5
- package/src/evaluator.ts +17 -9
- package/src/index.ts +7 -1
- package/src/main.ts +3 -3
- package/src/providers.ts +11 -2
- package/src/share.ts +10 -8
- package/src/types.ts +10 -1
- package/src/web/nextui/.eslintrc.json +3 -0
- package/src/web/nextui/next.config.js +14 -0
- package/src/web/nextui/package-lock.json +4615 -0
- package/src/web/nextui/package.json +45 -0
- package/src/web/nextui/src/app/Home.css +3 -0
- package/src/web/nextui/src/app/api/route.ts +6 -0
- package/src/web/{client/src/NavBar.css → nextui/src/app/components/DarkMode.css} +1 -0
- package/src/web/{client/src/NavBar.tsx → nextui/src/app/components/DarkMode.tsx} +4 -9
- package/src/web/nextui/src/app/components/Logo.css +32 -0
- package/src/web/nextui/src/app/components/PageShell.css +33 -0
- package/src/web/nextui/src/app/components/PageShell.tsx +87 -0
- package/src/web/{client/src → nextui/src/app/eval}/ConfigModal.tsx +8 -5
- package/src/web/nextui/src/app/eval/Eval.css +13 -0
- package/src/web/nextui/src/app/eval/Eval.tsx +79 -0
- package/src/web/{client/src → nextui/src/app/eval}/EvalOutputPromptDialog.tsx +2 -2
- package/src/web/{client/src → nextui/src/app/eval}/ResultsTable.css +10 -12
- package/src/web/{client/src → nextui/src/app/eval}/ResultsTable.tsx +57 -14
- package/src/web/{client/src → nextui/src/app/eval}/ResultsView.tsx +4 -4
- package/src/web/nextui/src/app/eval/[id]/not-found.tsx +5 -0
- package/src/web/nextui/src/app/eval/[id]/page.css +9 -0
- package/src/web/nextui/src/app/eval/[id]/page.tsx +20 -0
- package/src/web/nextui/src/app/eval/index.css +0 -0
- package/src/web/nextui/src/app/eval/page.tsx +8 -0
- package/src/web/{client/src → nextui/src/app/eval}/store.ts +2 -2
- package/src/web/nextui/src/app/eval/types.ts +20 -0
- package/src/web/{client/src/index.css → nextui/src/app/globals.css} +21 -3
- package/src/web/nextui/src/app/layout.tsx +25 -0
- package/src/web/nextui/src/app/page.tsx +7 -0
- package/src/web/nextui/src/app/setup/AssertsForm.tsx +118 -0
- package/src/web/nextui/src/app/setup/PromptDialog.tsx +77 -0
- package/src/web/nextui/src/app/setup/PromptsSection.tsx +190 -0
- package/src/web/nextui/src/app/setup/ProviderConfigDialog.tsx +99 -0
- package/src/web/nextui/src/app/setup/ProviderSelector.tsx +149 -0
- package/src/web/nextui/src/app/setup/RunTestSuiteButton.tsx +88 -0
- package/src/web/nextui/src/app/setup/TestCaseDialog.tsx +108 -0
- package/src/web/nextui/src/app/setup/TestCasesSection.tsx +154 -0
- package/src/web/nextui/src/app/setup/VarsForm.tsx +57 -0
- package/src/web/nextui/src/app/setup/page.css +3 -0
- package/src/web/nextui/src/app/setup/page.tsx +160 -0
- package/src/web/nextui/src/util/api.ts +1 -0
- package/src/web/nextui/src/util/store.ts +53 -0
- package/src/web/nextui/tsconfig.json +28 -0
- package/src/web/server.ts +56 -2
- package/dist/src/web/client/assets/index-6d2a3573.js +0 -200
- package/dist/src/web/client/assets/index-d2b6a160.css +0 -1
- package/dist/src/web/client/assets/js-yaml-8bbf9398.js +0 -32
- package/dist/src/web/client/index.html +0 -15
- package/src/web/client/.eslintrc.cjs +0 -14
- package/src/web/client/index.html +0 -13
- package/src/web/client/package-lock.json +0 -5726
- package/src/web/client/package.json +0 -39
- package/src/web/client/src/App.css +0 -4
- package/src/web/client/src/App.tsx +0 -120
- package/src/web/client/src/Logo.css +0 -18
- package/src/web/client/src/main.tsx +0 -10
- package/src/web/client/src/types.ts +0 -36
- package/src/web/client/src/vite-env.d.ts +0 -1
- package/src/web/client/tsconfig.json +0 -24
- package/src/web/client/tsconfig.node.json +0 -10
- package/src/web/client/vite.config.ts +0 -7
- /package/dist/src/web/{client → nextui}/favicon.ico +0 -0
- /package/dist/src/web/{client → nextui}/logo.svg +0 -0
- /package/src/web/{client → nextui}/public/favicon.ico +0 -0
- /package/src/web/{client → nextui}/public/logo.svg +0 -0
- /package/src/web/{client/src → nextui/src/app/components}/Logo.tsx +0 -0
- /package/src/web/{client/src → nextui/src/app/eval}/ShareModal.tsx +0 -0
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "promptfoo-client",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "tsc && vite build",
|
|
9
|
-
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
-
"preview": "vite preview"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@emotion/react": "^11.11.0",
|
|
14
|
-
"@emotion/styled": "^11.11.0",
|
|
15
|
-
"@mui/icons-material": "^5.11.16",
|
|
16
|
-
"@mui/material": "^5.13.0",
|
|
17
|
-
"@tanstack/react-table": "^8.9.1",
|
|
18
|
-
"js-yaml": "^4.1.0",
|
|
19
|
-
"react": "^18.2.0",
|
|
20
|
-
"react-dnd": "^16.0.1",
|
|
21
|
-
"react-dnd-html5-backend": "^16.0.1",
|
|
22
|
-
"react-dom": "^18.2.0",
|
|
23
|
-
"socket.io-client": "^4.6.1",
|
|
24
|
-
"tiny-invariant": "^1.3.1",
|
|
25
|
-
"zustand": "^4.3.8"
|
|
26
|
-
},
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@types/react": "^18.0.28",
|
|
29
|
-
"@types/react-dom": "^18.0.11",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
31
|
-
"@typescript-eslint/parser": "^5.57.1",
|
|
32
|
-
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
33
|
-
"eslint": "^8.38.0",
|
|
34
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
35
|
-
"eslint-plugin-react-refresh": "^0.3.4",
|
|
36
|
-
"typescript": "^5.0.2",
|
|
37
|
-
"vite": "^4.3.2"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
4
|
-
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|
5
|
-
import { io as SocketIOClient } from 'socket.io-client';
|
|
6
|
-
|
|
7
|
-
import ResultsView from './ResultsView.js';
|
|
8
|
-
import NavBar from './NavBar.js';
|
|
9
|
-
import { useStore } from './store.js';
|
|
10
|
-
|
|
11
|
-
import './App.css';
|
|
12
|
-
|
|
13
|
-
function App() {
|
|
14
|
-
const { table, setTable, setConfig } = useStore();
|
|
15
|
-
const [loaded, setLoaded] = React.useState<boolean>(false);
|
|
16
|
-
const loadedFromApi = React.useRef(false);
|
|
17
|
-
const [recentFiles, setRecentFiles] = React.useState<string[]>([]);
|
|
18
|
-
|
|
19
|
-
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
|
|
20
|
-
const [darkMode, setDarkMode] = React.useState(prefersDarkMode);
|
|
21
|
-
|
|
22
|
-
const theme = React.useMemo(
|
|
23
|
-
() =>
|
|
24
|
-
createTheme({
|
|
25
|
-
palette: {
|
|
26
|
-
mode: darkMode ? 'dark' : 'light',
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
[darkMode],
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const toggleDarkMode = () => {
|
|
33
|
-
setDarkMode(!darkMode);
|
|
34
|
-
if (!darkMode) {
|
|
35
|
-
document.documentElement.setAttribute('data-theme', 'dark');
|
|
36
|
-
} else {
|
|
37
|
-
document.documentElement.removeAttribute('data-theme');
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
React.useEffect(() => {
|
|
42
|
-
if (prefersDarkMode) {
|
|
43
|
-
document.documentElement.setAttribute('data-theme', 'dark');
|
|
44
|
-
}
|
|
45
|
-
}, [prefersDarkMode]);
|
|
46
|
-
|
|
47
|
-
const fetchRecentFiles = async () => {
|
|
48
|
-
if (!window.location.href.includes('localhost')) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const resp = await fetch(`http://localhost:15500/results`);
|
|
52
|
-
const body = await resp.json();
|
|
53
|
-
setRecentFiles(body.data);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const handleRecentFileSelection = async (file: string) => {
|
|
57
|
-
const resp = await fetch(`http://localhost:15500/results/${file}`);
|
|
58
|
-
const body = await resp.json();
|
|
59
|
-
setTable(body.data.results.table);
|
|
60
|
-
setConfig(body.data.config);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
React.useEffect(() => {
|
|
64
|
-
const fetchEvalData = async (id: string) => {
|
|
65
|
-
if (loadedFromApi.current) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
loadedFromApi.current = true;
|
|
69
|
-
const response = await fetch(`https://api.promptfoo.dev/eval/${id}`);
|
|
70
|
-
const body = await response.json();
|
|
71
|
-
setTable(
|
|
72
|
-
body.data.results?.table ||
|
|
73
|
-
// Backwards compatibility with <= 0.12.0
|
|
74
|
-
body.data.table,
|
|
75
|
-
);
|
|
76
|
-
setConfig(body.data.config);
|
|
77
|
-
setLoaded(true);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const socket = SocketIOClient(`http://localhost:15500`);
|
|
81
|
-
|
|
82
|
-
const pathMatch = window.location.pathname.match(/\/eval\/([\w:-]+)/);
|
|
83
|
-
if (pathMatch) {
|
|
84
|
-
const id = pathMatch[1];
|
|
85
|
-
fetchEvalData(id);
|
|
86
|
-
} else {
|
|
87
|
-
socket.on('init', (data) => {
|
|
88
|
-
console.log('Initialized socket connection', data);
|
|
89
|
-
setLoaded(true);
|
|
90
|
-
setTable(data.results.table);
|
|
91
|
-
setConfig(data.config);
|
|
92
|
-
fetchRecentFiles();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
socket.on('update', (data) => {
|
|
96
|
-
console.log('Received data update', data);
|
|
97
|
-
setTable(data.results.table);
|
|
98
|
-
setConfig(data.config);
|
|
99
|
-
fetchRecentFiles();
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return () => {
|
|
104
|
-
socket.disconnect();
|
|
105
|
-
};
|
|
106
|
-
}, [setTable, setConfig]);
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<ThemeProvider theme={theme}>
|
|
110
|
-
<NavBar darkMode={darkMode} onToggleDarkMode={toggleDarkMode} />
|
|
111
|
-
{loaded && table ? (
|
|
112
|
-
<ResultsView recentFiles={recentFiles} onRecentFileSelected={handleRecentFileSelection} />
|
|
113
|
-
) : (
|
|
114
|
-
<div>Loading...</div>
|
|
115
|
-
)}
|
|
116
|
-
</ThemeProvider>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export default App;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom/client';
|
|
3
|
-
import App from './App.tsx';
|
|
4
|
-
import './index.css';
|
|
5
|
-
|
|
6
|
-
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
|
7
|
-
<React.StrictMode>
|
|
8
|
-
<App />
|
|
9
|
-
</React.StrictMode>,
|
|
10
|
-
);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { EvaluateResult, TokenUsage } from '../../../types';
|
|
2
|
-
|
|
3
|
-
type Prompt = {
|
|
4
|
-
display: string;
|
|
5
|
-
raw: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type EvalHead = {
|
|
9
|
-
prompts: Prompt[];
|
|
10
|
-
vars: string[];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// TODO(ian): Remove this and replace with EvaluateResult
|
|
14
|
-
export type EvalRowOutput = {
|
|
15
|
-
pass: boolean;
|
|
16
|
-
score: number;
|
|
17
|
-
text: string | object;
|
|
18
|
-
prompt: string;
|
|
19
|
-
latencyMs: number;
|
|
20
|
-
tokenUsage?: Partial<TokenUsage>;
|
|
21
|
-
gradingResult: EvaluateResult['gradingResult'];
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type EvalRow = {
|
|
25
|
-
outputs: EvalRowOutput[];
|
|
26
|
-
vars: string[]; // model outputs
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type EvalTable = {
|
|
30
|
-
head: EvalHead;
|
|
31
|
-
body: EvalRow[];
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type FilterMode = 'all' | 'failures' | 'different';
|
|
35
|
-
|
|
36
|
-
export type { UnifiedConfig } from '../../../types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
|
|
8
|
-
/* Bundler mode */
|
|
9
|
-
"moduleResolution": "bundler",
|
|
10
|
-
"allowImportingTsExtensions": true,
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"isolatedModules": true,
|
|
13
|
-
"noEmit": true,
|
|
14
|
-
"jsx": "react-jsx",
|
|
15
|
-
|
|
16
|
-
/* Linting */
|
|
17
|
-
"strict": true,
|
|
18
|
-
"noUnusedLocals": true,
|
|
19
|
-
"noUnusedParameters": true,
|
|
20
|
-
"noFallthroughCasesInSwitch": true
|
|
21
|
-
},
|
|
22
|
-
"include": ["src"],
|
|
23
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
24
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|