pareta 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -187,6 +187,19 @@ declare class Speech extends BaseModel {
187
187
  /** Write the decoded audio to `path` (Node only — lazy node:fs). */
188
188
  save(path: string): Promise<this>;
189
189
  }
190
+ /** Image result from `images.generate(...)`. `.image` is decoded PNG bytes;
191
+ * `.size` is the ACTUAL delivered size. Billed flat per image (the
192
+ * `X-Pareta-Billed` response header carries the receipt). */
193
+ declare class ImageGeneration extends BaseModel {
194
+ /** The generated image, base64-decoded to raw PNG bytes. */
195
+ get image(): Uint8Array;
196
+ get b64Json(): string | null;
197
+ get size(): string | null;
198
+ get model(): string | null;
199
+ get created(): number | null;
200
+ /** Write the decoded PNG to `path` (Node only — lazy node:fs). */
201
+ save(path: string): Promise<this>;
202
+ }
190
203
 
191
204
  /**
192
205
  * `client.chat.completions` — OpenAI-compatible chat completions.
@@ -246,8 +259,10 @@ declare class Models {
246
259
  }
247
260
 
248
261
  /**
249
- * `client.tasks` — browse the benchmark catalog and match free-text intent to
250
- * a task (`match` is the discovery surface: it tells you what Pareta can do).
262
+ * `client.tasks` — the grading-contract directory for evals. A task names how
263
+ * a dataset is scored (row shape + scorer); inference never takes one. `match`
264
+ * maps a plain-English description of your dataset to the contract that
265
+ * grades it — feed the matched task id into `evals.runs.create(task=...)`.
251
266
  */
252
267
 
253
268
  declare class Tasks {
@@ -452,6 +467,37 @@ declare class Audio {
452
467
  speech(text: string, opts?: SpeechOptions): Promise<Speech>;
453
468
  }
454
469
 
470
+ /**
471
+ * `pa.images` — the image-generation capability lane, TS parity with the
472
+ * Python SDK's `client.images`.
473
+ *
474
+ * Dedicated route, not `chat.completions`:
475
+ * POST /v1/images/generations {prompt, size?, seed?} -> {created, model,
476
+ * data: [{b64_json}], size}
477
+ *
478
+ * Generation runs on Pareta's open image model (`hidream-1`) and is metered
479
+ * at a FLAT price per image — every size costs the same (the model renders
480
+ * at full 2K quality internally regardless of the delivery size). The
481
+ * `X-Pareta-Billed` response header carries the per-request receipt in
482
+ * micro-USD. Delivery sizes today (server-authoritative): 1024x1024
483
+ * (default), 2048x2048, 2304x1728, 1728x2304, 2560x1440, 1440x2560.
484
+ */
485
+
486
+ interface ImageGenerateOptions {
487
+ /** Delivery size, e.g. "2560x1440" (omit for 1024x1024). Flat price. */
488
+ size?: string;
489
+ /** Pin the noise seed for reproducibility. */
490
+ seed?: number;
491
+ }
492
+ declare class Images {
493
+ private readonly client;
494
+ constructor(client: Transport);
495
+ /** Generate one image from a text prompt. Returns an `ImageGeneration`
496
+ * whose `.image` is decoded PNG bytes (`.save(path)` writes a file in
497
+ * Node). Billed flat per image. */
498
+ generate(prompt: string, opts?: ImageGenerateOptions): Promise<ImageGeneration>;
499
+ }
500
+
455
501
  /**
456
502
  * `pa.rerank(...)` + `pa.embeddings(...)` — the Retrieval capability lanes
457
503
  * (the RAG stack: embeddings for recall, reranking for precision).
@@ -462,7 +508,7 @@ declare class Audio {
462
508
  * POST /v1/embeddings {input[], input_type?} -> unit-normalized vectors
463
509
  *
464
510
  * Rerank is metered per document scored; embeddings per input token. You never
465
- * pick a serving model — Pareta resolves the lane (`pareta-rerank-1` / `bge-1`),
511
+ * pick a serving model — Pareta resolves the lane (`pareta-rerank-1` / `qwen-embed-1`),
466
512
  * exactly as `model:"auto"` does for chat.
467
513
  *
468
514
  * Exposed as callable client fields (`pa.rerank(...)`) rather than resource
@@ -540,6 +586,8 @@ declare class Pareta implements Transport {
540
586
  readonly rerank: RerankFn;
541
587
  /** Text embeddings (the Retrieval recall lane) — `pa.embeddings(input, {inputType})`. */
542
588
  readonly embeddings: EmbeddingsFn;
589
+ /** Image generation — `pa.images.generate(prompt, {size, seed})`, flat price per image. */
590
+ readonly images: Images;
543
591
  constructor(options?: ParetaOptions);
544
592
  /** Build from PARETA_API_KEY (+ optional PARETA_BASE_URL); explicit opts win. */
545
593
  static fromEnv(options?: ParetaOptions): Pareta;
@@ -563,7 +611,7 @@ declare class Pareta implements Transport {
563
611
  stream<T = unknown>(method: string, path: string, opts?: StreamOptions): AsyncGenerator<T>;
564
612
  }
565
613
 
566
- declare const VERSION = "1.2.0";
614
+ declare const VERSION = "1.3.0";
567
615
 
568
616
  /**
569
617
  * Typed error hierarchy for the Pareta SDK — a faithful port of the Python
@@ -655,4 +703,4 @@ declare class EndpointNotReadyError extends APIStatusError {
655
703
  constructor(message: string, init: APIStatusErrorInit);
656
704
  }
657
705
 
658
- export { APIConnectionError, APIStatusError, APITimeoutError, Audio, type AudioInput, 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, Speech, type SpeechOptions, Task, TaskMatch, TaskMatchCandidate, Transcription, type TranscriptionOptions, type Transport, Usage, VERSION, type ValidationErrorItem };
706
+ export { APIConnectionError, APIStatusError, APITimeoutError, Audio, type AudioInput, 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, type ImageGenerateOptions, ImageGeneration, Images, InsufficientCreditsError, Message, Model, ModelList, NotFoundError, Pareta, ParetaError, type ParetaOptions, PermissionDeniedError, RateLimitError, Rerank, type RerankFn, type RerankOptions, RerankResult, type SSEEvent, Speech, type SpeechOptions, Task, TaskMatch, TaskMatchCandidate, Transcription, type TranscriptionOptions, type Transport, Usage, VERSION, type ValidationErrorItem };
package/dist/index.d.ts CHANGED
@@ -187,6 +187,19 @@ declare class Speech extends BaseModel {
187
187
  /** Write the decoded audio to `path` (Node only — lazy node:fs). */
188
188
  save(path: string): Promise<this>;
189
189
  }
