promptfoo 0.17.8 → 0.17.9
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 +2 -0
- package/dist/package.json +1 -1
- package/dist/src/evaluator.d.ts.map +1 -1
- package/dist/src/evaluator.js +8 -0
- package/dist/src/evaluator.js.map +1 -1
- package/dist/src/types.d.ts +5 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/util.d.ts +3 -2
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +65 -16
- package/dist/src/util.js.map +1 -1
- package/dist/src/web/client/assets/{index-0c6f887d.js → index-8388d689.js} +1 -1
- package/dist/src/web/client/assets/{index-f9b230d1.css → index-d2b6a160.css} +1 -1
- package/dist/src/web/client/index.html +2 -2
- package/package.json +1 -1
- package/src/evaluator.ts +9 -0
- package/src/types.ts +7 -1
- package/src/util.ts +70 -15
- package/src/web/client/package-lock.json +5726 -0
- package/src/web/client/src/ResultsTable.css +11 -1
- package/src/web/client/src/ResultsTable.tsx +10 -0
- package/src/web/client/src/ResultsView.tsx +7 -1
- package/src/web/client/src/types.ts +4 -0
|
@@ -83,7 +83,17 @@ tr .cell-actions {
|
|
|
83
83
|
font-size: 1.75rem;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
tr
|
|
86
|
+
tr .cell-detail {
|
|
87
|
+
visibility: hidden;
|
|
88
|
+
position: absolute;
|
|
89
|
+
bottom: 0.25rem;
|
|
90
|
+
margin-top: 1rem;
|
|
91
|
+
font-size: 0.75rem;
|
|
92
|
+
color: #888;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
tr:hover .cell-actions,
|
|
96
|
+
tr:hover .cell-detail {
|
|
87
97
|
visibility: visible;
|
|
88
98
|
}
|
|
89
99
|
|
|
@@ -135,6 +135,16 @@ function EvalOutputCell({
|
|
|
135
135
|
)}{' '}
|
|
136
136
|
<TruncatedText text={text} maxLength={maxTextLength} />
|
|
137
137
|
</div>
|
|
138
|
+
<div className="cell-detail">
|
|
139
|
+
{output.tokenUsage?.cached ? (
|
|
140
|
+
<span>{output.tokenUsage.cached} tokens (cached)</span>
|
|
141
|
+
) : (
|
|
142
|
+
<>
|
|
143
|
+
{output.tokenUsage?.total && <span>{output.tokenUsage.total} tokens</span>} |{' '}
|
|
144
|
+
<span>{output.latencyMs} ms</span>
|
|
145
|
+
</>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|
|
138
148
|
<div className="cell-actions">
|
|
139
149
|
{output.prompt && (
|
|
140
150
|
<>
|
|
@@ -39,7 +39,13 @@ const ResponsiveStack = styled(Stack)(({ theme }) => ({
|
|
|
39
39
|
|
|
40
40
|
function filenameToDate(filename: string) {
|
|
41
41
|
const dateString = filename.slice('eval-'.length, filename.length - '.json'.length);
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
// Replace hyphens with colons where necessary (Windows compatibility).
|
|
44
|
+
const dateParts = dateString.split('T');
|
|
45
|
+
const timePart = dateParts[1].replace(/-/g, ':');
|
|
46
|
+
const formattedDateString = `${dateParts[0]}T${timePart}`;
|
|
47
|
+
|
|
48
|
+
const date = new Date(formattedDateString);
|
|
43
49
|
return date.toLocaleDateString('en-US', {
|
|
44
50
|
year: 'numeric',
|
|
45
51
|
month: 'long',
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TokenUsage } from '../../../types';
|
|
2
|
+
|
|
1
3
|
type Prompt = {
|
|
2
4
|
display: string;
|
|
3
5
|
raw: string;
|
|
@@ -13,6 +15,8 @@ export type EvalRowOutput = {
|
|
|
13
15
|
score: number;
|
|
14
16
|
text: string | object;
|
|
15
17
|
prompt: string;
|
|
18
|
+
latencyMs: number;
|
|
19
|
+
tokenUsage?: Partial<TokenUsage>;
|
|
16
20
|
};
|
|
17
21
|
|
|
18
22
|
export type EvalRow = {
|