@meetkai/mka1 0.54.72 → 0.54.73
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 +307 -304
- package/bin/mcp-server.js +1680 -1475
- package/bin/mcp-server.js.map +14 -9
- package/dist/commonjs/funcs/llmEvalsMeasureSuiteTokens.d.ts +20 -0
- package/dist/commonjs/funcs/llmEvalsMeasureSuiteTokens.d.ts.map +1 -0
- package/dist/commonjs/funcs/llmEvalsMeasureSuiteTokens.js +137 -0
- package/dist/commonjs/funcs/llmEvalsMeasureSuiteTokens.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/llmEvalsMeasureSuiteTokens.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/llmEvalsMeasureSuiteTokens.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/llmEvalsMeasureSuiteTokens.js +64 -0
- package/dist/commonjs/mcp-server/tools/llmEvalsMeasureSuiteTokens.js.map +1 -0
- package/dist/commonjs/models/components/evalsampleobject.d.ts +5 -0
- package/dist/commonjs/models/components/evalsampleobject.d.ts.map +1 -1
- package/dist/commonjs/models/components/evalsampleobject.js +4 -0
- package/dist/commonjs/models/components/evalsampleobject.js.map +1 -1
- package/dist/commonjs/models/components/evalsuitetokenmeasurement.d.ts +34 -0
- package/dist/commonjs/models/components/evalsuitetokenmeasurement.d.ts.map +1 -0
- package/dist/commonjs/models/components/evalsuitetokenmeasurement.js +81 -0
- package/dist/commonjs/models/components/evalsuitetokenmeasurement.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/measureevalsuitetokensbody.d.ts +20 -0
- package/dist/commonjs/models/components/measureevalsuitetokensbody.d.ts.map +1 -0
- package/dist/commonjs/models/components/measureevalsuitetokensbody.js +58 -0
- package/dist/commonjs/models/components/measureevalsuitetokensbody.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/measureevalsuitetokens.d.ts +25 -0
- package/dist/commonjs/models/operations/measureevalsuitetokens.d.ts.map +1 -0
- package/dist/commonjs/models/operations/measureevalsuitetokens.js +76 -0
- package/dist/commonjs/models/operations/measureevalsuitetokens.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +1 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +1 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/llmEvalsMeasureSuiteTokens.d.ts +29 -0
- package/dist/commonjs/react-query/llmEvalsMeasureSuiteTokens.d.ts.map +1 -0
- package/dist/commonjs/react-query/llmEvalsMeasureSuiteTokens.js +47 -0
- package/dist/commonjs/react-query/llmEvalsMeasureSuiteTokens.js.map +1 -0
- package/dist/commonjs/sdk/evals.d.ts +7 -0
- package/dist/commonjs/sdk/evals.d.ts.map +1 -1
- package/dist/commonjs/sdk/evals.js +10 -0
- package/dist/commonjs/sdk/evals.js.map +1 -1
- package/dist/esm/funcs/llmEvalsMeasureSuiteTokens.d.ts +20 -0
- package/dist/esm/funcs/llmEvalsMeasureSuiteTokens.d.ts.map +1 -0
- package/dist/esm/funcs/llmEvalsMeasureSuiteTokens.js +101 -0
- package/dist/esm/funcs/llmEvalsMeasureSuiteTokens.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/llmEvalsMeasureSuiteTokens.d.ts +8 -0
- package/dist/esm/mcp-server/tools/llmEvalsMeasureSuiteTokens.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/llmEvalsMeasureSuiteTokens.js +28 -0
- package/dist/esm/mcp-server/tools/llmEvalsMeasureSuiteTokens.js.map +1 -0
- package/dist/esm/models/components/evalsampleobject.d.ts +5 -0
- package/dist/esm/models/components/evalsampleobject.d.ts.map +1 -1
- package/dist/esm/models/components/evalsampleobject.js +4 -0
- package/dist/esm/models/components/evalsampleobject.js.map +1 -1
- package/dist/esm/models/components/evalsuitetokenmeasurement.d.ts +34 -0
- package/dist/esm/models/components/evalsuitetokenmeasurement.d.ts.map +1 -0
- package/dist/esm/models/components/evalsuitetokenmeasurement.js +43 -0
- package/dist/esm/models/components/evalsuitetokenmeasurement.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/measureevalsuitetokensbody.d.ts +20 -0
- package/dist/esm/models/components/measureevalsuitetokensbody.d.ts.map +1 -0
- package/dist/esm/models/components/measureevalsuitetokensbody.js +20 -0
- package/dist/esm/models/components/measureevalsuitetokensbody.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/measureevalsuitetokens.d.ts +25 -0
- package/dist/esm/models/operations/measureevalsuitetokens.d.ts.map +1 -0
- package/dist/esm/models/operations/measureevalsuitetokens.js +38 -0
- package/dist/esm/models/operations/measureevalsuitetokens.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +1 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +1 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/llmEvalsMeasureSuiteTokens.d.ts +29 -0
- package/dist/esm/react-query/llmEvalsMeasureSuiteTokens.d.ts.map +1 -0
- package/dist/esm/react-query/llmEvalsMeasureSuiteTokens.js +42 -0
- package/dist/esm/react-query/llmEvalsMeasureSuiteTokens.js.map +1 -0
- package/dist/esm/sdk/evals.d.ts +7 -0
- package/dist/esm/sdk/evals.d.ts.map +1 -1
- package/dist/esm/sdk/evals.js +10 -0
- package/dist/esm/sdk/evals.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/llmEvalsMeasureSuiteTokens.ts +191 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/llmEvalsMeasureSuiteTokens.ts +37 -0
- package/src/models/components/evalsampleobject.ts +9 -0
- package/src/models/components/evalsuitetokenmeasurement.ts +91 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/measureevalsuitetokensbody.ts +54 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/measureevalsuitetokens.ts +80 -0
- package/src/react-query/index.ts +1 -0
- package/src/react-query/llmEvalsMeasureSuiteTokens.ts +110 -0
- package/src/sdk/evals.ts +18 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import * as components from "../models/components/index.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Count tokens from stored text for a suite's unmeasured samples
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Backfill for rows written before the gateway recorded usage. For samples of the suite's completed runs that have answer or reasoning text but no token figure, counts prompt, reasoning and answer tokens from the stored text (tiktoken o200k_base, one ruler for every model), marks them `tokens_estimated`, and refreshes each run's per-task `tokens` and run totals so the leaderboard's efficiency figures appear. Processes `limit` runs per call, oldest run id first; call again until `remaining_runs` is 0. Samples the provider or the import already measured are left alone, and a sample with no text stays unmeasured. New rows get the same figures at generation or import time, so this is a no-op on a suite with nothing to measure.
|
|
34
|
+
*
|
|
35
|
+
* If set, this operation will use {@link Security.bearerAuth} from the global security.
|
|
36
|
+
*/
|
|
37
|
+
export function llmEvalsMeasureSuiteTokens(
|
|
38
|
+
client: SDKCore,
|
|
39
|
+
request: operations.MeasureEvalSuiteTokensRequest,
|
|
40
|
+
options?: RequestOptions,
|
|
41
|
+
): APIPromise<
|
|
42
|
+
Result<
|
|
43
|
+
components.EvalSuiteTokenMeasurement,
|
|
44
|
+
| SDKError
|
|
45
|
+
| ResponseValidationError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| InvalidRequestError
|
|
50
|
+
| UnexpectedClientError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: SDKCore,
|
|
63
|
+
request: operations.MeasureEvalSuiteTokensRequest,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
components.EvalSuiteTokenMeasurement,
|
|
69
|
+
| SDKError
|
|
70
|
+
| ResponseValidationError
|
|
71
|
+
| ConnectionError
|
|
72
|
+
| RequestAbortedError
|
|
73
|
+
| RequestTimeoutError
|
|
74
|
+
| InvalidRequestError
|
|
75
|
+
| UnexpectedClientError
|
|
76
|
+
| SDKValidationError
|
|
77
|
+
>,
|
|
78
|
+
APICall,
|
|
79
|
+
]
|
|
80
|
+
> {
|
|
81
|
+
const parsed = safeParse(
|
|
82
|
+
request,
|
|
83
|
+
(value) =>
|
|
84
|
+
operations.MeasureEvalSuiteTokensRequest$outboundSchema.parse(value),
|
|
85
|
+
"Input validation failed",
|
|
86
|
+
);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const payload = parsed.value;
|
|
91
|
+
const body = encodeJSON("body", payload.MeasureEvalSuiteTokensBody, {
|
|
92
|
+
explode: true,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const pathParams = {
|
|
96
|
+
suite_id: encodeSimple("suite_id", payload.suite_id, {
|
|
97
|
+
explode: false,
|
|
98
|
+
charEncoding: "percent",
|
|
99
|
+
}),
|
|
100
|
+
};
|
|
101
|
+
const path = pathToFunc("/api/v1/llm/evals/suites/{suite_id}/tokens/measure")(
|
|
102
|
+
pathParams,
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const headers = new Headers(compactMap({
|
|
106
|
+
"Content-Type": "application/json",
|
|
107
|
+
Accept: "application/json",
|
|
108
|
+
"X-On-Behalf-Of": encodeSimple(
|
|
109
|
+
"X-On-Behalf-Of",
|
|
110
|
+
payload["X-On-Behalf-Of"],
|
|
111
|
+
{ explode: false, charEncoding: "none" },
|
|
112
|
+
),
|
|
113
|
+
}));
|
|
114
|
+
|
|
115
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
116
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
117
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
118
|
+
|
|
119
|
+
const context = {
|
|
120
|
+
options: client._options,
|
|
121
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
122
|
+
operationID: "measureEvalSuiteTokens",
|
|
123
|
+
oAuth2Scopes: null,
|
|
124
|
+
|
|
125
|
+
resolvedSecurity: requestSecurity,
|
|
126
|
+
|
|
127
|
+
securitySource: client._options.bearerAuth,
|
|
128
|
+
retryConfig: options?.retries
|
|
129
|
+
|| client._options.retryConfig
|
|
130
|
+
|| {
|
|
131
|
+
strategy: "backoff",
|
|
132
|
+
backoff: {
|
|
133
|
+
initialInterval: 500,
|
|
134
|
+
maxInterval: 5000,
|
|
135
|
+
exponent: 1.5,
|
|
136
|
+
maxElapsedTime: 15000,
|
|
137
|
+
},
|
|
138
|
+
retryConnectionErrors: true,
|
|
139
|
+
}
|
|
140
|
+
|| { strategy: "none" },
|
|
141
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const requestRes = client._createRequest(context, {
|
|
145
|
+
security: requestSecurity,
|
|
146
|
+
method: "POST",
|
|
147
|
+
baseURL: options?.serverURL,
|
|
148
|
+
path: path,
|
|
149
|
+
headers: headers,
|
|
150
|
+
body: body,
|
|
151
|
+
userAgent: client._options.userAgent,
|
|
152
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
153
|
+
}, options);
|
|
154
|
+
if (!requestRes.ok) {
|
|
155
|
+
return [requestRes, { status: "invalid" }];
|
|
156
|
+
}
|
|
157
|
+
const req = requestRes.value;
|
|
158
|
+
|
|
159
|
+
const doResult = await client._do(req, {
|
|
160
|
+
context,
|
|
161
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
162
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
163
|
+
retryConfig: context.retryConfig,
|
|
164
|
+
retryCodes: context.retryCodes,
|
|
165
|
+
});
|
|
166
|
+
if (!doResult.ok) {
|
|
167
|
+
return [doResult, { status: "request-error", request: req }];
|
|
168
|
+
}
|
|
169
|
+
const response = doResult.value;
|
|
170
|
+
|
|
171
|
+
const [result] = await M.match<
|
|
172
|
+
components.EvalSuiteTokenMeasurement,
|
|
173
|
+
| SDKError
|
|
174
|
+
| ResponseValidationError
|
|
175
|
+
| ConnectionError
|
|
176
|
+
| RequestAbortedError
|
|
177
|
+
| RequestTimeoutError
|
|
178
|
+
| InvalidRequestError
|
|
179
|
+
| UnexpectedClientError
|
|
180
|
+
| SDKValidationError
|
|
181
|
+
>(
|
|
182
|
+
M.json(200, components.EvalSuiteTokenMeasurement$inboundSchema),
|
|
183
|
+
M.fail("4XX"),
|
|
184
|
+
M.fail("5XX"),
|
|
185
|
+
)(response, req);
|
|
186
|
+
if (!result.ok) {
|
|
187
|
+
return [result, { status: "complete", request: req, response }];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return [result, { status: "complete", request: req, response }];
|
|
191
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "1.1.0",
|
|
68
|
-
sdkVersion: "0.54.
|
|
68
|
+
sdkVersion: "0.54.73",
|
|
69
69
|
genVersion: "2.943.0",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.54.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.54.73 2.943.0 1.1.0 @meetkai/mka1",
|
|
71
71
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -247,6 +247,7 @@ import { tool$llmEvalsListSchedules } from "./tools/llmEvalsListSchedules.js";
|
|
|
247
247
|
import { tool$llmEvalsListSuiteLeaderboardRuns } from "./tools/llmEvalsListSuiteLeaderboardRuns.js";
|
|
248
248
|
import { tool$llmEvalsListSuites } from "./tools/llmEvalsListSuites.js";
|
|
249
249
|
import { tool$llmEvalsListSuiteVersions } from "./tools/llmEvalsListSuiteVersions.js";
|
|
250
|
+
import { tool$llmEvalsMeasureSuiteTokens } from "./tools/llmEvalsMeasureSuiteTokens.js";
|
|
250
251
|
import { tool$llmEvalsRerunFailedSamples } from "./tools/llmEvalsRerunFailedSamples.js";
|
|
251
252
|
import { tool$llmEvalsRetryFailedRun } from "./tools/llmEvalsRetryFailedRun.js";
|
|
252
253
|
import { tool$llmEvalsTriggerSchedule } from "./tools/llmEvalsTriggerSchedule.js";
|
|
@@ -473,7 +474,7 @@ export function createMCPServer(deps: {
|
|
|
473
474
|
}) {
|
|
474
475
|
const server = new McpServer({
|
|
475
476
|
name: "SDK",
|
|
476
|
-
version: "0.54.
|
|
477
|
+
version: "0.54.73",
|
|
477
478
|
});
|
|
478
479
|
|
|
479
480
|
const client = new SDKCore({
|
|
@@ -683,6 +684,7 @@ export function createMCPServer(deps: {
|
|
|
683
684
|
tool(tool$llmEvalsGetSuiteVersion);
|
|
684
685
|
tool(tool$llmEvalsListSuiteLeaderboardRuns);
|
|
685
686
|
tool(tool$llmEvalsGetSuiteLeaderboard);
|
|
687
|
+
tool(tool$llmEvalsMeasureSuiteTokens);
|
|
686
688
|
tool(tool$llmEvalsCreateRun);
|
|
687
689
|
tool(tool$llmEvalsListRuns);
|
|
688
690
|
tool(tool$llmEvalsGetRun);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { llmEvalsMeasureSuiteTokens } from "../../funcs/llmEvalsMeasureSuiteTokens.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.MeasureEvalSuiteTokensRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$llmEvalsMeasureSuiteTokens: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "llm-evals-measure-suite-tokens",
|
|
15
|
+
description: `Count tokens from stored text for a suite's unmeasured samples
|
|
16
|
+
|
|
17
|
+
Backfill for rows written before the gateway recorded usage. For samples of the suite's completed runs that have answer or reasoning text but no token figure, counts prompt, reasoning and answer tokens from the stored text (tiktoken o200k_base, one ruler for every model), marks them \`tokens_estimated\`, and refreshes each run's per-task \`tokens\` and run totals so the leaderboard's efficiency figures appear. Processes \`limit\` runs per call, oldest run id first; call again until \`remaining_runs\` is 0. Samples the provider or the import already measured are left alone, and a sample with no text stays unmeasured. New rows get the same figures at generation or import time, so this is a no-op on a suite with nothing to measure.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await llmEvalsMeasureSuiteTokens(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -57,6 +57,10 @@ export type EvalSampleObject = {
|
|
|
57
57
|
* The share of `output_tokens` the provider attributed to reasoning. Null when it reported no split.
|
|
58
58
|
*/
|
|
59
59
|
reasoningTokens: number | null;
|
|
60
|
+
/**
|
|
61
|
+
* True when the token figures were counted from the stored text by the gateway (tiktoken o200k_base, one ruler for every model) because neither the provider nor the imported row reported usage. Comparable verbosity, not a billing count.
|
|
62
|
+
*/
|
|
63
|
+
tokensEstimated: boolean;
|
|
60
64
|
/**
|
|
61
65
|
* Per-phase wall clock for a harness trial: `environment_setup`, `agent_setup`, `agent_execution`, `verifier`, each `{ started_at, finished_at }` as ISO 8601 timestamps exactly as the harness recorded them. A phase the harness did not time is absent rather than null. Drives the trial timing bar. Null outside harness runs.
|
|
62
66
|
*/
|
|
@@ -94,6 +98,7 @@ export const EvalSampleObject$inboundSchema: z.ZodType<
|
|
|
94
98
|
output_tokens: z.nullable(z.number().int()),
|
|
95
99
|
cached_tokens: z.nullable(z.number().int()),
|
|
96
100
|
reasoning_tokens: z.nullable(z.number().int()),
|
|
101
|
+
tokens_estimated: z.boolean(),
|
|
97
102
|
phase_timings: z.nullable(z.record(z.any())),
|
|
98
103
|
created_at: z.number().int(),
|
|
99
104
|
started_at: z.nullable(z.number().int()),
|
|
@@ -112,6 +117,7 @@ export const EvalSampleObject$inboundSchema: z.ZodType<
|
|
|
112
117
|
"output_tokens": "outputTokens",
|
|
113
118
|
"cached_tokens": "cachedTokens",
|
|
114
119
|
"reasoning_tokens": "reasoningTokens",
|
|
120
|
+
"tokens_estimated": "tokensEstimated",
|
|
115
121
|
"phase_timings": "phaseTimings",
|
|
116
122
|
"created_at": "createdAt",
|
|
117
123
|
"started_at": "startedAt",
|
|
@@ -142,6 +148,7 @@ export type EvalSampleObject$Outbound = {
|
|
|
142
148
|
output_tokens: number | null;
|
|
143
149
|
cached_tokens: number | null;
|
|
144
150
|
reasoning_tokens: number | null;
|
|
151
|
+
tokens_estimated: boolean;
|
|
145
152
|
phase_timings: { [k: string]: any } | null;
|
|
146
153
|
created_at: number;
|
|
147
154
|
started_at: number | null;
|
|
@@ -176,6 +183,7 @@ export const EvalSampleObject$outboundSchema: z.ZodType<
|
|
|
176
183
|
outputTokens: z.nullable(z.number().int()),
|
|
177
184
|
cachedTokens: z.nullable(z.number().int()),
|
|
178
185
|
reasoningTokens: z.nullable(z.number().int()),
|
|
186
|
+
tokensEstimated: z.boolean(),
|
|
179
187
|
phaseTimings: z.nullable(z.record(z.any())),
|
|
180
188
|
createdAt: z.number().int(),
|
|
181
189
|
startedAt: z.nullable(z.number().int()),
|
|
@@ -194,6 +202,7 @@ export const EvalSampleObject$outboundSchema: z.ZodType<
|
|
|
194
202
|
outputTokens: "output_tokens",
|
|
195
203
|
cachedTokens: "cached_tokens",
|
|
196
204
|
reasoningTokens: "reasoning_tokens",
|
|
205
|
+
tokensEstimated: "tokens_estimated",
|
|
197
206
|
phaseTimings: "phase_timings",
|
|
198
207
|
createdAt: "created_at",
|
|
199
208
|
startedAt: "started_at",
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type EvalSuiteTokenMeasurement = {
|
|
12
|
+
object: "eval.suite.token_measurement";
|
|
13
|
+
suiteId: string;
|
|
14
|
+
/**
|
|
15
|
+
* Runs whose samples were counted in this call.
|
|
16
|
+
*/
|
|
17
|
+
measuredRuns: number;
|
|
18
|
+
/**
|
|
19
|
+
* Samples that gained token figures in this call.
|
|
20
|
+
*/
|
|
21
|
+
measuredSamples: number;
|
|
22
|
+
/**
|
|
23
|
+
* Runs of the suite that still have samples with text but no token figure, after this call.
|
|
24
|
+
*/
|
|
25
|
+
remainingRuns: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const EvalSuiteTokenMeasurement$inboundSchema: z.ZodType<
|
|
30
|
+
EvalSuiteTokenMeasurement,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
unknown
|
|
33
|
+
> = z.object({
|
|
34
|
+
object: z.literal("eval.suite.token_measurement"),
|
|
35
|
+
suite_id: z.string(),
|
|
36
|
+
measured_runs: z.number().int(),
|
|
37
|
+
measured_samples: z.number().int(),
|
|
38
|
+
remaining_runs: z.number().int(),
|
|
39
|
+
}).transform((v) => {
|
|
40
|
+
return remap$(v, {
|
|
41
|
+
"suite_id": "suiteId",
|
|
42
|
+
"measured_runs": "measuredRuns",
|
|
43
|
+
"measured_samples": "measuredSamples",
|
|
44
|
+
"remaining_runs": "remainingRuns",
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
/** @internal */
|
|
48
|
+
export type EvalSuiteTokenMeasurement$Outbound = {
|
|
49
|
+
object: "eval.suite.token_measurement";
|
|
50
|
+
suite_id: string;
|
|
51
|
+
measured_runs: number;
|
|
52
|
+
measured_samples: number;
|
|
53
|
+
remaining_runs: number;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** @internal */
|
|
57
|
+
export const EvalSuiteTokenMeasurement$outboundSchema: z.ZodType<
|
|
58
|
+
EvalSuiteTokenMeasurement$Outbound,
|
|
59
|
+
z.ZodTypeDef,
|
|
60
|
+
EvalSuiteTokenMeasurement
|
|
61
|
+
> = z.object({
|
|
62
|
+
object: z.literal("eval.suite.token_measurement"),
|
|
63
|
+
suiteId: z.string(),
|
|
64
|
+
measuredRuns: z.number().int(),
|
|
65
|
+
measuredSamples: z.number().int(),
|
|
66
|
+
remainingRuns: z.number().int(),
|
|
67
|
+
}).transform((v) => {
|
|
68
|
+
return remap$(v, {
|
|
69
|
+
suiteId: "suite_id",
|
|
70
|
+
measuredRuns: "measured_runs",
|
|
71
|
+
measuredSamples: "measured_samples",
|
|
72
|
+
remainingRuns: "remaining_runs",
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export function evalSuiteTokenMeasurementToJSON(
|
|
77
|
+
evalSuiteTokenMeasurement: EvalSuiteTokenMeasurement,
|
|
78
|
+
): string {
|
|
79
|
+
return JSON.stringify(
|
|
80
|
+
EvalSuiteTokenMeasurement$outboundSchema.parse(evalSuiteTokenMeasurement),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
export function evalSuiteTokenMeasurementFromJSON(
|
|
84
|
+
jsonString: string,
|
|
85
|
+
): SafeParseResult<EvalSuiteTokenMeasurement, SDKValidationError> {
|
|
86
|
+
return safeParse(
|
|
87
|
+
jsonString,
|
|
88
|
+
(x) => EvalSuiteTokenMeasurement$inboundSchema.parse(JSON.parse(x)),
|
|
89
|
+
`Failed to parse 'EvalSuiteTokenMeasurement' from JSON`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -291,6 +291,7 @@ export * from "./evalsuiteleaderboard.js";
|
|
|
291
291
|
export * from "./evalsuitelist.js";
|
|
292
292
|
export * from "./evalsuitemanifest.js";
|
|
293
293
|
export * from "./evalsuiteobject.js";
|
|
294
|
+
export * from "./evalsuitetokenmeasurement.js";
|
|
294
295
|
export * from "./evaltask.js";
|
|
295
296
|
export * from "./evaltasktype.js";
|
|
296
297
|
export * from "./event.js";
|
|
@@ -455,6 +456,7 @@ export * from "./mcptoolcallwithid.js";
|
|
|
455
456
|
export * from "./mcptoolchoice.js";
|
|
456
457
|
export * from "./mcptooldefinition.js";
|
|
457
458
|
export * from "./mcptoolfilter.js";
|
|
459
|
+
export * from "./measureevalsuitetokensbody.js";
|
|
458
460
|
export * from "./memoryentry.js";
|
|
459
461
|
export * from "./memoryentrydeleted.js";
|
|
460
462
|
export * from "./memoryentrylist.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type MeasureEvalSuiteTokensBody = {
|
|
11
|
+
/**
|
|
12
|
+
* How many runs to measure in this call. Call again until `remaining_runs` is 0.
|
|
13
|
+
*/
|
|
14
|
+
limit?: number | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const MeasureEvalSuiteTokensBody$inboundSchema: z.ZodType<
|
|
19
|
+
MeasureEvalSuiteTokensBody,
|
|
20
|
+
z.ZodTypeDef,
|
|
21
|
+
unknown
|
|
22
|
+
> = z.object({
|
|
23
|
+
limit: z.number().int().default(5),
|
|
24
|
+
});
|
|
25
|
+
/** @internal */
|
|
26
|
+
export type MeasureEvalSuiteTokensBody$Outbound = {
|
|
27
|
+
limit: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const MeasureEvalSuiteTokensBody$outboundSchema: z.ZodType<
|
|
32
|
+
MeasureEvalSuiteTokensBody$Outbound,
|
|
33
|
+
z.ZodTypeDef,
|
|
34
|
+
MeasureEvalSuiteTokensBody
|
|
35
|
+
> = z.object({
|
|
36
|
+
limit: z.number().int().default(5),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export function measureEvalSuiteTokensBodyToJSON(
|
|
40
|
+
measureEvalSuiteTokensBody: MeasureEvalSuiteTokensBody,
|
|
41
|
+
): string {
|
|
42
|
+
return JSON.stringify(
|
|
43
|
+
MeasureEvalSuiteTokensBody$outboundSchema.parse(measureEvalSuiteTokensBody),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
export function measureEvalSuiteTokensBodyFromJSON(
|
|
47
|
+
jsonString: string,
|
|
48
|
+
): SafeParseResult<MeasureEvalSuiteTokensBody, SDKValidationError> {
|
|
49
|
+
return safeParse(
|
|
50
|
+
jsonString,
|
|
51
|
+
(x) => MeasureEvalSuiteTokensBody$inboundSchema.parse(JSON.parse(x)),
|
|
52
|
+
`Failed to parse 'MeasureEvalSuiteTokensBody' from JSON`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -338,6 +338,7 @@ export * from "./livekittoken.js";
|
|
|
338
338
|
export * from "./llmcheck.js";
|
|
339
339
|
export * from "./llmgrant.js";
|
|
340
340
|
export * from "./llmrevoke.js";
|
|
341
|
+
export * from "./measureevalsuitetokens.js";
|
|
341
342
|
export * from "./modifyvectorstore.js";
|
|
342
343
|
export * from "./patchrepo.js";
|
|
343
344
|
export * from "./pauseagentschedule.js";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as components from "../components/index.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export type MeasureEvalSuiteTokensRequest = {
|
|
13
|
+
suiteId: string;
|
|
14
|
+
/**
|
|
15
|
+
* Optional external end-user identifier forwarded by the API gateway.
|
|
16
|
+
*/
|
|
17
|
+
xOnBehalfOf?: string | undefined;
|
|
18
|
+
measureEvalSuiteTokensBody: components.MeasureEvalSuiteTokensBody;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const MeasureEvalSuiteTokensRequest$inboundSchema: z.ZodType<
|
|
23
|
+
MeasureEvalSuiteTokensRequest,
|
|
24
|
+
z.ZodTypeDef,
|
|
25
|
+
unknown
|
|
26
|
+
> = z.object({
|
|
27
|
+
suite_id: z.string(),
|
|
28
|
+
"X-On-Behalf-Of": z.string().optional(),
|
|
29
|
+
MeasureEvalSuiteTokensBody:
|
|
30
|
+
components.MeasureEvalSuiteTokensBody$inboundSchema,
|
|
31
|
+
}).transform((v) => {
|
|
32
|
+
return remap$(v, {
|
|
33
|
+
"suite_id": "suiteId",
|
|
34
|
+
"X-On-Behalf-Of": "xOnBehalfOf",
|
|
35
|
+
"MeasureEvalSuiteTokensBody": "measureEvalSuiteTokensBody",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
/** @internal */
|
|
39
|
+
export type MeasureEvalSuiteTokensRequest$Outbound = {
|
|
40
|
+
suite_id: string;
|
|
41
|
+
"X-On-Behalf-Of"?: string | undefined;
|
|
42
|
+
MeasureEvalSuiteTokensBody: components.MeasureEvalSuiteTokensBody$Outbound;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const MeasureEvalSuiteTokensRequest$outboundSchema: z.ZodType<
|
|
47
|
+
MeasureEvalSuiteTokensRequest$Outbound,
|
|
48
|
+
z.ZodTypeDef,
|
|
49
|
+
MeasureEvalSuiteTokensRequest
|
|
50
|
+
> = z.object({
|
|
51
|
+
suiteId: z.string(),
|
|
52
|
+
xOnBehalfOf: z.string().optional(),
|
|
53
|
+
measureEvalSuiteTokensBody:
|
|
54
|
+
components.MeasureEvalSuiteTokensBody$outboundSchema,
|
|
55
|
+
}).transform((v) => {
|
|
56
|
+
return remap$(v, {
|
|
57
|
+
suiteId: "suite_id",
|
|
58
|
+
xOnBehalfOf: "X-On-Behalf-Of",
|
|
59
|
+
measureEvalSuiteTokensBody: "MeasureEvalSuiteTokensBody",
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export function measureEvalSuiteTokensRequestToJSON(
|
|
64
|
+
measureEvalSuiteTokensRequest: MeasureEvalSuiteTokensRequest,
|
|
65
|
+
): string {
|
|
66
|
+
return JSON.stringify(
|
|
67
|
+
MeasureEvalSuiteTokensRequest$outboundSchema.parse(
|
|
68
|
+
measureEvalSuiteTokensRequest,
|
|
69
|
+
),
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
export function measureEvalSuiteTokensRequestFromJSON(
|
|
73
|
+
jsonString: string,
|
|
74
|
+
): SafeParseResult<MeasureEvalSuiteTokensRequest, SDKValidationError> {
|
|
75
|
+
return safeParse(
|
|
76
|
+
jsonString,
|
|
77
|
+
(x) => MeasureEvalSuiteTokensRequest$inboundSchema.parse(JSON.parse(x)),
|
|
78
|
+
`Failed to parse 'MeasureEvalSuiteTokensRequest' from JSON`,
|
|
79
|
+
);
|
|
80
|
+
}
|
package/src/react-query/index.ts
CHANGED
|
@@ -245,6 +245,7 @@ export * from "./llmEvalsListSchedules.js";
|
|
|
245
245
|
export * from "./llmEvalsListSuiteLeaderboardRuns.js";
|
|
246
246
|
export * from "./llmEvalsListSuites.js";
|
|
247
247
|
export * from "./llmEvalsListSuiteVersions.js";
|
|
248
|
+
export * from "./llmEvalsMeasureSuiteTokens.js";
|
|
248
249
|
export * from "./llmEvalsRerunFailedSamples.js";
|
|
249
250
|
export * from "./llmEvalsRetryFailedRun.js";
|
|
250
251
|
export * from "./llmEvalsTriggerSchedule.js";
|