190
+ /** Image result from `images.generate(...)`. `.image` is decoded PNG bytes;
191
+ * `.size` is the ACTUAL delivered size. Billed flat per image (the
192
+ * `X-Pareta-Billed` response header carries the receipt). */
193
+ declare class ImageGeneration extends BaseModel {
194
+ /** The generated image, base64-decoded to raw PNG bytes. */
195
+ get image(): Uint8Array;
196
+ get b64Json(): string | null;
197
+ get size(): string | null;
198
+ get model(): string | null;
199
+ get created(): number | null;
200
+ /** Write the decoded PNG to `path` (Node only — lazy node:fs). */
201
+ save(path: string): Promise<this>;
202
+ }
190
203
 
191
204
  /**
192
205
  * `client.chat.completions` — OpenAI-compatible chat completions.
@@ -246,8 +259,10 @@ declare class Models {
246
259
  }
247
260
 
248
261
  /**
249
- * `client.tasks` — browse the benchmark catalog and match free-text intent to
250
- * a task (`match` is the discovery surface: it tells you what Pareta can do).
262
+ * `client.tasks` — the grading-contract directory for evals. A task names how
263
+ * a dataset is scored (row shape + scorer); inference never takes one. `match`
264
+ * maps a plain-English description of your dataset to the contract that
265
+ * grades it — feed the matched task id into `evals.runs.create(task=...)`.
251
266
  */
252
267
 
