@premai/api-sdk 1.0.47 → 1.0.49

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.
@@ -171,7 +171,12 @@ async function attest(apiKey, options = { enabled: true }) {
171
171
  // src/utils/crypto.ts
172
172
  import { aeskwp } from "@noble/ciphers/aes.js";
173
173
  import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
174
- import { bytesToHex, hexToBytes, managedNonce, randomBytes } from "@noble/ciphers/utils.js";
174
+ import {
175
+ bytesToHex,
176
+ hexToBytes,
177
+ managedNonce,
178
+ randomBytes
179
+ } from "@noble/ciphers/utils.js";
175
180
  import { sha256 } from "@noble/hashes/sha2.js";
176
181
  import { sha3_256 } from "@noble/hashes/sha3.js";
177
182
  import { XWing } from "@noble/post-quantum/hybrid.js";
@@ -425,7 +430,10 @@ function createAudioClient(apiKey, encryptionKeys, requestTimeoutMs = DEFAULT_RE
425
430
  const controller = new AbortController;
426
431
  const timeoutId = setTimeout(() => controller.abort(), requestTimeoutMs);
427
432
  try {
428
- const sessionId = await attest(apiKey, { model: body.model, enabled: attest2 });
433
+ const sessionId = await attest(apiKey, {
434
+ model: body.model,
435
+ enabled: attest2
436
+ });
429
437
  const encryptedRequest = await preprocessAudioRequest(body, encryptionKeys);
430
438
  const response = await fetch(`${endpoints.proxy}/rvenc/audio/transcriptions`, {
431
439
  method: "POST",
@@ -457,7 +465,10 @@ function createAudioClient(apiKey, encryptionKeys, requestTimeoutMs = DEFAULT_RE
457
465
  const controller = new AbortController;
458
466
  const timeoutId = setTimeout(() => controller.abort(), requestTimeoutMs);
459
467
  try {
460
- const sessionId = await attest(apiKey, { model: body.model, enabled: attest2 });
468
+ const sessionId = await attest(apiKey, {
469
+ model: body.model,
470
+ enabled: attest2
471
+ });
461
472
  const encryptedRequest = await preprocessAudioTranslationRequest(body, encryptionKeys);
462
473
  const response = await fetch(`${endpoints.proxy}/rvenc/audio/translations`, {
463
474
  method: "POST",
@@ -1148,7 +1159,10 @@ function createRvencChatClient(apiKey, encryptionKeys, requestTimeoutMs = DEFAUL
1148
1159
  const controller = new AbortController;
1149
1160
  const timeoutId = setTimeout(() => controller.abort(), requestTimeoutMs);
1150
1161
  try {
1151
- const sessionId = await attest(apiKey, { model: body.model, enabled: attest2 });
1162
+ const sessionId = await attest(apiKey, {
1163
+ model: body.model,
1164
+ enabled: attest2
1165
+ });
1152
1166
  const encryptedRequest = preprocessRequest(body, encryptionKeys);
1153
1167
  const response = await fetch(`${endpoints.proxy}/rvenc/chat/completions`, {
1154
1168
  method: "POST",
@@ -1270,7 +1284,11 @@ async function* createDecryptedStreamGenerator(reader, sharedSecret, nonce, maxB
1270
1284
 
1271
1285
  // src/tools/index.ts
1272
1286
  import { bytesToHex as bytesToHex6, hexToBytes as hexToBytes6, randomBytes as randomBytes4 } from "@noble/ciphers/utils.js";
1273
- var FILE_OUTPUT_TOOLS = ["generateImage", "audioGenerateFromText", "createFileForUser"];
1287
+ var FILE_OUTPUT_TOOLS = [
1288
+ "generateImage",
1289
+ "audioGenerateFromText",
1290
+ "createFileForUser"
1291
+ ];
1274
1292
  var FILE_INPUT_TOOLS = [
1275
1293
  "imageDescribeAndCaption",
1276
1294
  "imageDescribeAndCaptionFallback",
@@ -1329,7 +1347,9 @@ async function downloadEncryptedFile(fileId, apiKey, timeoutMs) {
1329
1347
  if (!downloadUrl) {
1330
1348
  throw new Error("No download URL in response");
1331
1349
  }
1332
- const fileResponse = await fetch(downloadUrl, { signal: controller.signal });
1350
+ const fileResponse = await fetch(downloadUrl, {
1351
+ signal: controller.signal
1352
+ });
1333
1353
  if (!fileResponse.ok) {
1334
1354
  throw new Error(`Failed to download file: ${fileResponse.status}`);
1335
1355
  }
@@ -5435,7 +5435,10 @@ function createAudioClient(apiKey, encryptionKeys, requestTimeoutMs = DEFAULT_RE
5435
5435
  const controller = new AbortController;
5436
5436
  const timeoutId = setTimeout(() => controller.abort(), requestTimeoutMs);
5437
5437
  try {
5438
- const sessionId = await attest(apiKey, { model: body.model, enabled: attest2 });
5438
+ const sessionId = await attest(apiKey, {
5439
+ model: body.model,
5440
+ enabled: attest2
5441
+ });
5439
5442
  const encryptedRequest = await preprocessAudioRequest(body, encryptionKeys);
5440
5443
  const response = await fetch(`${endpoints.proxy}/rvenc/audio/transcriptions`, {
5441
5444
  method: "POST",
@@ -5467,7 +5470,10 @@ function createAudioClient(apiKey, encryptionKeys, requestTimeoutMs = DEFAULT_RE
5467
5470
  const controller = new AbortController;
5468
5471
  const timeoutId = setTimeout(() => controller.abort(), requestTimeoutMs);
5469
5472
  try {
5470
- const sessionId = await attest(apiKey, { model: body.model, enabled: attest2 });
5473
+ const sessionId = await attest(apiKey, {
5474
+ model: body.model,
5475
+ enabled: attest2
5476
+ });
5471
5477
  const encryptedRequest = await preprocessAudioTranslationRequest(body, encryptionKeys);
5472
5478
  const response = await fetch(`${endpoints.proxy}/rvenc/audio/translations`, {
5473
5479
  method: "POST",
@@ -25419,7 +25425,10 @@ function createRvencChatClient(apiKey, encryptionKeys, requestTimeoutMs = DEFAUL
25419
25425
  const controller = new AbortController;
25420
25426
  const timeoutId = setTimeout(() => controller.abort(), requestTimeoutMs);
25421
25427
  try {
25422
- const sessionId = await attest(apiKey, { model: body.model, enabled: attest2 });
25428
+ const sessionId = await attest(apiKey, {
25429
+ model: body.model,
25430
+ enabled: attest2
25431
+ });
25423
25432
  const encryptedRequest = preprocessRequest(body, encryptionKeys);
25424
25433
  const response = await fetch(`${endpoints.proxy}/rvenc/chat/completions`, {
25425
25434
  method: "POST",
@@ -25540,7 +25549,11 @@ async function* createDecryptedStreamGenerator(reader, sharedSecret, nonce, maxB
25540
25549
  }
25541
25550
 
25542
25551
  // src/tools/index.ts
25543
- var FILE_OUTPUT_TOOLS = ["generateImage", "audioGenerateFromText", "createFileForUser"];
25552
+ var FILE_OUTPUT_TOOLS = [
25553
+ "generateImage",
25554
+ "audioGenerateFromText",
25555
+ "createFileForUser"
25556
+ ];
25544
25557
  var FILE_INPUT_TOOLS = [
25545
25558
  "imageDescribeAndCaption",
25546
25559
  "imageDescribeAndCaptionFallback",
@@ -25599,7 +25612,9 @@ async function downloadEncryptedFile(fileId, apiKey, timeoutMs) {
25599
25612
  if (!downloadUrl) {
25600
25613
  throw new Error("No download URL in response");
25601
25614
  }
25602
- const fileResponse = await fetch(downloadUrl, { signal: controller.signal });
25615
+ const fileResponse = await fetch(downloadUrl, {
25616
+ signal: controller.signal
25617
+ });
25603
25618
  if (!fileResponse.ok) {
25604
25619
  throw new Error(`Failed to download file: ${fileResponse.status}`);
25605
25620
  }
package/dist/core.d.ts CHANGED
@@ -29,9 +29,9 @@ export interface RvencClient extends Omit<OpenAI, "files" | "audio" | "models">
29
29
  export declare function createRvencClient(options: RvencClientOptions): Promise<RvencClient>;
30
30
  export type { ModelsClient } from "./models";
31
31
  export type { ToolsClient } from "./tools";
32
- export type { ApiErrorResponse, DEKStore, DecryptedFile, DeleteFileOptions, DeleteFileResponse, DeleteIndexOptions, DeleteIndexResponse, EncryptionKeys, FileMetadata, FileUploadOptions, GetFileOptions, IndexFileInput, IndexFilesOptions, IndexFilesResponse, ListFilesOptions, ListFilesResponse, ListModelsParams, ListModelsResponse, Model, PaginationInfo, UploadedFile } from "./types";
32
+ export type { ApiErrorResponse, DEKStore, DecryptedFile, DeleteFileOptions, DeleteFileResponse, DeleteIndexOptions, DeleteIndexResponse, EncryptionKeys, FileMetadata, FileUploadOptions, GetFileOptions, IndexFileInput, IndexFilesOptions, IndexFilesResponse, ListFilesOptions, ListFilesResponse, ListModelsParams, ListModelsResponse, Model, PaginationInfo, UploadedFile, } from "./types";
33
33
  export { generateEncryptionKeys } from "./utils/crypto";
34
34
  export { deserializeDEKStore, generateNewClientKEK, getClientKEK, getClientKID, initializeDEKStore, serializeDEKStore, } from "./utils/dek-store";
35
35
  export type { OpenAI };
36
- export { getGatewayErrorMessage, isAttestationError, isGatewayError, loadPrem } from './utils/attestation';
36
+ export { getGatewayErrorMessage, isAttestationError, isGatewayError, loadPrem, } from "./utils/attestation";
37
37
  export default createRvencClient;
@@ -1,13 +1,13 @@
1
- import type { DEKStore, DeleteFileOptions, DeleteIndexOptions, DeleteIndexResponse, FileMetadata, FileUploadOptions, GetFileOptions, IndexFilesOptions, IndexFilesResponse, ListFilesOptions, ListFilesResponse, UploadedFile } from '../types';
1
+ import type { DEKStore, DeleteFileOptions, DeleteIndexOptions, DeleteIndexResponse, FileMetadata, FileUploadOptions, GetFileOptions, IndexFilesOptions, IndexFilesResponse, ListFilesOptions, ListFilesResponse, UploadedFile } from "../types";
2
2
  export declare function uploadFile(apiKey: string, dekStore: DEKStore, options: FileUploadOptions, clientKEK?: string, timeoutMs?: number): Promise<UploadedFile>;
3
- export declare function listFiles(apiKey: string, options?: ListFilesOptions, timeoutMs?: number): Promise<ListFilesResponse['data']>;
3
+ export declare function listFiles(apiKey: string, options?: ListFilesOptions, timeoutMs?: number): Promise<ListFilesResponse["data"]>;
4
4
  export declare function getFile(apiKey: string, options: GetFileOptions, timeoutMs?: number): Promise<FileMetadata>;
5
5
  export declare function deleteFile(apiKey: string, options: DeleteFileOptions, timeoutMs?: number): Promise<void>;
6
6
  export declare function indexFiles(apiKey: string, dekStore: DEKStore, options: IndexFilesOptions, clientKEK?: string, timeoutMs?: number): Promise<IndexFilesResponse>;
7
7
  export declare function deleteIndex(apiKey: string, dekStore: DEKStore, options: DeleteIndexOptions, clientKEK?: string, timeoutMs?: number): Promise<DeleteIndexResponse>;
8
8
  export interface FilesClient {
9
9
  upload: (options: FileUploadOptions) => Promise<UploadedFile>;
10
- list: (options?: ListFilesOptions) => Promise<ListFilesResponse['data']>;
10
+ list: (options?: ListFilesOptions) => Promise<ListFilesResponse["data"]>;
11
11
  get: (options: GetFileOptions) => Promise<FileMetadata>;
12
12
  delete: (options: DeleteFileOptions) => Promise<void>;
13
13
  index: (options: IndexFilesOptions) => Promise<IndexFilesResponse>;