pareta 0.2.1 → 1.1.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 +4 -15
- package/dist/index.cjs +113 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -125
- package/dist/index.d.ts +72 -125
- package/dist/index.mjs +111 -195
- 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,29 +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
|
-
/** Structured-extraction endpoints (contract / SEC / ICD …): the system prompt
|
|
79
|
-
* the benchmark used. The proxy applies it automatically when you send no
|
|
80
|
-
* `system` message (so quality matches the leaderboard by default); returned
|
|
81
|
-
* here so you can read it, or override it with your own `system` message.
|
|
82
|
-
* `null` when the task has no injectable prompt (see `promptScaffold`). */
|
|
83
|
-
get recommendedSystemPrompt(): string | null;
|
|
84
|
-
/** Fixed-label classification endpoints: a copy-and-customize `system` prompt
|
|
85
|
-
* template. NEVER auto-applied — the categories are yours, not the benchmark's
|
|
86
|
-
* — so fill them in and send it as your `system` message. `null` otherwise. */
|
|
87
|
-
get promptScaffold(): string | null;
|
|
88
|
-
}
|
|
89
65
|
declare class Task extends BaseModel {
|
|
90
66
|
get id(): string | null;
|
|
91
67
|
get defaultScorer(): string | null;
|
|
@@ -139,29 +115,12 @@ declare class EvalResult extends BaseModel {
|
|
|
139
115
|
/** Per-item rows (idx/score/prediction/error); empty when not persisted. */
|
|
140
116
|
get perItem(): EvalItemResult[];
|
|
141
117
|
}
|
|
142
|
-
declare class LeaderboardEntry extends BaseModel {
|
|
143
|
-
get name(): string | null;
|
|
144
|
-
get kind(): string | null;
|
|
145
|
-
get quality(): number | null;
|
|
146
|
-
get costPerRequestMicroUsd(): number | null;
|
|
147
|
-
get contextK(): number | null;
|
|
148
|
-
get runMode(): string | null;
|
|
149
|
-
}
|
|
150
|
-
/** Models ranked for a task. `recommended` is the deployable pick; `frontier` the baseline. */
|
|
151
|
-
declare class Leaderboard extends BaseModel {
|
|
152
|
-
get taskId(): string | null;
|
|
153
|
-
get metric(): string | null;
|
|
154
|
-
get costUnit(): string | null;
|
|
155
|
-
get recommended(): string | null;
|
|
156
|
-
get models(): LeaderboardEntry[];
|
|
157
|
-
get frontier(): LeaderboardEntry | null;
|
|
158
|
-
}
|
|
159
118
|
/** A vendor frontier model you can evaluate against (from the eval pool). */
|
|
160
119
|
declare class FrontierModel extends BaseModel {
|
|
161
120
|
get id(): string | null;
|
|
162
121
|
get vendor(): string | null;
|
|
163
122
|
get vision(): boolean;
|
|
164
|
-
/** Only meaningful when a task was given: it
|
|
123
|
+
/** Only meaningful when a task was given: it has benchmark results on that task. */
|
|
165
124
|
get benchmarked(): boolean;
|
|
166
125
|
}
|
|
167
126
|
/**
|
|
@@ -183,13 +142,37 @@ declare class EvalRun extends BaseModel {
|
|
|
183
142
|
get cost(): string;
|
|
184
143
|
get results(): EvalResult[];
|
|
185
144
|
}
|
|
145
|
+
/** One row of `Rerank.results` — a document's position + calibrated score. */
|
|
146
|
+
declare class RerankResult extends BaseModel {
|
|
147
|
+
/** Position of this document in YOUR request's documents array. */
|
|
148
|
+
get index(): number;
|
|
149
|
+
/** Calibrated P(relevant) in (0, 1) — thresholdable, not just ordinal. */
|
|
150
|
+
get relevanceScore(): number;
|
|
151
|
+
}
|
|
152
|
+
/** Result of `pa.rerank(...)`: `.results` ordered most-relevant-first;
|
|
153
|
+
* `.pairs` is the number of documents scored (the metered unit). */
|
|
154
|
+
declare class Rerank extends BaseModel {
|
|
155
|
+
get results(): RerankResult[];
|
|
156
|
+
get model(): string | null;
|
|
157
|
+
get pairs(): number | null;
|
|
158
|
+
/** Map the ranked indices back onto the documents you sent — best first. */
|
|
159
|
+
topDocuments(documents: string[]): string[];
|
|
160
|
+
}
|
|
161
|
+
/** Result of `pa.embeddings(...)`: unit-normalized vectors in input order
|
|
162
|
+
* (cosine similarity is a plain dot product); `.promptTokens` is metered. */
|
|
163
|
+
declare class Embeddings extends BaseModel {
|
|
164
|
+
get vectors(): number[][];
|
|
165
|
+
get model(): string | null;
|
|
166
|
+
get promptTokens(): number | null;
|
|
167
|
+
get length(): number;
|
|
168
|
+
}
|
|
186
169
|
|
|
187
170
|
/**
|
|
188
171
|
* `client.chat.completions` — OpenAI-compatible chat completions.
|
|
189
172
|
*
|
|
190
|
-
* `model` is
|
|
191
|
-
*
|
|
192
|
-
*
|
|
173
|
+
* `model` is `"auto"` — Pareta plans, routes, and verifies each request. The
|
|
174
|
+
* call is metered: a successful completion debits the org's balance; a zero
|
|
175
|
+
* balance raises `InsufficientCreditsError` (402).
|
|
193
176
|
*/
|
|
194
177
|
|
|
195
178
|
/** An OpenAI-style chat message. `content` is a string or content-block array. */
|
|
@@ -200,7 +183,7 @@ interface ChatMessage {
|
|
|
200
183
|
}
|
|
201
184
|
/** Params for `chat.completions.create`. Extra OpenAI params pass through. */
|
|
202
185
|
interface ChatCompletionCreateParams {
|
|
203
|
-
/**
|
|
186
|
+
/** `"auto"` — Pareta routes the request to the right model. */
|
|
204
187
|
model: string;
|
|
205
188
|
messages: ChatMessage[];
|
|
206
189
|
stream?: boolean;
|
|
@@ -230,10 +213,9 @@ declare class Chat {
|
|
|
230
213
|
}
|
|
231
214
|
|
|
232
215
|
/**
|
|
233
|
-
* `client.models` —
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* `Model.id` is an endpoint id usable as `chat.completions.create({ model })`.
|
|
216
|
+
* `client.models` — the OpenAI-compatible `/v1/models` list of model ids your
|
|
217
|
+
* org can call. Each `Model.id` is usable as
|
|
218
|
+
* `chat.completions.create({ model })`.
|
|
237
219
|
*/
|
|
238
220
|
|
|
239
221
|
declare class Models {
|
|
@@ -243,70 +225,8 @@ declare class Models {
|
|
|
243
225
|
}
|
|
244
226
|
|
|
245
227
|
/**
|
|
246
|
-
* `client.
|
|
247
|
-
*
|
|
248
|
-
* `deploy({ task, model })` is ergonomic: Pareta picks the GPU/serving config
|
|
249
|
-
* (you never pass hardware) and `model` defaults to the task's recommended pick.
|
|
250
|
-
* The backend resolver behind POST /v1/endpoints evolved with the discovery
|
|
251
|
-
* work — verify the deploy body against staging when wiring real deploys.
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
/** Params for `endpoints.deploy`. Extra keys pass through to the deploy body. */
|
|
255
|
-
interface DeployParams {
|
|
256
|
-
/** The task id to deploy a model for. */
|
|
257
|
-
task: string;
|
|
258
|
-
/** Model alias to deploy; defaults to "recommended" (the task's top pick). */
|
|
259
|
-
model?: string;
|
|
260
|
-
/** Optional endpoint name. */
|
|
261
|
-
name?: string;
|
|
262
|
-
/** If true, block through the deploy and resolve the live Endpoint. */
|
|
263
|
-
wait?: boolean;
|
|
264
|
-
[key: string]: unknown;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* `endpoints.metrics(id).performance()` etc. Each returns the raw metric JSON
|
|
268
|
-
* (shapes vary by dimension; typed models arrive with the OpenAPI generation).
|
|
269
|
-
*/
|
|
270
|
-
declare class EndpointMetrics {
|
|
271
|
-
private readonly client;
|
|
272
|
-
private readonly id;
|
|
273
|
-
constructor(client: Transport, id: string);
|
|
274
|
-
performance(params?: Record<string, unknown>): Promise<unknown>;
|
|
275
|
-
uptime(params?: Record<string, unknown>): Promise<unknown>;
|
|
276
|
-
cost(params?: Record<string, unknown>): Promise<unknown>;
|
|
277
|
-
quality(params?: Record<string, unknown>): Promise<unknown>;
|
|
278
|
-
activity(params?: Record<string, unknown>): Promise<unknown>;
|
|
279
|
-
}
|
|
280
|
-
declare class Endpoints {
|
|
281
|
-
private readonly client;
|
|
282
|
-
constructor(client: Transport);
|
|
283
|
-
/**
|
|
284
|
-
* Deploy a model for a task. `wait: false` (default) → an `AsyncIterable` of
|
|
285
|
-
* progress events (`{event, data}`); the terminal event is `complete`
|
|
286
|
-
* (`data.endpoint`) or `error`. `wait: true` → resolves the live `Endpoint`
|
|
287
|
-
* (throws `ParetaError` on a deploy `error` event).
|
|
288
|
-
*/
|
|
289
|
-
deploy(params: DeployParams & {
|
|
290
|
-
wait: true;
|
|
291
|
-
}): Promise<Endpoint>;
|
|
292
|
-
deploy(params: DeployParams & {
|
|
293
|
-
wait?: false;
|
|
294
|
-
}): AsyncIterable<SSEEvent>;
|
|
295
|
-
private waitForDeploy;
|
|
296
|
-
list(): Promise<Endpoint[]>;
|
|
297
|
-
retrieve(endpointId: string): Promise<Endpoint>;
|
|
298
|
-
start(endpointId: string): Promise<unknown>;
|
|
299
|
-
stop(endpointId: string): Promise<unknown>;
|
|
300
|
-
delete(endpointId: string): Promise<void>;
|
|
301
|
-
metrics(endpointId: string): EndpointMetrics;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* `client.tasks` — browse the benchmark catalog + match free-text intent, and
|
|
306
|
-
* the per-task discovery surface (leaderboard / recommended).
|
|
307
|
-
*
|
|
308
|
-
* Unlike the Python SDK (where `leaderboard`/`recommended` exist only on the
|
|
309
|
-
* sync client), these are present uniformly here — JS has one client.
|
|
228
|
+
* `client.tasks` — browse the benchmark catalog and match free-text intent to
|
|
229
|
+
* a task (`match` is the discovery surface: it tells you what Pareta can do).
|
|
310
230
|
*/
|
|
311
231
|
|
|
312
232
|
declare class Tasks {
|
|
@@ -320,10 +240,6 @@ declare class Tasks {
|
|
|
320
240
|
match(query: string, opts?: {
|
|
321
241
|
topK?: number;
|
|
322
242
|
}): Promise<TaskMatch>;
|
|
323
|
-
/** Models ranked by quality/cost for a task (+ recommended + frontier baseline). */
|
|
324
|
-
leaderboard(taskId: string): Promise<Leaderboard>;
|
|
325
|
-
/** The task's recommended deployable model — what deploy(model:"recommended") resolves to. */
|
|
326
|
-
recommended(taskId: string): Promise<string | null>;
|
|
327
243
|
}
|
|
328
244
|
|
|
329
245
|
/**
|
|
@@ -474,6 +390,34 @@ declare class Auto {
|
|
|
474
390
|
}): Promise<FrontierComparison>;
|
|
475
391
|
}
|
|
476
392
|
|
|
393
|
+
/**
|
|
394
|
+
* `pa.rerank(...)` + `pa.embeddings(...)` — the Retrieval capability lanes
|
|
395
|
+
* (the RAG stack: embeddings for recall, reranking for precision).
|
|
396
|
+
*
|
|
397
|
+
* Both are dedicated routes, not `chat.completions`:
|
|
398
|
+
* POST /v1/rerank {query, documents[], top_n?} -> ordered
|
|
399
|
+
* {index, relevance_score} rows (calibrated P(relevant))
|
|
400
|
+
* POST /v1/embeddings {input[], input_type?} -> unit-normalized vectors
|
|
401
|
+
*
|
|
402
|
+
* Rerank is metered per document scored; embeddings per input token. You never
|
|
403
|
+
* pick a serving model — Pareta resolves the lane (`pareta-rerank-1` / `bge-1`),
|
|
404
|
+
* exactly as `model:"auto"` does for chat.
|
|
405
|
+
*
|
|
406
|
+
* Exposed as callable client fields (`pa.rerank(...)`) rather than resource
|
|
407
|
+
* objects — call-parity with the Python SDK, and neither lane has sub-methods.
|
|
408
|
+
*/
|
|
409
|
+
|
|
410
|
+
interface RerankOptions {
|
|
411
|
+
/** Truncate the response to the best N (all documents are still scored and metered). */
|
|
412
|
+
topN?: number;
|
|
413
|
+
}
|
|
414
|
+
type RerankFn = (query: string, documents: string[], opts?: RerankOptions) => Promise<Rerank>;
|
|
415
|
+
interface EmbeddingsOptions {
|
|
416
|
+
/** `"query"` embeds a retrieval QUERY (asymmetric); default embeds documents raw. */
|
|
417
|
+
inputType?: "query" | "document";
|
|
418
|
+
}
|
|
419
|
+
type EmbeddingsFn = (input: string | string[], opts?: EmbeddingsOptions) => Promise<Embeddings>;
|
|
420
|
+
|
|
477
421
|
/**
|
|
478
422
|
* The `Pareta` client — one class (no sync/async split; JS is Promise-only).
|
|
479
423
|
* A faithful port of the Python `_client.py` transport: header construction,
|
|
@@ -525,10 +469,13 @@ declare class Pareta implements Transport {
|
|
|
525
469
|
private readonly fetchImpl;
|
|
526
470
|
readonly chat: Chat;
|
|
527
471
|
readonly models: Models;
|
|
528
|
-
readonly endpoints: Endpoints;
|
|
529
472
|
readonly tasks: Tasks;
|
|
530
473
|
readonly evals: Evals;
|
|
531
474
|
readonly auto: Auto;
|
|
475
|
+
/** Document reranking (the Retrieval precision lane) — `pa.rerank(query, docs, {topN})`. */
|
|
476
|
+
readonly rerank: RerankFn;
|
|
477
|
+
/** Text embeddings (the Retrieval recall lane) — `pa.embeddings(input, {inputType})`. */
|
|
478
|
+
readonly embeddings: EmbeddingsFn;
|
|
532
479
|
constructor(options?: ParetaOptions);
|
|
533
480
|
/** Build from PARETA_API_KEY (+ optional PARETA_BASE_URL); explicit opts win. */
|
|
534
481
|
static fromEnv(options?: ParetaOptions): Pareta;
|
|
@@ -547,12 +494,12 @@ declare class Pareta implements Transport {
|
|
|
547
494
|
/**
|
|
548
495
|
* Yield parsed SSE objects. Retries ONLY the initial connect/handshake — once
|
|
549
496
|
* bytes are flowing a mid-stream drop raises (re-issuing would re-run a
|
|
550
|
-
* metered generation
|
|
497
|
+
* metered generation). `events:true` → `{event,data}`.
|
|
551
498
|
*/
|
|
552
499
|
stream<T = unknown>(method: string, path: string, opts?: StreamOptions): AsyncGenerator<T>;
|
|
553
500
|
}
|
|
554
501
|
|
|
555
|
-
declare const VERSION = "
|
|
502
|
+
declare const VERSION = "1.1.0";
|
|
556
503
|
|
|
557
504
|
/**
|
|
558
505
|
* Typed error hierarchy for the Pareta SDK — a faithful port of the Python
|
|
@@ -567,7 +514,7 @@ declare const VERSION = "0.1.0";
|
|
|
567
514
|
* 402 → InsufficientCreditsError ("organization is out of credit…")
|
|
568
515
|
* 403 → PermissionDeniedError
|
|
569
516
|
* 404 → NotFoundError
|
|
570
|
-
* 409 → ConflictError (
|
|
517
|
+
* 409 → ConflictError (resource conflict / not servable)
|
|
571
518
|
* 422 → BadRequestError (FastAPI validation; `detail` is an array)
|
|
572
519
|
* 429 → RateLimitError
|
|
573
520
|
* 503 → EndpointNotReadyError (stopped / cold / provider down)
|
|
@@ -644,4 +591,4 @@ declare class EndpointNotReadyError extends APIStatusError {
|
|
|
644
591
|
constructor(message: string, init: APIStatusErrorInit);
|
|
645
592
|
}
|
|
646
593
|
|
|
647
|
-
export { APIConnectionError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, type ChatCompletionCreateParams, type ChatMessage, Choice, ConflictError, type
|
|
594
|
+
export { APIConnectionError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, type ChatCompletionCreateParams, type ChatMessage, Choice, ConflictError, Embeddings, type EmbeddingsFn, type EmbeddingsOptions, 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, Rerank, type RerankFn, type RerankOptions, RerankResult, 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,29 +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
|
-
/** Structured-extraction endpoints (contract / SEC / ICD …): the system prompt
|
|
79
|
-
* the benchmark used. The proxy applies it automatically when you send no
|
|
80
|
-
* `system` message (so quality matches the leaderboard by default); returned
|
|
81
|
-
* here so you can read it, or override it with your own `system` message.
|
|
82
|
-
* `null` when the task has no injectable prompt (see `promptScaffold`). */
|
|
83
|
-
get recommendedSystemPrompt(): string | null;
|
|
84
|
-
/** Fixed-label classification endpoints: a copy-and-customize `system` prompt
|
|
85
|
-
* template. NEVER auto-applied — the categories are yours, not the benchmark's
|
|
86
|
-
* — so fill them in and send it as your `system` message. `null` otherwise. */
|
|
87
|
-
get promptScaffold(): string | null;
|
|
88
|
-
}
|
|
89
65
|
declare class Task extends BaseModel {
|
|
90
66
|
get id(): string | null;
|
|
91
67
|
get defaultScorer(): string | null;
|
|
@@ -139,29 +115,12 @@ declare class EvalResult extends BaseModel {
|
|
|
139
115
|
/** Per-item rows (idx/score/prediction/error); empty when not persisted. */
|
|
140
116
|
get perItem(): EvalItemResult[];
|
|
141
117
|
}
|
|
142
|
-
declare class LeaderboardEntry extends BaseModel {
|
|
143
|
-
get name(): string | null;
|
|
144
|
-
get kind(): string | null;
|
|
145
|
-
get quality(): number | null;
|
|
146
|
-
get costPerRequestMicroUsd(): number | null;
|
|
147
|
-
get contextK(): number | null;
|
|
148
|
-
get runMode(): string | null;
|
|
149
|
-
}
|
|
150
|
-
/** Models ranked for a task. `recommended` is the deployable pick; `frontier` the baseline. */
|
|
151
|
-
declare class Leaderboard extends BaseModel {
|
|
152
|
-
get taskId(): string | null;
|
|
153
|
-
get metric(): string | null;
|
|
154
|
-
get costUnit(): string | null;
|
|
155
|
-
get recommended(): string | null;
|
|
156
|
-
get models(): LeaderboardEntry[];
|
|
157
|
-
get frontier(): LeaderboardEntry | null;
|
|
158
|
-
}
|
|
159
118
|
/** A vendor frontier model you can evaluate against (from the eval pool). */
|
|
160
119
|
declare class FrontierModel extends BaseModel {
|
|
161
120
|
get id(): string | null;
|
|
162
121
|
get vendor(): string | null;
|
|
163
122
|
get vision(): boolean;
|
|
164
|
-
/** Only meaningful when a task was given: it
|
|
123
|
+
/** Only meaningful when a task was given: it has benchmark results on that task. */
|
|
165
124
|
get benchmarked(): boolean;
|
|
166
125
|
}
|
|
167
126
|
/**
|
|
@@ -183,13 +142,37 @@ declare class EvalRun extends BaseModel {
|
|
|
183
142
|
get cost(): string;
|
|
184
143
|
get results(): EvalResult[];
|
|
185
144
|
}
|
|
145
|
+
/** One row of `Rerank.results` — a document's position + calibrated score. */
|
|
146
|
+
declare class RerankResult extends BaseModel {
|
|
147
|
+
/** Position of this document in YOUR request's documents array. */
|
|
148
|
+
get index(): number;
|
|
149
|
+
/** Calibrated P(relevant) in (0, 1) — thresholdable, not just ordinal. */
|
|
150
|
+
get relevanceScore(): number;
|
|
151
|
+
}
|
|
152
|
+
/** Result of `pa.rerank(...)`: `.results` ordered most-relevant-first;
|
|
153
|
+
* `.pairs` is the number of documents scored (the metered unit). */
|
|
154
|
+
declare class Rerank extends BaseModel {
|
|
155
|
+
get results(): RerankResult[];
|
|
156
|
+
get model(): string | null;
|
|
157
|
+
get pairs(): number | null;
|
|
158
|
+
/** Map the ranked indices back onto the documents you sent — best first. */
|
|
159
|
+
topDocuments(documents: string[]): string[];
|
|
160
|
+
}
|
|
161
|
+
/** Result of `pa.embeddings(...)`: unit-normalized vectors in input order
|
|
162
|
+
* (cosine similarity is a plain dot product); `.promptTokens` is metered. */
|
|
163
|
+
declare class Embeddings extends BaseModel {
|
|
164
|
+
get vectors(): number[][];
|
|
165
|
+
get model(): string | null;
|
|
166
|
+
get promptTokens(): number | null;
|
|
167
|
+
get length(): number;
|
|
168
|
+
}
|
|
186
169
|
|
|
187
170
|
/**
|
|
188
171
|
* `client.chat.completions` — OpenAI-compatible chat completions.
|
|
189
172
|
*
|
|
190
|
-
* `model` is
|
|
191
|
-
*
|
|
192
|
-
*
|
|
173
|
+
* `model` is `"auto"` — Pareta plans, routes, and verifies each request. The
|
|
174
|
+
* call is metered: a successful completion debits the org's balance; a zero
|
|
175
|
+
* balance raises `InsufficientCreditsError` (402).
|
|
193
176
|
*/
|
|
194
177
|
|
|
195
178
|
/** An OpenAI-style chat message. `content` is a string or content-block array. */
|
|
@@ -200,7 +183,7 @@ interface ChatMessage {
|
|
|
200
183
|
}
|
|
201
184
|
/** Params for `chat.completions.create`. Extra OpenAI params pass through. */
|
|
202
185
|
interface ChatCompletionCreateParams {
|
|
203
|
-
/**
|
|
186
|
+
/** `"auto"` — Pareta routes the request to the right model. */
|
|
204
187
|
model: string;
|
|
205
188
|
messages: ChatMessage[];
|
|
206
189
|
stream?: boolean;
|
|
@@ -230,10 +213,9 @@ declare class Chat {
|
|
|
230
213
|
}
|
|
231
214
|
|
|
232
215
|
/**
|
|
233
|
-
* `client.models` —
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* `Model.id` is an endpoint id usable as `chat.completions.create({ model })`.
|
|
216
|
+
* `client.models` — the OpenAI-compatible `/v1/models` list of model ids your
|
|
217
|
+
* org can call. Each `Model.id` is usable as
|
|
218
|
+
* `chat.completions.create({ model })`.
|
|
237
219
|
*/
|
|
238
220
|
|
|
239
221
|
declare class Models {
|
|
@@ -243,70 +225,8 @@ declare class Models {
|
|
|
243
225
|
}
|
|
244
226
|
|
|
245
227
|
/**
|
|
246
|
-
* `client.
|
|
247
|
-
*
|
|
248
|
-
* `deploy({ task, model })` is ergonomic: Pareta picks the GPU/serving config
|
|
249
|
-
* (you never pass hardware) and `model` defaults to the task's recommended pick.
|
|
250
|
-
* The backend resolver behind POST /v1/endpoints evolved with the discovery
|
|
251
|
-
* work — verify the deploy body against staging when wiring real deploys.
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
/** Params for `endpoints.deploy`. Extra keys pass through to the deploy body. */
|
|
255
|
-
interface DeployParams {
|
|
256
|
-
/** The task id to deploy a model for. */
|
|
257
|
-
task: string;
|
|
258
|
-
/** Model alias to deploy; defaults to "recommended" (the task's top pick). */
|
|
259
|
-
model?: string;
|
|
260
|
-
/** Optional endpoint name. */
|
|
261
|
-
name?: string;
|
|
262
|
-
/** If true, block through the deploy and resolve the live Endpoint. */
|
|
263
|
-
wait?: boolean;
|
|
264
|
-
[key: string]: unknown;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* `endpoints.metrics(id).performance()` etc. Each returns the raw metric JSON
|
|
268
|
-
* (shapes vary by dimension; typed models arrive with the OpenAPI generation).
|
|
269
|
-
*/
|
|
270
|
-
declare class EndpointMetrics {
|
|
271
|
-
private readonly client;
|
|
272
|
-
private readonly id;
|
|
273
|
-
constructor(client: Transport, id: string);
|
|
274
|
-
performance(params?: Record<string, unknown>): Promise<unknown>;
|
|
275
|
-
uptime(params?: Record<string, unknown>): Promise<unknown>;
|
|
276
|
-
cost(params?: Record<string, unknown>): Promise<unknown>;
|
|
277
|
-
quality(params?: Record<string, unknown>): Promise<unknown>;
|
|
278
|
-
activity(params?: Record<string, unknown>): Promise<unknown>;
|
|
279
|
-
}
|
|
280
|
-
declare class Endpoints {
|
|
281
|
-
private readonly client;
|
|
282
|
-
constructor(client: Transport);
|
|
283
|
-
/**
|
|
284
|
-
* Deploy a model for a task. `wait: false` (default) → an `AsyncIterable` of
|
|
285
|
-
* progress events (`{event, data}`); the terminal event is `complete`
|
|
286
|
-
* (`data.endpoint`) or `error`. `wait: true` → resolves the live `Endpoint`
|
|
287
|
-
* (throws `ParetaError` on a deploy `error` event).
|
|
288
|
-
*/
|
|
289
|
-
deploy(params: DeployParams & {
|
|
290
|
-
wait: true;
|
|
291
|
-
}): Promise<Endpoint>;
|
|
292
|
-
deploy(params: DeployParams & {
|
|
293
|
-
wait?: false;
|
|
294
|
-
}): AsyncIterable<SSEEvent>;
|
|
295
|
-
private waitForDeploy;
|
|
296
|
-
list(): Promise<Endpoint[]>;
|
|
297
|
-
retrieve(endpointId: string): Promise<Endpoint>;
|
|
298
|
-
start(endpointId: string): Promise<unknown>;
|
|
299
|
-
stop(endpointId: string): Promise<unknown>;
|
|
300
|
-
delete(endpointId: string): Promise<void>;
|
|
301
|
-
metrics(endpointId: string): EndpointMetrics;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* `client.tasks` — browse the benchmark catalog + match free-text intent, and
|
|
306
|
-
* the per-task discovery surface (leaderboard / recommended).
|
|
307
|
-
*
|
|
308
|
-
* Unlike the Python SDK (where `leaderboard`/`recommended` exist only on the
|
|
309
|
-
* sync client), these are present uniformly here — JS has one client.
|
|
228
|
+
* `client.tasks` — browse the benchmark catalog and match free-text intent to
|
|
229
|
+
* a task (`match` is the discovery surface: it tells you what Pareta can do).
|
|
310
230
|
*/
|
|
311
231
|
|
|
312
232
|
declare class Tasks {
|
|
@@ -320,10 +240,6 @@ declare class Tasks {
|
|
|
320
240
|
match(query: string, opts?: {
|
|
321
241
|
topK?: number;
|
|
322
242
|
}): Promise<TaskMatch>;
|
|
323
|
-
/** Models ranked by quality/cost for a task (+ recommended + frontier baseline). */
|
|
324
|
-
leaderboard(taskId: string): Promise<Leaderboard>;
|
|
325
|
-
/** The task's recommended deployable model — what deploy(model:"recommended") resolves to. */
|
|
326
|
-
recommended(taskId: string): Promise<string | null>;
|
|
327
243
|
}
|
|
328
244
|
|
|
329
245
|
/**
|
|
@@ -474,6 +390,34 @@ declare class Auto {
|
|
|
474
390
|
}): Promise<FrontierComparison>;
|
|
475
391
|
}
|
|
476
392
|
|
|
393
|
+
/**
|
|
394
|
+
* `pa.rerank(...)` + `pa.embeddings(...)` — the Retrieval capability lanes
|
|
395
|
+
* (the RAG stack: embeddings for recall, reranking for precision).
|
|
396
|
+
*
|
|
397
|
+
* Both are dedicated routes, not `chat.completions`:
|
|
398
|
+
* POST /v1/rerank {query, documents[], top_n?} -> ordered
|
|
399
|
+
* {index, relevance_score} rows (calibrated P(relevant))
|
|
400
|
+
* POST /v1/embeddings {input[], input_type?} -> unit-normalized vectors
|
|
401
|
+
*
|
|
402
|
+
* Rerank is metered per document scored; embeddings per input token. You never
|
|
403
|
+
* pick a serving model — Pareta resolves the lane (`pareta-rerank-1` / `bge-1`),
|
|
404
|
+
* exactly as `model:"auto"` does for chat.
|
|
405
|
+
*
|
|
406
|
+
* Exposed as callable client fields (`pa.rerank(...)`) rather than resource
|
|
407
|
+
* objects — call-parity with the Python SDK, and neither lane has sub-methods.
|
|
408
|
+
*/
|
|
409
|
+
|
|
410
|
+
interface RerankOptions {
|
|
411
|
+
/** Truncate the response to the best N (all documents are still scored and metered). */
|
|
412
|
+
topN?: number;
|
|
413
|
+
}
|
|
414
|
+
type RerankFn = (query: string, documents: string[], opts?: RerankOptions) => Promise<Rerank>;
|
|
415
|
+
interface EmbeddingsOptions {
|
|
416
|
+
/** `"query"` embeds a retrieval QUERY (asymmetric); default embeds documents raw. */
|
|
417
|
+
inputType?: "query" | "document";
|
|
418
|
+
}
|
|
419
|
+
type EmbeddingsFn = (input: string | string[], opts?: EmbeddingsOptions) => Promise<Embeddings>;
|
|
420
|
+
|
|
477
421
|
/**
|
|
478
422
|
* The `Pareta` client — one class (no sync/async split; JS is Promise-only).
|
|
479
423
|
* A faithful port of the Python `_client.py` transport: header construction,
|
|
@@ -525,10 +469,13 @@ declare class Pareta implements Transport {
|
|
|
525
469
|
private readonly fetchImpl;
|
|
526
470
|
readonly chat: Chat;
|
|
527
471
|
readonly models: Models;
|
|
528
|
-
readonly endpoints: Endpoints;
|
|
529
472
|
readonly tasks: Tasks;
|
|
530
473
|
readonly evals: Evals;
|
|
531
474
|
readonly auto: Auto;
|
|
475
|
+
/** Document reranking (the Retrieval precision lane) — `pa.rerank(query, docs, {topN})`. */
|
|
476
|
+
readonly rerank: RerankFn;
|
|
477
|
+
/** Text embeddings (the Retrieval recall lane) — `pa.embeddings(input, {inputType})`. */
|
|
478
|
+
readonly embeddings: EmbeddingsFn;
|
|
532
479
|
constructor(options?: ParetaOptions);
|
|
533
480
|
/** Build from PARETA_API_KEY (+ optional PARETA_BASE_URL); explicit opts win. */
|
|
534
481
|
static fromEnv(options?: ParetaOptions): Pareta;
|
|
@@ -547,12 +494,12 @@ declare class Pareta implements Transport {
|
|
|
547
494
|
/**
|
|
548
495
|
* Yield parsed SSE objects. Retries ONLY the initial connect/handshake — once
|
|
549
496
|
* bytes are flowing a mid-stream drop raises (re-issuing would re-run a
|
|
550
|
-
* metered generation
|
|
497
|
+
* metered generation). `events:true` → `{event,data}`.
|
|
551
498
|
*/
|
|
552
499
|
stream<T = unknown>(method: string, path: string, opts?: StreamOptions): AsyncGenerator<T>;
|
|
553
500
|
}
|
|
554
501
|
|
|
555
|
-
declare const VERSION = "
|
|
502
|
+
declare const VERSION = "1.1.0";
|
|
556
503
|
|
|
557
504
|
/**
|
|
558
505
|
* Typed error hierarchy for the Pareta SDK — a faithful port of the Python
|
|
@@ -567,7 +514,7 @@ declare const VERSION = "0.1.0";
|
|
|
567
514
|
* 402 → InsufficientCreditsError ("organization is out of credit…")
|
|
568
515
|
* 403 → PermissionDeniedError
|
|
569
516
|
* 404 → NotFoundError
|
|
570
|
-
* 409 → ConflictError (
|
|
517
|
+
* 409 → ConflictError (resource conflict / not servable)
|
|
571
518
|
* 422 → BadRequestError (FastAPI validation; `detail` is an array)
|
|
572
519
|
* 429 → RateLimitError
|
|
573
520
|
* 503 → EndpointNotReadyError (stopped / cold / provider down)
|
|
@@ -644,4 +591,4 @@ declare class EndpointNotReadyError extends APIStatusError {
|
|
|
644
591
|
constructor(message: string, init: APIStatusErrorInit);
|
|
645
592
|
}
|
|
646
593
|
|
|
647
|
-
export { APIConnectionError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, type ChatCompletionCreateParams, type ChatMessage, Choice, ConflictError, type
|
|
594
|
+
export { APIConnectionError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, type ChatCompletionCreateParams, type ChatMessage, Choice, ConflictError, Embeddings, type EmbeddingsFn, type EmbeddingsOptions, 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, Rerank, type RerankFn, type RerankOptions, RerankResult, type SSEEvent, Task, TaskMatch, TaskMatchCandidate, type Transport, Usage, VERSION, type ValidationErrorItem };
|