253
268
  declare class Tasks {
@@ -452,6 +467,37 @@ declare class Audio {
452
467
  speech(text: string, opts?: SpeechOptions): Promise<Speech>;
453
468
  }
454
469
 
470
+ /**
471
+ * `pa.images` — the image-generation capability lane, TS parity with the
472
+ * Python SDK's `client.images`.
473
+ *
474
+ * Dedicated route, not `chat.completions`:
475
+ * POST /v1/images/generations {prompt, size?, seed?} -> {created, model,
476
+ * data: [{b64_json}], size}
477
+ *
478
+ * Generation runs on Pareta's open image model (`hidream-1`) and is metered
479
+ * at a FLAT price per image — every size costs the same (the model renders
480
+ * at full 2K quality internally regardless of the delivery size). The
481
+ * `X-Pareta-Billed` response header carries the per-request receipt in
482
+ * micro-USD. Delivery sizes today (server-authoritative): 1024x1024
483
+ * (default), 2048x2048, 2304x1728, 1728x2304, 2560x1440, 1440x2560.
484
+ */
485
+
486
+ interface ImageGenerateOptions {
487
+ /** Delivery size, e.g. "2560x1440" (omit for 1024x1024). Flat price. */
488
+ size?: string;
489
+ /** Pin the noise seed for reproducibility. */
490
+ seed?: number;
491
+ }
492
+ declare class Images {
493
+ private readonly client;
494
+ constructor(client: Transport);
495
+ /** Generate one image from a text prompt. Returns an `ImageGeneration`
496
+ * whose `.image` is decoded PNG bytes (`.save(path)` writes a file in
497
+ * Node). Billed flat per image. */
498
+ generate(prompt: string, opts?: ImageGenerateOptions): Promise<ImageGeneration>;
499
+ }
500
+
455
501
  /**
456
502
  * `pa.rerank(...)` + `pa.embeddings(...)` — the Retrieval capability lanes
457
503
  * (the RAG stack: embeddings for recall, reranking for precision).
@@ -462,7 +508,7 @@ declare class Audio {
462
508
  * POST /v1/embeddings {input[], input_type?} -> unit-normalized vectors
463
509
  *
464
510
  * Rerank is metered per document scored; embeddings per input token. You never
465
- * pick a serving model — Pareta resolves the lane (`pareta-rerank-1` / `bge-1`),
511
+ * pick a serving model — Pareta resolves the lane (`pareta-rerank-1` / `qwen-embed-1`),
466
512
  * exactly as `model:"auto"` does for chat.
467
513
  *
468
514
  * Exposed as callable client fields (`pa.rerank(...)`) rather than resource
@@ -540,6 +586,8 @@ declare class Pareta implements Transport {
540
586
  readonly rerank: RerankFn;
541
587
  /** Text embeddings (the Retrieval recall lane) — `pa.embeddings(input, {inputType})`. */
542
588
  readonly embeddings: EmbeddingsFn;
589
+ /** Image generation — `pa.images.generate(prompt, {size, seed})`, flat price per image. */
590
+ readonly images: Images;
543
591
  constructor(options?: ParetaOptions);
544
592
  /** Build from PARETA_API_KEY (+ optional PARETA_BASE_URL); explicit opts win. */
545
593
  static fromEnv(options?: ParetaOptions): Pareta;
@@ -563,7 +611,7 @@ declare class Pareta implements Transport {
563
611
  stream<T = unknown>(method: string, path: string, opts?: StreamOptions): AsyncGenerator<T>;
564
612
  }
565
613
 
566
- declare const VERSION = "1.2.0";
614
+ declare const VERSION = "1.3.0";
567
615
 
568
616
  /**
569
617
  * Typed error hierarchy for the Pareta SDK — a faithful port of the Python
@@ -655,4 +703,4 @@ declare class EndpointNotReadyError extends APIStatusError {
655
703
  constructor(message: string, init: APIStatusErrorInit);
656
704
  }
657
705
 
658
- export { APIConnectionError, APIStatusError, APITimeoutError, Audio, type AudioInput, 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, Speech, type SpeechOptions, Task, TaskMatch, TaskMatchCandidate, Transcription, type TranscriptionOptions, type Transport, Usage, VERSION, type ValidationErrorItem };
706
+ export { APIConnectionError, APIStatusError, APITimeoutError, Audio, type AudioInput, 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, type ImageGenerateOptions, ImageGeneration, Images, InsufficientCreditsError, Message, Model, ModelList, NotFoundError, Pareta, ParetaError, type ParetaOptions, PermissionDeniedError, RateLimitError, Rerank, type RerankFn, type RerankOptions, RerankResult, type SSEEvent, Speech, type SpeechOptions, Task, TaskMatch, TaskMatchCandidate, Transcription, type TranscriptionOptions, type Transport, Usage, VERSION, type ValidationErrorItem };
package/dist/index.mjs CHANGED
@@ -172,7 +172,7 @@ function parseSSE(reader, opts) {
172
172
  }
173
173
 
174
174
  // src/version.ts
175
- var VERSION = "1.2.0";
175
+ var VERSION = "1.3.0";
176
176
 
177
177
  // src/money.ts
178
178
  var MICRO_PER_CENT = 10000n;
@@ -531,6 +531,32 @@ var Speech = class extends BaseModel {
531
531
  return this;
532
532
  }
533
533
  };
534
+ var ImageGeneration = class extends BaseModel {
535
+ /** The generated image, base64-decoded to raw PNG bytes. */
536
+ get image() {
537
+ const b64 = this.b64Json ?? "";
538
+ return b64 ? base64ToBytes(b64) : new Uint8Array(0);
539
+ }
540
+ get b64Json() {
541
+ const data = this.raw.data ?? [];
542
+ return data[0]?.b64_json ?? null;
543
+ }
544
+ get size() {
545
+ return this.raw.size ?? null;
546
+ }
547
+ get model() {
548
+ return this.raw.model ?? null;
549
+ }
550
+ get created() {
551
+ return this.raw.created ?? null;
552
+ }
553
+ /** Write the decoded PNG to `path` (Node only — lazy node:fs). */
554
+ async save(path) {
555
+ const { writeFile } = await import('fs/promises');
556
+ await writeFile(path, this.image);
557
+ return this;
558
+ }
559
+ };
534
560
 
