@trazum/core 1.10.0 → 1.25.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/against.d.ts +32 -0
- package/dist/against.d.ts.map +1 -0
- package/dist/against.js +34 -0
- package/dist/against.js.map +1 -0
- package/dist/config-schema.d.ts +42 -1
- package/dist/config-schema.d.ts.map +1 -1
- package/dist/config-schema.js +61 -0
- package/dist/config-schema.js.map +1 -1
- package/dist/conversation.d.ts +121 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +157 -0
- package/dist/conversation.js.map +1 -0
- package/dist/csv.d.ts +61 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +149 -0
- package/dist/csv.js.map +1 -0
- package/dist/evaluate.d.ts +24 -0
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +5 -2
- package/dist/evaluate.js.map +1 -1
- package/dist/index.d.ts +25 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/input-shape.d.ts +104 -0
- package/dist/input-shape.d.ts.map +1 -0
- package/dist/input-shape.js +132 -0
- package/dist/input-shape.js.map +1 -0
- package/dist/levers.d.ts +151 -0
- package/dist/levers.d.ts.map +1 -0
- package/dist/levers.js +160 -0
- package/dist/levers.js.map +1 -0
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/output-shape.d.ts +96 -0
- package/dist/output-shape.d.ts.map +1 -0
- package/dist/output-shape.js +145 -0
- package/dist/output-shape.js.map +1 -0
- package/dist/pricing-overlay.d.ts +1 -1
- package/dist/pricing-overlay.d.ts.map +1 -1
- package/dist/pricing-overlay.js +46 -0
- package/dist/pricing-overlay.js.map +1 -1
- package/dist/repeats.d.ts +75 -0
- package/dist/repeats.d.ts.map +1 -0
- package/dist/repeats.js +82 -0
- package/dist/repeats.js.map +1 -0
- package/dist/reprice.d.ts +143 -0
- package/dist/reprice.d.ts.map +1 -0
- package/dist/reprice.js +82 -0
- package/dist/reprice.js.map +1 -0
- package/dist/session-cost.d.ts +70 -0
- package/dist/session-cost.d.ts.map +1 -0
- package/dist/session-cost.js +90 -0
- package/dist/session-cost.js.map +1 -0
- package/dist/session-ledger.d.ts +77 -0
- package/dist/session-ledger.d.ts.map +1 -0
- package/dist/session-ledger.js +99 -0
- package/dist/session-ledger.js.map +1 -0
- package/dist/ttl-fit.d.ts +103 -0
- package/dist/ttl-fit.d.ts.map +1 -0
- package/dist/ttl-fit.js +184 -0
- package/dist/ttl-fit.js.map +1 -0
- package/dist/usage.d.ts +434 -16
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +383 -23
- package/dist/usage.js.map +1 -1
- package/package.json +1 -1
- package/src/against.ts +48 -0
- package/src/config-schema.ts +106 -0
- package/src/conversation.ts +305 -0
- package/src/csv.ts +184 -0
- package/src/evaluate.ts +33 -3
- package/src/index.ts +51 -1
- package/src/input-shape.ts +259 -0
- package/src/levers.ts +331 -0
- package/src/node.ts +1 -1
- package/src/output-shape.ts +254 -0
- package/src/pricing-overlay.ts +52 -1
- package/src/repeats.ts +166 -0
- package/src/reprice.ts +227 -0
- package/src/session-cost.ts +170 -0
- package/src/session-ledger.ts +189 -0
- package/src/ttl-fit.ts +251 -0
- package/src/usage.ts +795 -7
package/dist/csv.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { UsageProfileReport } from './usage.js';
|
|
2
|
+
/**
|
|
3
|
+
* The profile as a spreadsheet.
|
|
4
|
+
*
|
|
5
|
+
* ## Why a file format is a feature
|
|
6
|
+
*
|
|
7
|
+
* The terminal report is read once and closed. The people who decide what a
|
|
8
|
+
* workload is allowed to cost live in spreadsheets, and handing them a
|
|
9
|
+
* screenshot of a terminal is how a finding stops at the person who ran the
|
|
10
|
+
* command. `--json` is for machines; this is for the pivot table that gets
|
|
11
|
+
* shown to whoever signs off the bill.
|
|
12
|
+
*
|
|
13
|
+
* ## One row per label and model, and no total row
|
|
14
|
+
*
|
|
15
|
+
* `byLabelAndModel` is the grouping a decision is actually made at — routing
|
|
16
|
+
* `classify` to a cheaper model is a question about one label's calls to one
|
|
17
|
+
* model — so it is the grain of the file.
|
|
18
|
+
*
|
|
19
|
+
* **There is deliberately no TOTAL row.** A total inside a data file is the
|
|
20
|
+
* oldest spreadsheet trap there is: somebody sums the column, the total row is
|
|
21
|
+
* included, and every figure downstream is exactly twice what it should be.
|
|
22
|
+
* The sum of this file is the bill, and a spreadsheet can compute it.
|
|
23
|
+
*
|
|
24
|
+
* ## Unpriced models get empty cells, never zeros
|
|
25
|
+
*
|
|
26
|
+
* A model the catalogue does not know has real tokens and unknown dollars.
|
|
27
|
+
* Writing `0` there would be a claim — that those calls were free — and it
|
|
28
|
+
* would survive into every chart built on the file. An empty cell is the
|
|
29
|
+
* absence it actually is, and spreadsheets already know how to skip one.
|
|
30
|
+
*/
|
|
31
|
+
/** Columns, in order. Exported so a test can pin the header rather than a string. */
|
|
32
|
+
export declare const PROFILE_CSV_COLUMNS: readonly ['label', 'model', 'calls', 'input_tokens', 'cache_read_tokens', 'cache_write_tokens', 'output_tokens', 'input_usd', 'cache_read_usd', 'cache_write_usd', 'output_usd', 'total_usd'];
|
|
33
|
+
export interface ProfileCsvOptions {
|
|
34
|
+
/** What to call the bucket for calls carrying no label. */
|
|
35
|
+
unlabelled: string;
|
|
36
|
+
/**
|
|
37
|
+
* Which table to write.
|
|
38
|
+
*
|
|
39
|
+
* `slice` is one row per label and model — the grain a routing or budget
|
|
40
|
+
* decision is made at. `day` and `hour` are the time series, which is what
|
|
41
|
+
* a spreadsheet gets asked to chart; keeping them behind a choice rather
|
|
42
|
+
* than in extra columns means every file has one row shape, and a
|
|
43
|
+
* spreadsheet that has to filter before it can sum is a spreadsheet
|
|
44
|
+
* somebody sums wrong.
|
|
45
|
+
*/
|
|
46
|
+
shape?: ProfileCsvShape;
|
|
47
|
+
}
|
|
48
|
+
export type ProfileCsvShape = 'slice' | 'day' | 'hour';
|
|
49
|
+
/** Columns for the per-day series. */
|
|
50
|
+
export declare const PROFILE_CSV_DAY_COLUMNS: readonly ['day', 'usd', 'calls', 'top_label', 'top_label_usd'];
|
|
51
|
+
/** Columns for the per-hour-of-UTC-day series. */
|
|
52
|
+
export declare const PROFILE_CSV_HOUR_COLUMNS: readonly ['hour_utc', 'usd', 'calls'];
|
|
53
|
+
/**
|
|
54
|
+
* The report as CSV text, one row per label and model.
|
|
55
|
+
*
|
|
56
|
+
* Rows arrive in the report's own order — largest bill first — because a
|
|
57
|
+
* spreadsheet can re-sort and a reader opening the file should see the
|
|
58
|
+
* expensive workload at the top either way.
|
|
59
|
+
*/
|
|
60
|
+
export declare function profileToCsv(report: UsageProfileReport, options: ProfileCsvOptions): string;
|
|
61
|
+
//# sourceMappingURL=csv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../src/csv.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,YAC9B,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,WAAW,CACH,CAAC;AAwBX,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvD,sCAAsC;AACtC,eAAO,MAAM,uBAAuB,YAAI,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,CAAU,CAAC;AAEtG,kDAAkD;AAClD,eAAO,MAAM,wBAAwB,YAAI,UAAU,EAAE,KAAK,EAAE,OAAO,CAAU,CAAC;AAE9E;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAiF3F"}
|
package/dist/csv.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { UNLABELLED } from './usage.js';
|
|
2
|
+
/**
|
|
3
|
+
* The profile as a spreadsheet.
|
|
4
|
+
*
|
|
5
|
+
* ## Why a file format is a feature
|
|
6
|
+
*
|
|
7
|
+
* The terminal report is read once and closed. The people who decide what a
|
|
8
|
+
* workload is allowed to cost live in spreadsheets, and handing them a
|
|
9
|
+
* screenshot of a terminal is how a finding stops at the person who ran the
|
|
10
|
+
* command. `--json` is for machines; this is for the pivot table that gets
|
|
11
|
+
* shown to whoever signs off the bill.
|
|
12
|
+
*
|
|
13
|
+
* ## One row per label and model, and no total row
|
|
14
|
+
*
|
|
15
|
+
* `byLabelAndModel` is the grouping a decision is actually made at — routing
|
|
16
|
+
* `classify` to a cheaper model is a question about one label's calls to one
|
|
17
|
+
* model — so it is the grain of the file.
|
|
18
|
+
*
|
|
19
|
+
* **There is deliberately no TOTAL row.** A total inside a data file is the
|
|
20
|
+
* oldest spreadsheet trap there is: somebody sums the column, the total row is
|
|
21
|
+
* included, and every figure downstream is exactly twice what it should be.
|
|
22
|
+
* The sum of this file is the bill, and a spreadsheet can compute it.
|
|
23
|
+
*
|
|
24
|
+
* ## Unpriced models get empty cells, never zeros
|
|
25
|
+
*
|
|
26
|
+
* A model the catalogue does not know has real tokens and unknown dollars.
|
|
27
|
+
* Writing `0` there would be a claim — that those calls were free — and it
|
|
28
|
+
* would survive into every chart built on the file. An empty cell is the
|
|
29
|
+
* absence it actually is, and spreadsheets already know how to skip one.
|
|
30
|
+
*/
|
|
31
|
+
/** Columns, in order. Exported so a test can pin the header rather than a string. */
|
|
32
|
+
export const PROFILE_CSV_COLUMNS = [
|
|
33
|
+
'label',
|
|
34
|
+
'model',
|
|
35
|
+
'calls',
|
|
36
|
+
'input_tokens',
|
|
37
|
+
'cache_read_tokens',
|
|
38
|
+
'cache_write_tokens',
|
|
39
|
+
'output_tokens',
|
|
40
|
+
'input_usd',
|
|
41
|
+
'cache_read_usd',
|
|
42
|
+
'cache_write_usd',
|
|
43
|
+
'output_usd',
|
|
44
|
+
'total_usd',
|
|
45
|
+
];
|
|
46
|
+
/**
|
|
47
|
+
* One CSV field, RFC 4180.
|
|
48
|
+
*
|
|
49
|
+
* Labels are arbitrary strings out of somebody's log: a label containing a
|
|
50
|
+
* comma would shift every column after it, and one containing a quote would
|
|
51
|
+
* break the row it sits in. Both are quoted here rather than sanitised,
|
|
52
|
+
* because changing the label would make the file disagree with every other
|
|
53
|
+
* rendering about what the workload is called.
|
|
54
|
+
*
|
|
55
|
+
* A leading `=`, `+`, `-` or `@` is prefixed with an apostrophe: those are
|
|
56
|
+
* how a spreadsheet is told a cell is a formula, and a label out of a log is
|
|
57
|
+
* data. This is the one place a value is altered, and it is altered to stop
|
|
58
|
+
* a log from executing anything when the file is opened.
|
|
59
|
+
*/
|
|
60
|
+
function field(value) {
|
|
61
|
+
const guarded = /^[=+\-@\t\r]/.test(value) ? `'${value}` : value;
|
|
62
|
+
return /[",\n\r]/.test(guarded) ? `"${guarded.replace(/"/g, '""')}"` : guarded;
|
|
63
|
+
}
|
|
64
|
+
/** A dollar figure with enough places to survive being summed. */
|
|
65
|
+
const usd = (value) => value.toFixed(6);
|
|
66
|
+
/** Columns for the per-day series. */
|
|
67
|
+
export const PROFILE_CSV_DAY_COLUMNS = ['day', 'usd', 'calls', 'top_label', 'top_label_usd'];
|
|
68
|
+
/** Columns for the per-hour-of-UTC-day series. */
|
|
69
|
+
export const PROFILE_CSV_HOUR_COLUMNS = ['hour_utc', 'usd', 'calls'];
|
|
70
|
+
/**
|
|
71
|
+
* The report as CSV text, one row per label and model.
|
|
72
|
+
*
|
|
73
|
+
* Rows arrive in the report's own order — largest bill first — because a
|
|
74
|
+
* spreadsheet can re-sort and a reader opening the file should see the
|
|
75
|
+
* expensive workload at the top either way.
|
|
76
|
+
*/
|
|
77
|
+
export function profileToCsv(report, options) {
|
|
78
|
+
if (options.shape === 'day') {
|
|
79
|
+
const rows = [PROFILE_CSV_DAY_COLUMNS.join(',')];
|
|
80
|
+
for (const day of report.spendByDay) {
|
|
81
|
+
rows.push([
|
|
82
|
+
day.day,
|
|
83
|
+
usd(day.usd),
|
|
84
|
+
String(day.calls),
|
|
85
|
+
// A day whose calls carried no label at all has no top label, and an
|
|
86
|
+
// empty cell is that absence. Naming the unlabelled bucket here
|
|
87
|
+
// would claim a label the log never carried.
|
|
88
|
+
day.topLabel === null
|
|
89
|
+
? ''
|
|
90
|
+
: field(day.topLabel === UNLABELLED ? options.unlabelled : day.topLabel),
|
|
91
|
+
day.topLabel === null ? '' : usd(day.topLabelUsd),
|
|
92
|
+
].join(','));
|
|
93
|
+
}
|
|
94
|
+
return `${rows.join('\n')}\n`;
|
|
95
|
+
}
|
|
96
|
+
if (options.shape === 'hour') {
|
|
97
|
+
const rows = [PROFILE_CSV_HOUR_COLUMNS.join(',')];
|
|
98
|
+
for (const hour of report.spendByHour) {
|
|
99
|
+
rows.push([String(hour.hour), usd(hour.usd), String(hour.calls)].join(','));
|
|
100
|
+
}
|
|
101
|
+
return `${rows.join('\n')}\n`;
|
|
102
|
+
}
|
|
103
|
+
const rows = [PROFILE_CSV_COLUMNS.join(',')];
|
|
104
|
+
for (const { label, model, breakdown } of report.byLabelAndModel) {
|
|
105
|
+
rows.push([
|
|
106
|
+
field(label === UNLABELLED ? options.unlabelled : label),
|
|
107
|
+
field(model),
|
|
108
|
+
String(breakdown.calls),
|
|
109
|
+
String(breakdown.inputTokens),
|
|
110
|
+
String(breakdown.cacheReadTokens),
|
|
111
|
+
String(breakdown.cacheWriteTokens),
|
|
112
|
+
String(breakdown.outputTokens),
|
|
113
|
+
usd(breakdown.inputUsd),
|
|
114
|
+
usd(breakdown.cacheReadUsd),
|
|
115
|
+
usd(breakdown.cacheWriteUsd),
|
|
116
|
+
usd(breakdown.outputUsd),
|
|
117
|
+
usd(breakdown.totalUsd),
|
|
118
|
+
].join(','));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The unpriced calls, with their tokens and no dollars.
|
|
122
|
+
*
|
|
123
|
+
* They are absent from `byLabelAndModel` — which holds what could be priced
|
|
124
|
+
* — and leaving them out of the file entirely would make its token columns
|
|
125
|
+
* disagree with the log. `byModel` keeps them, so they are recovered from
|
|
126
|
+
* there, with empty dollar cells rather than zeros.
|
|
127
|
+
*/
|
|
128
|
+
for (const model of report.unpricedModels) {
|
|
129
|
+
const row = report.byModel.find((entry) => entry.model === model);
|
|
130
|
+
if (!row)
|
|
131
|
+
continue;
|
|
132
|
+
rows.push([
|
|
133
|
+
field(options.unlabelled),
|
|
134
|
+
field(model),
|
|
135
|
+
String(row.breakdown.calls),
|
|
136
|
+
String(row.breakdown.inputTokens),
|
|
137
|
+
String(row.breakdown.cacheReadTokens),
|
|
138
|
+
String(row.breakdown.cacheWriteTokens),
|
|
139
|
+
String(row.breakdown.outputTokens),
|
|
140
|
+
'',
|
|
141
|
+
'',
|
|
142
|
+
'',
|
|
143
|
+
'',
|
|
144
|
+
'',
|
|
145
|
+
].join(','));
|
|
146
|
+
}
|
|
147
|
+
return `${rows.join('\n')}\n`;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=csv.js.map
|
package/dist/csv.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.js","sourceRoot":"","sources":["../src/csv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,qFAAqF;AACrF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO;I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AE;YACF,EAAE;YACF,EAAE;YACF,EAAE;YACF,EAAE;SACH,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAChC,CAAC"}
|
package/dist/evaluate.d.ts
CHANGED
|
@@ -35,6 +35,16 @@ export type EvalVerdict = 'indistinguishable' | 'within-noise' | 'diverges' | 'i
|
|
|
35
35
|
export interface EvalReport {
|
|
36
36
|
provider: string;
|
|
37
37
|
model: string;
|
|
38
|
+
/**
|
|
39
|
+
* The model the candidate answer came from.
|
|
40
|
+
*
|
|
41
|
+
* Equal to `model` on the ordinary comparison — same model, two prompts. It
|
|
42
|
+
* differs when the question is the other one: **same prompt, two models**, which
|
|
43
|
+
* is what a routing decision is. `profile` prices that route exactly and can say
|
|
44
|
+
* nothing at all about whether the cheaper model still does the job; this is the
|
|
45
|
+
* measurement that can.
|
|
46
|
+
*/
|
|
47
|
+
candidateModel: string;
|
|
38
48
|
cases: EvalCase[];
|
|
39
49
|
/** Mean agreement of the original prompt with itself. The yardstick. */
|
|
40
50
|
selfAgreement: number;
|
|
@@ -51,6 +61,20 @@ export interface EvaluateOptions {
|
|
|
51
61
|
* call already paid for.
|
|
52
62
|
*/
|
|
53
63
|
concurrency?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Where the candidate answer comes from. Defaults to `provider`.
|
|
66
|
+
*
|
|
67
|
+
* This is the whole routing axis, and it needed no new yardstick. The baseline
|
|
68
|
+
* prompt is still run **twice on the original model** to measure that model's own
|
|
69
|
+
* variance, and the candidate is still judged against it — so the question
|
|
70
|
+
* becomes "does the cheaper model agree with the expensive one more closely than
|
|
71
|
+
* the expensive one agrees with itself?", which is the honest form of "is this
|
|
72
|
+
* route safe".
|
|
73
|
+
*
|
|
74
|
+
* A verdict built any other way would be a threshold somebody picked. This one is
|
|
75
|
+
* the model's own noise floor, measured on the same cases in the same run.
|
|
76
|
+
*/
|
|
77
|
+
candidateProvider?: LlmProvider;
|
|
54
78
|
}
|
|
55
79
|
/**
|
|
56
80
|
* Builds the prompt for one case.
|
package/dist/evaluate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,QAAQ;IACvB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,cAAc,GAAG,UAAU,GAAG,cAAc,CAAC;AAE7F,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,wEAAwE;IACxE,aAAa,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,QAAQ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AC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAc3F;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,QAAQ,EAAE,WAAW,EACrB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,CA4CrB"}
|
package/dist/evaluate.js
CHANGED
|
@@ -79,14 +79,16 @@ export async function pooled(tasks, limit) {
|
|
|
79
79
|
*/
|
|
80
80
|
export async function evaluate(originalPrompt, optimizedPrompt, inputs, provider, options = {}) {
|
|
81
81
|
const concurrency = Math.max(1, options.concurrency ?? 3);
|
|
82
|
-
const
|
|
82
|
+
const candidate = options.candidateProvider ?? provider;
|
|
83
|
+
const run = (prompt, input, on = provider) => on.complete({ system: fillPrompt(prompt, input), user: input });
|
|
83
84
|
const cases = await pooled(inputs.map((input) => async () => {
|
|
84
85
|
// Sequential within a case: the two baseline runs exist to measure the
|
|
85
86
|
// model's variance, and issuing them together invites a provider to
|
|
86
87
|
// serve one from a cache and report a variance of zero.
|
|
87
88
|
const baselineA = await run(originalPrompt, input);
|
|
88
89
|
const baselineB = await run(originalPrompt, input);
|
|
89
|
-
|
|
90
|
+
// On `candidate`, which is `provider` unless a route is being measured.
|
|
91
|
+
const optimized = await run(optimizedPrompt, input, candidate);
|
|
90
92
|
return {
|
|
91
93
|
input,
|
|
92
94
|
baseline: [baselineA, baselineB],
|
|
@@ -100,6 +102,7 @@ export async function evaluate(originalPrompt, optimizedPrompt, inputs, provider
|
|
|
100
102
|
return {
|
|
101
103
|
provider: provider.name,
|
|
102
104
|
model: provider.model,
|
|
105
|
+
candidateModel: candidate.model,
|
|
103
106
|
cases,
|
|
104
107
|
selfAgreement,
|
|
105
108
|
crossAgreement,
|
package/dist/evaluate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAqF/D;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,KAAa;IACtD,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CACtC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC,UAAU,KAAK,aAAa,CAChE,CAAC;IACF,IAAI,CAAC,WAAW;QAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,CAAC;IAC3D,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC;AAED,0CAA0C;AAC1C;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,CAAS;IAC5C,MAAM,IAAI,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACrC,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,MAAgB,EAAU,EAAE,CACxC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,C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CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;IAEjE,OAAO;QACL,QAAQ,EAAE,QAAQ,CAAC,IAAI;QACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,cAAc,EAAE,SAAS,CAAC,KAAK;QAC/B,KAAK;QACL,aAAa;QACb,cAAc;QACd,OAAO,EAAE,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC;QAClD,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;KAC5B,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export { ESTIMATE_ERROR_BAND_PCT, estimateTokens, countTokensAnthropic } from './tokenizer.js';
|
|
3
|
-
export { UNLABELLED, cacheHitRate, parseUsageLine, profileUsage, sharesOf, } from './usage.js';
|
|
4
|
-
export type { UsageProfileOptions, UsageBreakdown, UsageProfileReport, UsageRecord, UsageShares, } from './usage.js';
|
|
3
|
+
export { UNLABELLED, cacheEconomics, cacheHitRate, parseUsageLine, profileUsage, sharesOf, } from './usage.js';
|
|
4
|
+
export type { CacheEconomics, CacheVerdict, UsageProfileOptions, UsageBreakdown, UsageProfileReport, UsageRecord, UsageShares, } from './usage.js';
|
|
5
|
+
export { conversationGrowth, createConversationTracker } from './conversation.js';
|
|
6
|
+
export { TTL_1H_MS, TTL_5M_MS, cacheTtlFit, createTtlFitTracker } from './ttl-fit.js';
|
|
7
|
+
export type { CacheTtlFit, TtlFitOptions, TtlFitTracker, TtlFitVerdict } from './ttl-fit.js';
|
|
8
|
+
export { PROFILE_CSV_COLUMNS, PROFILE_CSV_DAY_COLUMNS, PROFILE_CSV_HOUR_COLUMNS, profileToCsv, } from './csv.js';
|
|
9
|
+
export type { ProfileCsvOptions, ProfileCsvShape } from './csv.js';
|
|
10
|
+
export { driversBetween } from './against.js';
|
|
11
|
+
export type { AgainstDriver } from './against.js';
|
|
12
|
+
export { createInputShapeTracker, inputShapes } from './input-shape.js';
|
|
13
|
+
export type { InputShape, InputShapeOptions, InputShapeTracker } from './input-shape.js';
|
|
14
|
+
export { createRepeatsTracker, repeatedTurns } from './repeats.js';
|
|
15
|
+
export type { RepeatedTurns, RepeatsOptions, RepeatsTracker } from './repeats.js';
|
|
16
|
+
export { priceTokensOn, repriceProfile } from './reprice.js';
|
|
17
|
+
export type { OverContextSlice, RepriceReport, RepricedSlice } from './reprice.js';
|
|
18
|
+
export { createSessionLedgerTracker, singleTurnCacheWrites } from './session-ledger.js';
|
|
19
|
+
export { createSessionCostTracker, sessionCostShapes } from './session-cost.js';
|
|
20
|
+
export type { SessionCostOptions, SessionCostShape, SessionCostTracker } from './session-cost.js';
|
|
21
|
+
export type { SessionLedgerOptions, SessionLedgerTracker, SingleTurnCacheWrites, } from './session-ledger.js';
|
|
22
|
+
export { createOutputShapeTracker, outputShapes } from './output-shape.js';
|
|
23
|
+
export type { OutputShape, OutputShapeOptions, OutputShapeTracker } from './output-shape.js';
|
|
24
|
+
export type { ConversationGrowth, ConversationOptions, ConversationTracker } from './conversation.js';
|
|
25
|
+
export { billLevers } from './levers.js';
|
|
26
|
+
export type { BillLevers, BillLeverOptions, LeverId, SliceLevers } from './levers.js';
|
|
5
27
|
export { DETECTABLE_LANGUAGES, detectTextLanguage } from './language.js';
|
|
6
28
|
export { countSentences, profilePrompt } from './profile.js';
|
|
7
29
|
export { PHRASE_LANGUAGES } from './phrases.js';
|
|
@@ -65,5 +87,5 @@ export type { PromptComparison, CompareOptions, RuleDelta, AdvisoryDelta, } from
|
|
|
65
87
|
export { matchGlob, mostSpecificMatch, specificity } from './glob.js';
|
|
66
88
|
export { editDistance, nearestName } from './nearest.js';
|
|
67
89
|
export { CONFIG_FILENAME, CONFIG_KEYS, CONFIG_USAGE_KEYS, ConfigError, DEFAULT_EXTENSIONS, MAX_CONFIG_BYTES, MAX_CONFIG_SEARCH_DEPTH, budgetFor, parseConfig, } from './config-schema.js';
|
|
68
|
-
export type { ResolvedBudget, TrazumConfig } from './config-schema.js';
|
|
90
|
+
export type { ResolvedBudget, SpendConfig, TrazumConfig } from './config-schema.js';
|
|
69
91
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClG,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC1F,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpG,YAAY,EACV,cAAc,EACd,iBAAiB,E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,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,aAAa,GACd,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKzD,OAAO,EACL,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export { ESTIMATE_ERROR_BAND_PCT, estimateTokens, countTokensAnthropic } from './tokenizer.js';
|
|
3
|
-
export { UNLABELLED, cacheHitRate, parseUsageLine, profileUsage, sharesOf, } from './usage.js';
|
|
3
|
+
export { UNLABELLED, cacheEconomics, cacheHitRate, parseUsageLine, profileUsage, sharesOf, } from './usage.js';
|
|
4
|
+
export { conversationGrowth, createConversationTracker } from './conversation.js';
|
|
5
|
+
// Whether the cache TTL fits how fast the turns arrive — the mechanism behind a
|
|
6
|
+
// losing cache, readable only when the log carries a clock. See ttl-fit.ts.
|
|
7
|
+
export { TTL_1H_MS, TTL_5M_MS, cacheTtlFit, createTtlFitTracker } from './ttl-fit.js';
|
|
8
|
+
// Cache writes by conversations that never came back — a ceiling on waste,
|
|
9
|
+
// named as one, and a fact when the slice read nothing. See session-ledger.ts.
|
|
10
|
+
// The drivers of a change between two bills — one implementation, because the
|
|
11
|
+
// sign convention (positive means the bill grew) has flipped once already
|
|
12
|
+
// when restated by hand. See against.ts.
|
|
13
|
+
// The profile as a spreadsheet — one row per label and model, no total row,
|
|
14
|
+
// empty cells where dollars are unknown. See csv.ts.
|
|
15
|
+
export { PROFILE_CSV_COLUMNS, PROFILE_CSV_DAY_COLUMNS, PROFILE_CSV_HOUR_COLUMNS, profileToCsv, } from './csv.js';
|
|
16
|
+
export { driversBetween } from './against.js';
|
|
17
|
+
// The same tokens at another model's rates — arithmetic, not advice, and it
|
|
18
|
+
// refuses to price a call the target could not have accepted. See reprice.ts.
|
|
19
|
+
// The shape of a call's input — the half of the bill a total could only name.
|
|
20
|
+
// See input-shape.ts.
|
|
21
|
+
export { createInputShapeTracker, inputShapes } from './input-shape.js';
|
|
22
|
+
// The same request sent again a moment later — a retry or a loop, named as
|
|
23
|
+
// the pattern it is and never as a certainty. See repeats.ts.
|
|
24
|
+
export { createRepeatsTracker, repeatedTurns } from './repeats.js';
|
|
25
|
+
export { priceTokensOn, repriceProfile } from './reprice.js';
|
|
26
|
+
export { createSessionLedgerTracker, singleTurnCacheWrites } from './session-ledger.js';
|
|
27
|
+
// What one conversation costs — median and p95, exact. See session-cost.ts.
|
|
28
|
+
export { createSessionCostTracker, sessionCostShapes } from './session-cost.js';
|
|
29
|
+
export { createOutputShapeTracker, outputShapes } from './output-shape.js';
|
|
30
|
+
export { billLevers } from './levers.js';
|
|
4
31
|
export { DETECTABLE_LANGUAGES, detectTextLanguage } from './language.js';
|
|
5
32
|
export { countSentences, profilePrompt } from './profile.js';
|
|
6
33
|
export { PHRASE_LANGUAGES } from './phrases.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,QAAQ,GACT,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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E,kDAAkD;AAClD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,eAAe,EACf,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAGlB,6BAA6B;AAC7B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpE,qEAAqE;AACrE,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAG3E,kFAAkF;AAClF,kFAAkF;AAClF,wCAAwC;AACxC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGzF,mEAAmE;AACnE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGjE,gCAAgC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQ9C,0EAA0E;AAC1E,+EAA+E;AAC/E,8EAA8E;AAC9E,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEzD,8EAA8E;AAC9E,6EAA6E;AAC7E,2DAA2D;AAC3D,OAAO,EACL,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,WAAW,GACZ,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { PricingCatalogue } from './pricing.js';
|
|
2
|
+
import type { UsageRecord } from './usage.js';
|
|
3
|
+
/**
|
|
4
|
+
* How big a call's input actually is, and how uneven that is across a slice.
|
|
5
|
+
*
|
|
6
|
+
* ## The half of the bill nothing described
|
|
7
|
+
*
|
|
8
|
+
* `outputShapes` says where the *output* spend concentrates. Input had a total
|
|
9
|
+
* and nothing else — and on a RAG or agent workload input is most of the bill,
|
|
10
|
+
* made of retrieved context, conversation history and tool results that no
|
|
11
|
+
* prompt file contains. "Input is 63% of this bill" is true and unactionable;
|
|
12
|
+
* the question somebody can act on is whether that 63% is *every* call
|
|
13
|
+
* carrying a large prompt, or a few calls carrying an enormous one.
|
|
14
|
+
*
|
|
15
|
+
* Two slices with identical input spend want opposite responses:
|
|
16
|
+
*
|
|
17
|
+
* - **Even.** The p95 call carries roughly what the median call carries. The
|
|
18
|
+
* prompt is simply large, and the lever is the prompt: fewer retrieved
|
|
19
|
+
* documents, a shorter system block, caching if the prefix repeats.
|
|
20
|
+
* - **Skewed.** The p95 call carries twelve times the median. Something is
|
|
21
|
+
* growing — a conversation nobody truncates, a retrieval with no cap, a
|
|
22
|
+
* tool result pasted in whole. The median call is fine and the fix is a
|
|
23
|
+
* limit, not a rewrite.
|
|
24
|
+
*
|
|
25
|
+
* A total cannot tell those apart, and neither can the per-day series.
|
|
26
|
+
*
|
|
27
|
+
* ## What "input" means here
|
|
28
|
+
*
|
|
29
|
+
* Everything the model read: fresh input, cache reads and cache writes. That
|
|
30
|
+
* is the size of the request, which is what a context window and a retrieval
|
|
31
|
+
* cap are about. `cachedShare` then says how much of it was billed at the
|
|
32
|
+
* cache-read rate — a tenth of input on Anthropic — because a slice whose
|
|
33
|
+
* large calls are almost entirely cache reads is a very different bill from
|
|
34
|
+
* one paying full rate for the same tokens, and the token counts alone cannot
|
|
35
|
+
* tell them apart.
|
|
36
|
+
*
|
|
37
|
+
* ## Ceilings, never interpolations
|
|
38
|
+
*
|
|
39
|
+
* The counts live in fixed buckets, so a usage log measured in megabytes costs
|
|
40
|
+
* bounded memory. Every figure reported is a **bucket edge**: "half the calls
|
|
41
|
+
* fit within N tokens" is exact for the N named, where interpolating a median
|
|
42
|
+
* between two buckets would invent a call nobody made. `p95OverMedian` is
|
|
43
|
+
* therefore a ratio of two ceilings and coarse by construction — it is a shape,
|
|
44
|
+
* not a measurement, and the copy that renders it says which.
|
|
45
|
+
*/
|
|
46
|
+
/** How one label-and-model slice's input is distributed across its calls. */
|
|
47
|
+
export interface InputShape {
|
|
48
|
+
label: string;
|
|
49
|
+
model: string;
|
|
50
|
+
modelName: string;
|
|
51
|
+
calls: number;
|
|
52
|
+
/** Fresh input, cache reads and cache writes — everything the model read. */
|
|
53
|
+
inputTokens: number;
|
|
54
|
+
/** What those tokens cost, at each class's own rate. */
|
|
55
|
+
inputUsd: number;
|
|
56
|
+
/** This slice's input spend as a fraction of the whole bill. */
|
|
57
|
+
shareOfBill: number;
|
|
58
|
+
/**
|
|
59
|
+
* The bucket ceiling at least half the calls fit within, and the same for
|
|
60
|
+
* 95% of them. `null` only when the covering bucket is the open-ended last
|
|
61
|
+
* one, which has no ceiling to name.
|
|
62
|
+
*/
|
|
63
|
+
medianWithinTokens: number | null;
|
|
64
|
+
p95WithinTokens: number | null;
|
|
65
|
+
/**
|
|
66
|
+
* `p95WithinTokens / medianWithinTokens` — how much bigger the large calls
|
|
67
|
+
* are than the ordinary one. A ratio of two ceilings, so it is coarse on
|
|
68
|
+
* purpose; `null` when either ceiling is unknown or the median ceiling is
|
|
69
|
+
* zero.
|
|
70
|
+
*/
|
|
71
|
+
p95OverMedian: number | null;
|
|
72
|
+
/**
|
|
73
|
+
* The share of these tokens that were cache reads.
|
|
74
|
+
*
|
|
75
|
+
* Says what the size actually costs: on Anthropic a cache read is a tenth of
|
|
76
|
+
* input, so a slice at 0.9 here is large and cheap, and one at 0 is large at
|
|
77
|
+
* full rate. Without it, "the p95 call carries 400,000 tokens" reads as an
|
|
78
|
+
* emergency in a workload that is caching correctly.
|
|
79
|
+
*/
|
|
80
|
+
cachedShare: number;
|
|
81
|
+
}
|
|
82
|
+
export interface InputShapeOptions {
|
|
83
|
+
catalogue: PricingCatalogue;
|
|
84
|
+
on?: Date;
|
|
85
|
+
/** Slices whose input is below this share of the bill are dropped. Default 5%. */
|
|
86
|
+
minShare?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Slices with fewer calls than this are dropped. Default 20.
|
|
89
|
+
*
|
|
90
|
+
* A p95 over four calls is the largest of the four wearing a percentile's
|
|
91
|
+
* name, and the sentence this feeds — "the large calls are twelve times the
|
|
92
|
+
* ordinary one" — would be a description of one call.
|
|
93
|
+
*/
|
|
94
|
+
minCalls?: number;
|
|
95
|
+
}
|
|
96
|
+
export interface InputShapeTracker {
|
|
97
|
+
add(record: UsageRecord): void;
|
|
98
|
+
finish(totalUsd: number): InputShape[];
|
|
99
|
+
}
|
|
100
|
+
/** An accumulator, fed in the pass a profile already makes. */
|
|
101
|
+
export declare function createInputShapeTracker(options: InputShapeOptions): InputShapeTracker;
|
|
102
|
+
/** The same measurement over a list of records, for a caller holding one. */
|
|
103
|
+
export declare function inputShapes(records: readonly UsageRecord[], totalUsd: number, options: InputShapeOptions): InputShape[];
|
|
104
|
+
//# sourceMappingURL=input-shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-shape.d.ts","sourceRoot":"","sources":["../src/input-shape.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;OAK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