pareta 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -67
- package/dist/index.cjs +75 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +103 -115
- package/dist/index.d.ts +103 -115
- package/dist/index.mjs +75 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -11,9 +11,8 @@ interface SSEEvent {
|
|
|
11
11
|
* typed layer.
|
|
12
12
|
*
|
|
13
13
|
* Alias / D3 boundary (a BACKEND contract, the SDK adds no alias logic):
|
|
14
|
-
* `
|
|
15
|
-
*
|
|
16
|
-
* never cross. Frontier (vendor) ids are in the clear.
|
|
14
|
+
* `EvalResult.modelId` and `run.candidateModels` are per-task PUBLIC aliases —
|
|
15
|
+
* real open-weights ids never cross. Frontier (vendor) ids are in the clear.
|
|
17
16
|
*/
|
|
18
17
|
type Raw = Record<string, any>;
|
|
19
18
|
/** Base: holds the raw payload, dict-style escape hatches. */
|
|
@@ -63,19 +62,6 @@ declare class ModelList extends BaseModel implements Iterable<Model> {
|
|
|
63
62
|
get length(): number;
|
|
64
63
|
[Symbol.iterator](): Iterator<Model>;
|
|
65
64
|
}
|
|
66
|
-
/**
|
|
67
|
-
* A deployed endpoint. `id` (== name) is what you pass to
|
|
68
|
-
* `chat.completions.create({ model })`. `model` is the per-task public alias.
|
|
69
|
-
*/
|
|
70
|
-
declare class Endpoint extends BaseModel {
|
|
71
|
-
get id(): string | null;
|
|
72
|
-
get name(): string | null;
|
|
73
|
-
get model(): string | null;
|
|
74
|
-
get status(): string | null;
|
|
75
|
-
get task(): string | null;
|
|
76
|
-
get url(): string | null;
|
|
77
|
-
get isLive(): boolean;
|
|
78
|
-
}
|
|
79
65
|
declare class Task extends BaseModel {
|
|
80
66
|
get id(): string | null;
|
|
81
67
|
get defaultScorer(): string | null;
|
|
@@ -102,6 +88,17 @@ declare class EvalSet extends BaseModel {
|
|
|
102
88
|
get itemCount(): number | null;
|
|
103
89
|
get scoringStrategy(): string | null;
|
|
104
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* One scored item inside `EvalResult.perItem`. `prediction` is the model's raw
|
|
93
|
+
* output, truncated server-side — present only on items that reached scoring
|
|
94
|
+
* (not pool/build errors), there to debug a 0.0 `score` without re-running.
|
|
95
|
+
*/
|
|
96
|
+
declare class EvalItemResult extends BaseModel {
|
|
97
|
+
get idx(): number | null;
|
|
98
|
+
get score(): number | null;
|
|
99
|
+
get prediction(): string | null;
|
|
100
|
+
get error(): string | null;
|
|
101
|
+
}
|
|
105
102
|
/**
|
|
106
103
|
* One model's aggregate on an eval run. `modelId` is the per-task public alias;
|
|
107
104
|
* `kind` ('open' | 'frontier') is populated by the Slice-4 result schema.
|
|
@@ -115,30 +112,15 @@ declare class EvalResult extends BaseModel {
|
|
|
115
112
|
get meanCostMicroUsd(): number | null;
|
|
116
113
|
get nSucceeded(): number | null;
|
|
117
114
|
get errorCount(): number | null;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
get name(): string | null;
|
|
121
|
-
get kind(): string | null;
|
|
122
|
-
get quality(): number | null;
|
|
123
|
-
get costPerRequestMicroUsd(): number | null;
|
|
124
|
-
get contextK(): number | null;
|
|
125
|
-
get runMode(): string | null;
|
|
126
|
-
}
|
|
127
|
-
/** Models ranked for a task. `recommended` is the deployable pick; `frontier` the baseline. */
|
|
128
|
-
declare class Leaderboard extends BaseModel {
|
|
129
|
-
get taskId(): string | null;
|
|
130
|
-
get metric(): string | null;
|
|
131
|
-
get costUnit(): string | null;
|
|
132
|
-
get recommended(): string | null;
|
|
133
|
-
get models(): LeaderboardEntry[];
|
|
134
|
-
get frontier(): LeaderboardEntry | null;
|
|
115
|
+
/** Per-item rows (idx/score/prediction/error); empty when not persisted. */
|
|
116
|
+
get perItem(): EvalItemResult[];
|
|
135
117
|
}
|
|
136
118
|
/** A vendor frontier model you can evaluate against (from the eval pool). */
|
|
137
119
|
declare class FrontierModel extends BaseModel {
|
|
138
120
|
get id(): string | null;
|
|
139
121
|
get vendor(): string | null;
|
|
140
122
|
get vision(): boolean;
|
|
141
|
-
/** Only meaningful when a task was given: it
|
|
123
|
+
/** Only meaningful when a task was given: it has benchmark results on that task. */
|
|
142
124
|
get benchmarked(): boolean;
|
|
143
125
|
}
|
|
144
126
|
/**
|
|
@@ -164,9 +146,9 @@ declare class EvalRun extends BaseModel {
|
|
|
164
146
|
/**
|
|
165
147
|
* `client.chat.completions` — OpenAI-compatible chat completions.
|
|
166
148
|
*
|
|
167
|
-
* `model` is
|
|
168
|
-
*
|
|
169
|
-
*
|
|
149
|
+
* `model` is `"auto"` — Pareta plans, routes, and verifies each request. The
|
|
150
|
+
* call is metered: a successful completion debits the org's balance; a zero
|
|
151
|
+
* balance raises `InsufficientCreditsError` (402).
|
|
170
152
|
*/
|
|
171
153
|
|
|
172
154
|
/** An OpenAI-style chat message. `content` is a string or content-block array. */
|
|
@@ -177,7 +159,7 @@ interface ChatMessage {
|
|
|
177
159
|
}
|
|
178
160
|
/** Params for `chat.completions.create`. Extra OpenAI params pass through. */
|
|
179
161
|
interface ChatCompletionCreateParams {
|
|
180
|
-
/**
|
|
162
|
+
/** `"auto"` — Pareta routes the request to the right model. */
|
|
181
163
|
model: string;
|
|
182
164
|
messages: ChatMessage[];
|
|
183
165
|
stream?: boolean;
|
|
@@ -207,10 +189,9 @@ declare class Chat {
|
|
|
207
189
|
}
|
|
208
190
|
|
|
209
191
|
/**
|
|
210
|
-
* `client.models` —
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* `Model.id` is an endpoint id usable as `chat.completions.create({ model })`.
|
|
192
|
+
* `client.models` — the OpenAI-compatible `/v1/models` list of model ids your
|
|
193
|
+
* org can call. Each `Model.id` is usable as
|
|
194
|
+
* `chat.completions.create({ model })`.
|
|
214
195
|
*/
|
|
215
196
|
|
|
216
197
|
declare class Models {
|
|
@@ -220,70 +201,8 @@ declare class Models {
|
|
|
220
201
|
}
|
|
221
202
|
|
|
222
203
|
/**
|
|
223
|
-
* `client.
|
|
224
|
-
*
|
|
225
|
-
* `deploy({ task, model })` is ergonomic: Pareta picks the GPU/serving config
|
|
226
|
-
* (you never pass hardware) and `model` defaults to the task's recommended pick.
|
|
227
|
-
* The backend resolver behind POST /v1/endpoints evolved with the discovery
|
|
228
|
-
* work — verify the deploy body against staging when wiring real deploys.
|
|
229
|
-
*/
|
|
230
|
-
|
|
231
|
-
/** Params for `endpoints.deploy`. Extra keys pass through to the deploy body. */
|
|
232
|
-
interface DeployParams {
|
|
233
|
-
/** The task id to deploy a model for. */
|
|
234
|
-
task: string;
|
|
235
|
-
/** Model alias to deploy; defaults to "recommended" (the task's top pick). */
|
|
236
|
-
model?: string;
|
|
237
|
-
/** Optional endpoint name. */
|
|
238
|
-
name?: string;
|
|
239
|
-
/** If true, block through the deploy and resolve the live Endpoint. */
|
|
240
|
-
wait?: boolean;
|
|
241
|
-
[key: string]: unknown;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* `endpoints.metrics(id).performance()` etc. Each returns the raw metric JSON
|
|
245
|
-
* (shapes vary by dimension; typed models arrive with the OpenAPI generation).
|
|
246
|
-
*/
|
|
247
|
-
declare class EndpointMetrics {
|
|
248
|
-
private readonly client;
|
|
249
|
-
private readonly id;
|
|
250
|
-
constructor(client: Transport, id: string);
|
|
251
|
-
performance(params?: Record<string, unknown>): Promise<unknown>;
|
|
252
|
-
uptime(params?: Record<string, unknown>): Promise<unknown>;
|
|
253
|
-
cost(params?: Record<string, unknown>): Promise<unknown>;
|
|
254
|
-
quality(params?: Record<string, unknown>): Promise<unknown>;
|
|
255
|
-
activity(params?: Record<string, unknown>): Promise<unknown>;
|
|
256
|
-
}
|
|
257
|
-
declare class Endpoints {
|
|
258
|
-
private readonly client;
|
|
259
|
-
constructor(client: Transport);
|
|
260
|
-
/**
|
|
261
|
-
* Deploy a model for a task. `wait: false` (default) → an `AsyncIterable` of
|
|
262
|
-
* progress events (`{event, data}`); the terminal event is `complete`
|
|
263
|
-
* (`data.endpoint`) or `error`. `wait: true` → resolves the live `Endpoint`
|
|
264
|
-
* (throws `ParetaError` on a deploy `error` event).
|
|
265
|
-
*/
|
|
266
|
-
deploy(params: DeployParams & {
|
|
267
|
-
wait: true;
|
|
268
|
-
}): Promise<Endpoint>;
|
|
269
|
-
deploy(params: DeployParams & {
|
|
270
|
-
wait?: false;
|
|
271
|
-
}): AsyncIterable<SSEEvent>;
|
|
272
|
-
private waitForDeploy;
|
|
273
|
-
list(): Promise<Endpoint[]>;
|
|
274
|
-
retrieve(endpointId: string): Promise<Endpoint>;
|
|
275
|
-
start(endpointId: string): Promise<unknown>;
|
|
276
|
-
stop(endpointId: string): Promise<unknown>;
|
|
277
|
-
delete(endpointId: string): Promise<void>;
|
|
278
|
-
metrics(endpointId: string): EndpointMetrics;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* `client.tasks` — browse the benchmark catalog + match free-text intent, and
|
|
283
|
-
* the per-task discovery surface (leaderboard / recommended).
|
|
284
|
-
*
|
|
285
|
-
* Unlike the Python SDK (where `leaderboard`/`recommended` exist only on the
|
|
286
|
-
* sync client), these are present uniformly here — JS has one client.
|
|
204
|
+
* `client.tasks` — browse the benchmark catalog and match free-text intent to
|
|
205
|
+
* a task (`match` is the discovery surface: it tells you what Pareta can do).
|
|
287
206
|
*/
|
|
288
207
|
|
|
289
208
|
declare class Tasks {
|
|
@@ -297,10 +216,6 @@ declare class Tasks {
|
|
|
297
216
|
match(query: string, opts?: {
|
|
298
217
|
topK?: number;
|
|
299
218
|
}): Promise<TaskMatch>;
|
|
300
|
-
/** Models ranked by quality/cost for a task (+ recommended + frontier baseline). */
|
|
301
|
-
leaderboard(taskId: string): Promise<Leaderboard>;
|
|
302
|
-
/** The task's recommended deployable model — what deploy(model:"recommended") resolves to. */
|
|
303
|
-
recommended(taskId: string): Promise<string | null>;
|
|
304
219
|
}
|
|
305
220
|
|
|
306
221
|
/**
|
|
@@ -378,6 +293,79 @@ declare class Evals {
|
|
|
378
293
|
frontierModels(task?: string): Promise<FrontierModel[]>;
|
|
379
294
|
}
|
|
380
295
|
|
|
296
|
+
/**
|
|
297
|
+
* `client.auto` — the routing brain's surrounding surfaces.
|
|
298
|
+
*
|
|
299
|
+
* Calling the brain itself is plain chat with `model: "auto"`:
|
|
300
|
+
*
|
|
301
|
+
* client.chat.completions.create({
|
|
302
|
+
* model: "auto",
|
|
303
|
+
* messages: [{ role: "user", content: "…" }],
|
|
304
|
+
* })
|
|
305
|
+
*
|
|
306
|
+
* This resource carries the org-level metrics rollup (requests, success,
|
|
307
|
+
* spend, PROJECTED savings vs frontier) and the metered frontier comparison
|
|
308
|
+
* the Playground uses.
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
interface AutoMetrics {
|
|
312
|
+
requests_30d: number;
|
|
313
|
+
requests_today: number;
|
|
314
|
+
success_rate_30d: number | null;
|
|
315
|
+
billed_micro_usd_30d: number;
|
|
316
|
+
billed_micro_usd_today: number;
|
|
317
|
+
cost_to_serve_micro_usd_30d: number;
|
|
318
|
+
/** PROJECTED (frontier list-priced counterfactual) — labeled so until
|
|
319
|
+
* dual-run calibration lands. */
|
|
320
|
+
savings_vs_frontier_micro_usd_30d: number | null;
|
|
321
|
+
savings_multiple_30d: number | null;
|
|
322
|
+
performance_hourly_7d: Array<{
|
|
323
|
+
hour: string;
|
|
324
|
+
requests: number;
|
|
325
|
+
error_rate: number;
|
|
326
|
+
p50_ms: number | null;
|
|
327
|
+
p95_ms: number | null;
|
|
328
|
+
}>;
|
|
329
|
+
days_30d: Array<{
|
|
330
|
+
day: string;
|
|
331
|
+
n: number;
|
|
332
|
+
ok: number;
|
|
333
|
+
success_rate: number;
|
|
334
|
+
}>;
|
|
335
|
+
last_request: {
|
|
336
|
+
created_at: string;
|
|
337
|
+
status_code: number;
|
|
338
|
+
duration_ms: number;
|
|
339
|
+
billed_micro_usd: number | null;
|
|
340
|
+
cost_to_serve_micro_usd: number | null;
|
|
341
|
+
} | null;
|
|
342
|
+
}
|
|
343
|
+
interface FrontierComparison {
|
|
344
|
+
model: string;
|
|
345
|
+
content: string;
|
|
346
|
+
cost_micro_usd: number;
|
|
347
|
+
latency_ms: number;
|
|
348
|
+
}
|
|
349
|
+
declare class Auto {
|
|
350
|
+
private readonly client;
|
|
351
|
+
constructor(client: Transport);
|
|
352
|
+
/** Your org's `model: "auto"` traffic, rolled up. Read-only, free. */
|
|
353
|
+
metrics(): Promise<AutoMetrics>;
|
|
354
|
+
/**
|
|
355
|
+
* One prompt against a frontier vendor for a side-by-side with
|
|
356
|
+
* `model: "auto"` — METERED at the vendor's actual token cost (a failed
|
|
357
|
+
* vendor call bills $0). Allowed models: gpt-5.5, gemini-3-5-flash,
|
|
358
|
+
* gemini-3-1-pro, claude-sonnet-4-6.
|
|
359
|
+
*/
|
|
360
|
+
compareFrontier(params: {
|
|
361
|
+
model: string;
|
|
362
|
+
messages: Array<{
|
|
363
|
+
role: string;
|
|
364
|
+
content: string;
|
|
365
|
+
}>;
|
|
366
|
+
}): Promise<FrontierComparison>;
|
|
367
|
+
}
|
|
368
|
+
|
|
381
369
|
/**
|
|
382
370
|
* The `Pareta` client — one class (no sync/async split; JS is Promise-only).
|
|
383
371
|
* A faithful port of the Python `_client.py` transport: header construction,
|
|
@@ -429,9 +417,9 @@ declare class Pareta implements Transport {
|
|
|
429
417
|
private readonly fetchImpl;
|
|
430
418
|
readonly chat: Chat;
|
|
431
419
|
readonly models: Models;
|
|
432
|
-
readonly endpoints: Endpoints;
|
|
433
420
|
readonly tasks: Tasks;
|
|
434
421
|
readonly evals: Evals;
|
|
422
|
+
readonly auto: Auto;
|
|
435
423
|
constructor(options?: ParetaOptions);
|
|
436
424
|
/** Build from PARETA_API_KEY (+ optional PARETA_BASE_URL); explicit opts win. */
|
|
437
425
|
static fromEnv(options?: ParetaOptions): Pareta;
|
|
@@ -450,12 +438,12 @@ declare class Pareta implements Transport {
|
|
|
450
438
|
/**
|
|
451
439
|
* Yield parsed SSE objects. Retries ONLY the initial connect/handshake — once
|
|
452
440
|
* bytes are flowing a mid-stream drop raises (re-issuing would re-run a
|
|
453
|
-
* metered generation
|
|
441
|
+
* metered generation). `events:true` → `{event,data}`.
|
|
454
442
|
*/
|
|
455
443
|
stream<T = unknown>(method: string, path: string, opts?: StreamOptions): AsyncGenerator<T>;
|
|
456
444
|
}
|
|
457
445
|
|
|
458
|
-
declare const VERSION = "
|
|
446
|
+
declare const VERSION = "1.0.0";
|
|
459
447
|
|
|
460
448
|
/**
|
|
461
449
|
* Typed error hierarchy for the Pareta SDK — a faithful port of the Python
|
|
@@ -470,7 +458,7 @@ declare const VERSION = "0.1.0";
|
|
|
470
458
|
* 402 → InsufficientCreditsError ("organization is out of credit…")
|
|
471
459
|
* 403 → PermissionDeniedError
|
|
472
460
|
* 404 → NotFoundError
|
|
473
|
-
* 409 → ConflictError (
|
|
461
|
+
* 409 → ConflictError (resource conflict / not servable)
|
|
474
462
|
* 422 → BadRequestError (FastAPI validation; `detail` is an array)
|
|
475
463
|
* 429 → RateLimitError
|
|
476
464
|
* 503 → EndpointNotReadyError (stopped / cold / provider down)
|
|
@@ -547,4 +535,4 @@ declare class EndpointNotReadyError extends APIStatusError {
|
|
|
547
535
|
constructor(message: string, init: APIStatusErrorInit);
|
|
548
536
|
}
|
|
549
537
|
|
|
550
|
-
export { APIConnectionError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, type ChatCompletionCreateParams, type ChatMessage, Choice, ConflictError,
|
|
538
|
+
export { APIConnectionError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, type ChatCompletionCreateParams, type ChatMessage, Choice, ConflictError, EndpointNotReadyError, type ErrorDetail, EvalItemResult, EvalResult, EvalRun, type EvalRunCreateParams, EvalRuns, EvalSet, EvalSets, type FileInput, type FilePart, FrontierModel, type FrontierSpec, InsufficientCreditsError, Message, Model, ModelList, NotFoundError, Pareta, ParetaError, type ParetaOptions, PermissionDeniedError, RateLimitError, type SSEEvent, Task, TaskMatch, TaskMatchCandidate, type Transport, Usage, VERSION, type ValidationErrorItem };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,9 +11,8 @@ interface SSEEvent {
|
|
|
11
11
|
* typed layer.
|
|
12
12
|
*
|
|
13
13
|
* Alias / D3 boundary (a BACKEND contract, the SDK adds no alias logic):
|
|
14
|
-
* `
|
|
15
|
-
*
|
|
16
|
-
* never cross. Frontier (vendor) ids are in the clear.
|
|
14
|
+
* `EvalResult.modelId` and `run.candidateModels` are per-task PUBLIC aliases —
|
|
15
|
+
* real open-weights ids never cross. Frontier (vendor) ids are in the clear.
|
|
17
16
|
*/
|
|
18
17
|
type Raw = Record<string, any>;
|
|
19
18
|
/** Base: holds the raw payload, dict-style escape hatches. */
|
|
@@ -63,19 +62,6 @@ declare class ModelList extends BaseModel implements Iterable<Model> {
|
|
|
63
62
|
get length(): number;
|
|
64
63
|
[Symbol.iterator](): Iterator<Model>;
|
|
65
64
|
}
|
|
66
|
-
/**
|
|
67
|
-
* A deployed endpoint. `id` (== name) is what you pass to
|
|
68
|
-
* `chat.completions.create({ model })`. `model` is the per-task public alias.
|
|
69
|
-
*/
|
|
70
|
-
declare class Endpoint extends BaseModel {
|
|
71
|
-
get id(): string | null;
|
|
72
|
-
get name(): string | null;
|
|
73
|
-
get model(): string | null;
|
|
74
|
-
get status(): string | null;
|
|
75
|
-
get task(): string | null;
|
|
76
|
-
get url(): string | null;
|
|
77
|
-
get isLive(): boolean;
|
|
78
|
-
}
|
|
79
65
|
declare class Task extends BaseModel {
|
|
80
66
|
get id(): string | null;
|
|
81
67
|
get defaultScorer(): string | null;
|
|
@@ -102,6 +88,17 @@ declare class EvalSet extends BaseModel {
|
|
|
102
88
|
get itemCount(): number | null;
|
|
103
89
|
get scoringStrategy(): string | null;
|
|
104
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* One scored item inside `EvalResult.perItem`. `prediction` is the model's raw
|
|
93
|
+
* output, truncated server-side — present only on items that reached scoring
|
|
94
|
+
* (not pool/build errors), there to debug a 0.0 `score` without re-running.
|
|
95
|
+
*/
|
|
96
|
+
declare class EvalItemResult extends BaseModel {
|
|
97
|
+
get idx(): number | null;
|
|
98
|
+
get score(): number | null;
|
|
99
|
+
get prediction(): string | null;
|
|
100
|
+
get error(): string | null;
|
|
101
|
+
}
|
|
105
102
|
/**
|
|
106
103
|
* One model's aggregate on an eval run. `modelId` is the per-task public alias;
|
|
107
104
|
* `kind` ('open' | 'frontier') is populated by the Slice-4 result schema.
|
|
@@ -115,30 +112,15 @@ declare class EvalResult extends BaseModel {
|
|
|
115
112
|
get meanCostMicroUsd(): number | null;
|
|
116
113
|
get nSucceeded(): number | null;
|
|
117
114
|
get errorCount(): number | null;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
get name(): string | null;
|
|
121
|
-
get kind(): string | null;
|
|
122
|
-
get quality(): number | null;
|
|
123
|
-
get costPerRequestMicroUsd(): number | null;
|
|
124
|
-
get contextK(): number | null;
|
|
125
|
-
get runMode(): string | null;
|
|
126
|
-
}
|
|
127
|
-
/** Models ranked for a task. `recommended` is the deployable pick; `frontier` the baseline. */
|
|
128
|
-
declare class Leaderboard extends BaseModel {
|
|
129
|
-
get taskId(): string | null;
|
|
130
|
-
get metric(): string | null;
|
|
131
|
-
get costUnit(): string | null;
|
|
132
|
-
get recommended(): string | null;
|
|
133
|
-
get models(): LeaderboardEntry[];
|
|
134
|
-
get frontier(): LeaderboardEntry | null;
|
|
115
|
+
/** Per-item rows (idx/score/prediction/error); empty when not persisted. */
|
|
116
|
+
get perItem(): EvalItemResult[];
|
|
135
117
|
}
|
|
136
118
|
/** A vendor frontier model you can evaluate against (from the eval pool). */
|
|
137
119
|
declare class FrontierModel extends BaseModel {
|
|
138
120
|
get id(): string | null;
|
|
139
121
|
get vendor(): string | null;
|
|
140
122
|
get vision(): boolean;
|
|
141
|
-
/** Only meaningful when a task was given: it
|
|
123
|
+
/** Only meaningful when a task was given: it has benchmark results on that task. */
|
|
142
124
|
get benchmarked(): boolean;
|
|
143
125
|
}
|
|
144
126
|
/**
|
|
@@ -164,9 +146,9 @@ declare class EvalRun extends BaseModel {
|
|
|
164
146
|
/**
|
|
165
147
|
* `client.chat.completions` — OpenAI-compatible chat completions.
|
|
166
148
|
*
|
|
167
|
-
* `model` is
|
|
168
|
-
*
|
|
169
|
-
*
|
|
149
|
+
* `model` is `"auto"` — Pareta plans, routes, and verifies each request. The
|
|
150
|
+
* call is metered: a successful completion debits the org's balance; a zero
|
|
151
|
+
* balance raises `InsufficientCreditsError` (402).
|
|
170
152
|
*/
|
|
171
153
|
|
|
172
154
|
/** An OpenAI-style chat message. `content` is a string or content-block array. */
|
|
@@ -177,7 +159,7 @@ interface ChatMessage {
|
|
|
177
159
|
}
|
|
178
160
|
/** Params for `chat.completions.create`. Extra OpenAI params pass through. */
|
|
179
161
|
interface ChatCompletionCreateParams {
|
|
180
|
-
/**
|
|
162
|
+
/** `"auto"` — Pareta routes the request to the right model. */
|
|
181
163
|
model: string;
|
|
182
164
|
messages: ChatMessage[];
|
|
183
165
|
stream?: boolean;
|
|
@@ -207,10 +189,9 @@ declare class Chat {
|
|
|
207
189
|
}
|
|
208
190
|
|
|
209
191
|
/**
|
|
210
|
-
* `client.models` —
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* `Model.id` is an endpoint id usable as `chat.completions.create({ model })`.
|
|
192
|
+
* `client.models` — the OpenAI-compatible `/v1/models` list of model ids your
|
|
193
|
+
* org can call. Each `Model.id` is usable as
|
|
194
|
+
* `chat.completions.create({ model })`.
|
|
214
195
|
*/
|
|
215
196
|
|
|
216
197
|
declare class Models {
|
|
@@ -220,70 +201,8 @@ declare class Models {
|
|
|
220
201
|
}
|
|
221
202
|
|
|
222
203
|
/**
|
|
223
|
-
* `client.
|
|
224
|
-
*
|
|
225
|
-
* `deploy({ task, model })` is ergonomic: Pareta picks the GPU/serving config
|
|
226
|
-
* (you never pass hardware) and `model` defaults to the task's recommended pick.
|
|
227
|
-
* The backend resolver behind POST /v1/endpoints evolved with the discovery
|
|
228
|
-
* work — verify the deploy body against staging when wiring real deploys.
|
|
229
|
-
*/
|
|
230
|
-
|
|
231
|
-
/** Params for `endpoints.deploy`. Extra keys pass through to the deploy body. */
|
|
232
|
-
interface DeployParams {
|
|
233
|
-
/** The task id to deploy a model for. */
|
|
234
|
-
task: string;
|
|
235
|
-
/** Model alias to deploy; defaults to "recommended" (the task's top pick). */
|
|
236
|
-
model?: string;
|
|
237
|
-
/** Optional endpoint name. */
|
|
238
|
-
name?: string;
|
|
239
|
-
/** If true, block through the deploy and resolve the live Endpoint. */
|
|
240
|
-
wait?: boolean;
|
|
241
|
-
[key: string]: unknown;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* `endpoints.metrics(id).performance()` etc. Each returns the raw metric JSON
|
|
245
|
-
* (shapes vary by dimension; typed models arrive with the OpenAPI generation).
|
|
246
|
-
*/
|
|
247
|
-
declare class EndpointMetrics {
|
|
248
|
-
private readonly client;
|
|
249
|
-
private readonly id;
|
|
250
|
-
constructor(client: Transport, id: string);
|
|
251
|
-
performance(params?: Record<string, unknown>): Promise<unknown>;
|
|
252
|
-
uptime(params?: Record<string, unknown>): Promise<unknown>;
|
|
253
|
-
cost(params?: Record<string, unknown>): Promise<unknown>;
|
|
254
|
-
quality(params?: Record<string, unknown>): Promise<unknown>;
|
|
255
|
-
activity(params?: Record<string, unknown>): Promise<unknown>;
|
|
256
|
-
}
|
|
257
|
-
declare class Endpoints {
|
|
258
|
-
private readonly client;
|
|
259
|
-
constructor(client: Transport);
|
|
260
|
-
/**
|
|
261
|
-
* Deploy a model for a task. `wait: false` (default) → an `AsyncIterable` of
|
|
262
|
-
* progress events (`{event, data}`); the terminal event is `complete`
|
|
263
|
-
* (`data.endpoint`) or `error`. `wait: true` → resolves the live `Endpoint`
|
|
264
|
-
* (throws `ParetaError` on a deploy `error` event).
|
|
265
|
-
*/
|
|
266
|
-
deploy(params: DeployParams & {
|
|
267
|
-
wait: true;
|
|
268
|
-
}): Promise<Endpoint>;
|
|
269
|
-
deploy(params: DeployParams & {
|
|
270
|
-
wait?: false;
|
|
271
|
-
}): AsyncIterable<SSEEvent>;
|
|
272
|
-
private waitForDeploy;
|
|
273
|
-
list(): Promise<Endpoint[]>;
|
|
274
|
-
retrieve(endpointId: string): Promise<Endpoint>;
|
|
275
|
-
start(endpointId: string): Promise<unknown>;
|
|
276
|
-
stop(endpointId: string): Promise<unknown>;
|
|
277
|
-
delete(endpointId: string): Promise<void>;
|
|
278
|
-
metrics(endpointId: string): EndpointMetrics;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* `client.tasks` — browse the benchmark catalog + match free-text intent, and
|
|
283
|
-
* the per-task discovery surface (leaderboard / recommended).
|
|
284
|
-
*
|
|
285
|
-
* Unlike the Python SDK (where `leaderboard`/`recommended` exist only on the
|
|
286
|
-
* sync client), these are present uniformly here — JS has one client.
|
|
204
|
+
* `client.tasks` — browse the benchmark catalog and match free-text intent to
|
|
205
|
+
* a task (`match` is the discovery surface: it tells you what Pareta can do).
|
|
287
206
|
*/
|
|
288
207
|
|
|
289
208
|
declare class Tasks {
|
|
@@ -297,10 +216,6 @@ declare class Tasks {
|
|
|
297
216
|
match(query: string, opts?: {
|
|
298
217
|
topK?: number;
|
|
299
218
|
}): Promise<TaskMatch>;
|
|
300
|
-
/** Models ranked by quality/cost for a task (+ recommended + frontier baseline). */
|
|
301
|
-
leaderboard(taskId: string): Promise<Leaderboard>;
|
|
302
|
-
/** The task's recommended deployable model — what deploy(model:"recommended") resolves to. */
|
|
303
|
-
recommended(taskId: string): Promise<string | null>;
|
|
304
219
|
}
|
|
305
220
|
|
|
306
221
|
/**
|
|
@@ -378,6 +293,79 @@ declare class Evals {
|
|
|
378
293
|
frontierModels(task?: string): Promise<FrontierModel[]>;
|
|
379
294
|
}
|
|
380
295
|
|
|
296
|
+
/**
|
|
297
|
+
* `client.auto` — the routing brain's surrounding surfaces.
|
|
298
|
+
*
|
|
299
|
+
* Calling the brain itself is plain chat with `model: "auto"`:
|
|
300
|
+
*
|
|
301
|
+
* client.chat.completions.create({
|
|
302
|
+
* model: "auto",
|
|
303
|
+
* messages: [{ role: "user", content: "…" }],
|
|
304
|
+
* })
|
|
305
|
+
*
|
|
306
|
+
* This resource carries the org-level metrics rollup (requests, success,
|
|
307
|
+
* spend, PROJECTED savings vs frontier) and the metered frontier comparison
|
|
308
|
+
* the Playground uses.
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
interface AutoMetrics {
|
|
312
|
+
requests_30d: number;
|
|
313
|
+
requests_today: number;
|
|
314
|
+
success_rate_30d: number | null;
|
|
315
|
+
billed_micro_usd_30d: number;
|
|
316
|
+
billed_micro_usd_today: number;
|
|
317
|
+
cost_to_serve_micro_usd_30d: number;
|
|
318
|
+
/** PROJECTED (frontier list-priced counterfactual) — labeled so until
|
|
319
|
+
* dual-run calibration lands. */
|
|
320
|
+
savings_vs_frontier_micro_usd_30d: number | null;
|
|
321
|
+
savings_multiple_30d: number | null;
|
|
322
|
+
performance_hourly_7d: Array<{
|
|
323
|
+
hour: string;
|
|
324
|
+
requests: number;
|
|
325
|
+
error_rate: number;
|
|
326
|
+
p50_ms: number | null;
|
|
327
|
+
p95_ms: number | null;
|
|
328
|
+
}>;
|
|
329
|
+
days_30d: Array<{
|
|
330
|
+
day: string;
|
|
331
|
+
n: number;
|
|
332
|
+
ok: number;
|
|
333
|
+
success_rate: number;
|
|
334
|
+
}>;
|
|
335
|
+
last_request: {
|
|
336
|
+
created_at: string;
|
|
337
|
+
status_code: number;
|
|
338
|
+
duration_ms: number;
|
|
339
|
+
billed_micro_usd: number | null;
|
|
340
|
+
cost_to_serve_micro_usd: number | null;
|
|
341
|
+
} | null;
|
|
342
|
+
}
|
|
343
|
+
interface FrontierComparison {
|
|
344
|
+
model: string;
|
|
345
|
+
content: string;
|
|
346
|
+
cost_micro_usd: number;
|
|
347
|
+
latency_ms: number;
|
|
348
|
+
}
|
|
349
|
+
declare class Auto {
|
|
350
|
+
private readonly client;
|
|
351
|
+
constructor(client: Transport);
|
|
352
|
+
/** Your org's `model: "auto"` traffic, rolled up. Read-only, free. */
|
|
353
|
+
metrics(): Promise<AutoMetrics>;
|
|
354
|
+
/**
|
|
355
|
+
* One prompt against a frontier vendor for a side-by-side with
|
|
356
|
+
* `model: "auto"` — METERED at the vendor's actual token cost (a failed
|
|
357
|
+
* vendor call bills $0). Allowed models: gpt-5.5, gemini-3-5-flash,
|
|
358
|
+
* gemini-3-1-pro, claude-sonnet-4-6.
|
|
359
|
+
*/
|
|
360
|
+
compareFrontier(params: {
|
|
361
|
+
model: string;
|
|
362
|
+
messages: Array<{
|
|
363
|
+
role: string;
|
|
364
|
+
content: string;
|
|
365
|
+
}>;
|
|
366
|
+
}): Promise<FrontierComparison>;
|
|
367
|
+
}
|
|
368
|
+
|
|
381
369
|
/**
|
|
382
370
|
* The `Pareta` client — one class (no sync/async split; JS is Promise-only).
|
|
383
371
|
* A faithful port of the Python `_client.py` transport: header construction,
|
|
@@ -429,9 +417,9 @@ declare class Pareta implements Transport {
|
|
|
429
417
|
private readonly fetchImpl;
|
|
430
418
|
readonly chat: Chat;
|
|
431
419
|
readonly models: Models;
|
|
432
|
-
readonly endpoints: Endpoints;
|
|
433
420
|
readonly tasks: Tasks;
|
|
434
421
|
readonly evals: Evals;
|
|
422
|
+
readonly auto: Auto;
|
|
435
423
|
constructor(options?: ParetaOptions);
|
|
436
424
|
/** Build from PARETA_API_KEY (+ optional PARETA_BASE_URL); explicit opts win. */
|
|
437
425
|
static fromEnv(options?: ParetaOptions): Pareta;
|
|
@@ -450,12 +438,12 @@ declare class Pareta implements Transport {
|
|
|
450
438
|
/**
|
|
451
439
|
* Yield parsed SSE objects. Retries ONLY the initial connect/handshake — once
|
|
452
440
|
* bytes are flowing a mid-stream drop raises (re-issuing would re-run a
|
|
453
|
-
* metered generation
|
|
441
|
+
* metered generation). `events:true` → `{event,data}`.
|
|
454
442
|
*/
|
|
455
443
|
stream<T = unknown>(method: string, path: string, opts?: StreamOptions): AsyncGenerator<T>;
|
|
456
444
|
}
|
|
457
445
|
|
|
458
|
-
declare const VERSION = "
|
|
446
|
+
declare const VERSION = "1.0.0";
|
|
459
447
|
|
|
460
448
|
/**
|
|
461
449
|
* Typed error hierarchy for the Pareta SDK — a faithful port of the Python
|
|
@@ -470,7 +458,7 @@ declare const VERSION = "0.1.0";
|
|
|
470
458
|
* 402 → InsufficientCreditsError ("organization is out of credit…")
|
|
471
459
|
* 403 → PermissionDeniedError
|
|
472
460
|
* 404 → NotFoundError
|
|
473
|
-
* 409 → ConflictError (
|
|
461
|
+
* 409 → ConflictError (resource conflict / not servable)
|
|
474
462
|
* 422 → BadRequestError (FastAPI validation; `detail` is an array)
|
|
475
463
|
* 429 → RateLimitError
|
|
476
464
|
* 503 → EndpointNotReadyError (stopped / cold / provider down)
|
|
@@ -547,4 +535,4 @@ declare class EndpointNotReadyError extends APIStatusError {
|
|
|
547
535
|
constructor(message: string, init: APIStatusErrorInit);
|
|
548
536
|
}
|
|
549
537
|
|
|
550
|
-
export { APIConnectionError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, type ChatCompletionCreateParams, type ChatMessage, Choice, ConflictError,
|
|
538
|
+
export { APIConnectionError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, type ChatCompletionCreateParams, type ChatMessage, Choice, ConflictError, EndpointNotReadyError, type ErrorDetail, EvalItemResult, EvalResult, EvalRun, type EvalRunCreateParams, EvalRuns, EvalSet, EvalSets, type FileInput, type FilePart, FrontierModel, type FrontierSpec, InsufficientCreditsError, Message, Model, ModelList, NotFoundError, Pareta, ParetaError, type ParetaOptions, PermissionDeniedError, RateLimitError, type SSEEvent, Task, TaskMatch, TaskMatchCandidate, type Transport, Usage, VERSION, type ValidationErrorItem };
|