535
561
  // src/resources/chat.ts
536
562
  var PATH = "/v1/chat/completions";
@@ -887,6 +913,28 @@ var Audio = class {
887
913
  }
888
914
  };
889
915
 
916
+ // src/resources/images.ts
917
+ var PATH3 = "/v1/images/generations";
918
+ var Images = class {
919
+ constructor(client) {
920
+ this.client = client;
921
+ }
922
+ client;
923
+ /** Generate one image from a text prompt. Returns an `ImageGeneration`
924
+ * whose `.image` is decoded PNG bytes (`.save(path)` writes a file in
925
+ * Node). Billed flat per image. */
926
+ generate(prompt, opts = {}) {
927
+ if (!prompt || !prompt.trim()) throw new ParetaError("prompt is required");
928
+ const body = { prompt };
929
+ if (opts.size) body.size = opts.size;
930
+ if (opts.seed !== void 0) body.seed = opts.seed;
931
+ return this.client.request("POST", PATH3, {
932
+ body,
933
+ cast: (raw) => new ImageGeneration(raw)
934
+ });
935
+ }
936
+ };
937
+
890
938
  // src/resources/retrieval.ts
891
939
  function makeRerank(client) {
892
940
  return (query, documents, opts = {}) => {
@@ -953,6 +1001,8 @@ var Pareta = class _Pareta {
953
1001
  rerank;
954
1002
  /** Text embeddings (the Retrieval recall lane) — `pa.embeddings(input, {inputType})`. */
955
1003
  embeddings;
1004
+ /** Image generation — `pa.images.generate(prompt, {size, seed})`, flat price per image. */
1005
+ images;
956
1006
  constructor(options = {}) {
957
1007
  if (!options.apiKey) {
958
1008
  throw new ParetaError(
@@ -976,6 +1026,7 @@ var Pareta = class _Pareta {
976
1026
  this.audio = new Audio(this);
977
1027
  this.rerank = makeRerank(this);
978
1028
  this.embeddings = makeEmbeddings(this);
1029
+ this.images = new Images(this);
979
1030
  }
980
1031
  /** Build from PARETA_API_KEY (+ optional PARETA_BASE_URL); explicit opts win. */
981
1032
  static fromEnv(options = {}) {
@@ -1156,6 +1207,6 @@ var Pareta = class _Pareta {
1156
1207
  }
1157
1208
  };
1158
1209
 
1159
- export { APIConnectionError, APIStatusError, APITimeoutError, Audio, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, Choice, ConflictError, Embeddings, EndpointNotReadyError, EvalItemResult, EvalResult, EvalRun, EvalRuns, EvalSet, EvalSets, FrontierModel, InsufficientCreditsError, Message, Model, ModelList, NotFoundError, Pareta, ParetaError, PermissionDeniedError, RateLimitError, Rerank, RerankResult, Speech, Task, TaskMatch, TaskMatchCandidate, Transcription, Usage, VERSION };
1210
+ export { APIConnectionError, APIStatusError, APITimeoutError, Audio, AuthenticationError, BadRequestError, BaseModel, ChatCompletion, ChatCompletionChunk, Choice, ConflictError, Embeddings, EndpointNotReadyError, EvalItemResult, EvalResult, EvalRun, EvalRuns, EvalSet, EvalSets, FrontierModel, ImageGeneration, Images, InsufficientCreditsError, Message, Model, ModelList, NotFoundError, Pareta, ParetaError, PermissionDeniedError, RateLimitError, Rerank, RerankResult, Speech, Task, TaskMatch, TaskMatchCandidate, Transcription, Usage, VERSION };
1160
1211
  //# sourceMappingURL=index.mjs.map
1161
1212
  //# sourceMappingURL=index.mjs.map