@superlinked/sie-sdk 0.6.3 → 0.6.5
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.cjs +173 -168
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -93
- package/dist/index.d.ts +94 -93
- package/dist/index.js +173 -168
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,91 @@
|
|
|
1
1
|
export { maxsim, maxsimBatch, maxsimDocuments } from './scoring.cjs';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Image handling utilities for the SIE TypeScript SDK.
|
|
5
|
+
*
|
|
6
|
+
* Images are serialized as bytes for transport.
|
|
7
|
+
* This module handles conversion from various input formats to Uint8Array.
|
|
8
|
+
*
|
|
9
|
+
* Supported input formats:
|
|
10
|
+
* - Uint8Array (raw bytes)
|
|
11
|
+
* - ArrayBuffer / Buffer (Node.js)
|
|
12
|
+
* - Blob / File (browser)
|
|
13
|
+
* - string (base64 or data URL)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { toImageBytes } from "@superlinked/sie-sdk";
|
|
18
|
+
*
|
|
19
|
+
* // From file input (browser)
|
|
20
|
+
* const file = document.querySelector('input[type="file"]').files[0];
|
|
21
|
+
* const bytes = await toImageBytes(file);
|
|
22
|
+
*
|
|
23
|
+
* // From base64 string
|
|
24
|
+
* const bytes = await toImageBytes(base64String);
|
|
25
|
+
*
|
|
26
|
+
* // From Uint8Array (passthrough)
|
|
27
|
+
* const bytes = await toImageBytes(existingBytes);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Type for all supported image input formats.
|
|
32
|
+
*/
|
|
33
|
+
type ImageInput = Uint8Array | ArrayBuffer | Blob | string;
|
|
34
|
+
/**
|
|
35
|
+
* Wire format for images sent to the server.
|
|
36
|
+
*/
|
|
37
|
+
interface ImageWireFormat {
|
|
38
|
+
data: Uint8Array;
|
|
39
|
+
format: "jpeg" | "png" | "webp";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Convert various image input types to Uint8Array.
|
|
43
|
+
*
|
|
44
|
+
* Accepts:
|
|
45
|
+
* - Uint8Array: passed through as-is
|
|
46
|
+
* - ArrayBuffer / Buffer: wrapped in Uint8Array
|
|
47
|
+
* - Blob / File: read as ArrayBuffer then wrapped
|
|
48
|
+
* - string: decoded from base64 or data URL
|
|
49
|
+
*
|
|
50
|
+
* @param input - Image data in any supported format
|
|
51
|
+
* @returns Image bytes as Uint8Array
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* // From base64 string
|
|
56
|
+
* const bytes = await toImageBytes(base64String);
|
|
57
|
+
*
|
|
58
|
+
* // From file (browser)
|
|
59
|
+
* const bytes = await toImageBytes(file);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare function toImageBytes(input: ImageInput): Promise<Uint8Array>;
|
|
63
|
+
/**
|
|
64
|
+
* Convert image bytes to wire format for transport.
|
|
65
|
+
*
|
|
66
|
+
* Images are sent as:
|
|
67
|
+
* `{ data: <bytes>, format: "jpeg" | "png" | "webp" }`
|
|
68
|
+
*
|
|
69
|
+
* @param input - Image data in any supported format
|
|
70
|
+
* @param format - Image format (defaults to "jpeg")
|
|
71
|
+
* @returns Image in wire format
|
|
72
|
+
*/
|
|
73
|
+
declare function toImageWireFormat(input: ImageInput, format?: "jpeg" | "png" | "webp"): Promise<ImageWireFormat>;
|
|
74
|
+
/**
|
|
75
|
+
* Detect image format from bytes (magic number check).
|
|
76
|
+
*
|
|
77
|
+
* @param bytes - Image bytes
|
|
78
|
+
* @returns Detected format or "unknown"
|
|
79
|
+
*/
|
|
80
|
+
declare function detectImageFormat(bytes: Uint8Array): "jpeg" | "png" | "webp" | "unknown";
|
|
81
|
+
|
|
3
82
|
/**
|
|
4
83
|
* Types for the SIE TypeScript SDK
|
|
5
84
|
*
|
|
6
85
|
* These types mirror the Python SDK (packages/sie_sdk/src/sie_sdk/types.py)
|
|
7
86
|
* for full feature parity.
|
|
8
87
|
*/
|
|
88
|
+
|
|
9
89
|
/**
|
|
10
90
|
* Output dtype options for quantized embeddings.
|
|
11
91
|
* Matches Python DType literal.
|
|
@@ -54,8 +134,8 @@ interface Item {
|
|
|
54
134
|
id?: string;
|
|
55
135
|
/** Text content to encode */
|
|
56
136
|
text?: string;
|
|
57
|
-
/** Images
|
|
58
|
-
images?:
|
|
137
|
+
/** Images for multimodal models; converted to wire format by the client */
|
|
138
|
+
images?: (ImageInput | ImageWireFormat)[];
|
|
59
139
|
/** Document for composite-document extractors (PDF, DOCX, HTML, ...) */
|
|
60
140
|
document?: DocumentInput;
|
|
61
141
|
/** Pre-encoded multivector (for use with maxsim utility) */
|
|
@@ -412,7 +492,7 @@ interface SIEClientOptions {
|
|
|
412
492
|
gpu?: string;
|
|
413
493
|
/** API key for authentication (sent as Bearer token) */
|
|
414
494
|
apiKey?: string;
|
|
415
|
-
/** Whether to auto-retry on
|
|
495
|
+
/** Whether to auto-retry on 503 PROVISIONING responses */
|
|
416
496
|
waitForCapacity?: boolean;
|
|
417
497
|
/** Maximum time to wait for provisioning in milliseconds (default: 300000) */
|
|
418
498
|
provisionTimeout?: number;
|
|
@@ -736,7 +816,7 @@ interface ChatCompletionChunk {
|
|
|
736
816
|
interface ChatCompletionOptions {
|
|
737
817
|
/**
|
|
738
818
|
* When `true`, retry the SAFE pre-execution capacity signals
|
|
739
|
-
* (`
|
|
819
|
+
* (`503 PROVISIONING`, `503 MODEL_LOADING`) until
|
|
740
820
|
* `provisionTimeoutMs` elapses. When `false`, the first such signal
|
|
741
821
|
* throws (`ProvisioningError` / `ModelLoadingError` / `ServerError`).
|
|
742
822
|
* Defaults to the client's `waitForCapacity` (false unless the
|
|
@@ -1103,11 +1183,11 @@ declare class SIEClient {
|
|
|
1103
1183
|
* if the consumer-supplied `extractError` returns an `SIEStreamError`, the
|
|
1104
1184
|
* generator throws it instead of yielding the chunk.
|
|
1105
1185
|
*
|
|
1106
|
-
* Retry policy mirrors {@link generate}: only
|
|
1107
|
-
* capacity signals — `
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1186
|
+
* Retry policy mirrors {@link generate}: only explicit SAFE
|
|
1187
|
+
* pre-execution capacity signals — `503 PROVISIONING` and
|
|
1188
|
+
* `503 MODEL_LOADING` — are retried while the provision budget remains.
|
|
1189
|
+
* Once the body opens we never retry (the call is non-idempotent; a
|
|
1190
|
+
* mid-stream failure must not re-issue generation).
|
|
1111
1191
|
*
|
|
1112
1192
|
* @internal
|
|
1113
1193
|
*/
|
|
@@ -1257,9 +1337,9 @@ declare class SIEClient {
|
|
|
1257
1337
|
/**
|
|
1258
1338
|
* Make a msgpack HTTP request with retry logic.
|
|
1259
1339
|
*
|
|
1260
|
-
* Retried (
|
|
1261
|
-
* -
|
|
1262
|
-
* - 503 `MODEL_LOADING` / `LORA_LOADING`
|
|
1340
|
+
* Retried (capped by `provisionTimeout`):
|
|
1341
|
+
* - 503 `PROVISIONING` when `waitForCapacity: true`
|
|
1342
|
+
* - 503 `MODEL_LOADING` / `LORA_LOADING`
|
|
1263
1343
|
* - `SIEConnectionError` with `kind === "connect"` (issue #95)
|
|
1264
1344
|
*
|
|
1265
1345
|
* `kind === "timeout"` is NOT retried — would extend the user-visible
|
|
@@ -1280,7 +1360,7 @@ declare class SIEClient {
|
|
|
1280
1360
|
private detectEndpointType;
|
|
1281
1361
|
}
|
|
1282
1362
|
|
|
1283
|
-
declare const SDK_VERSION = "0.6.
|
|
1363
|
+
declare const SDK_VERSION = "0.6.5";
|
|
1284
1364
|
|
|
1285
1365
|
/**
|
|
1286
1366
|
* Helpers for converting SIE encode results to plain JavaScript types.
|
|
@@ -1435,7 +1515,7 @@ declare class ServerError extends SIEError {
|
|
|
1435
1515
|
* Error when capacity is not available and provisioning timed out.
|
|
1436
1516
|
*
|
|
1437
1517
|
* Raised when:
|
|
1438
|
-
* - Server returns
|
|
1518
|
+
* - Server returns 503 with PROVISIONING code
|
|
1439
1519
|
* - waitForCapacity is false (caller doesn't want to wait)
|
|
1440
1520
|
* - Or provisioning timeout exceeded
|
|
1441
1521
|
*
|
|
@@ -1601,83 +1681,4 @@ declare function packMessage(data: unknown): Uint8Array;
|
|
|
1601
1681
|
*/
|
|
1602
1682
|
declare function unpackMessage<T = unknown>(data: Uint8Array): T;
|
|
1603
1683
|
|
|
1604
|
-
/**
|
|
1605
|
-
* Image handling utilities for the SIE TypeScript SDK.
|
|
1606
|
-
*
|
|
1607
|
-
* Images are serialized as bytes for transport.
|
|
1608
|
-
* This module handles conversion from various input formats to Uint8Array.
|
|
1609
|
-
*
|
|
1610
|
-
* Supported input formats:
|
|
1611
|
-
* - Uint8Array (raw bytes)
|
|
1612
|
-
* - ArrayBuffer / Buffer (Node.js)
|
|
1613
|
-
* - Blob / File (browser)
|
|
1614
|
-
* - string (base64 or data URL)
|
|
1615
|
-
*
|
|
1616
|
-
* @example
|
|
1617
|
-
* ```typescript
|
|
1618
|
-
* import { toImageBytes } from "@superlinked/sie-sdk";
|
|
1619
|
-
*
|
|
1620
|
-
* // From file input (browser)
|
|
1621
|
-
* const file = document.querySelector('input[type="file"]').files[0];
|
|
1622
|
-
* const bytes = await toImageBytes(file);
|
|
1623
|
-
*
|
|
1624
|
-
* // From base64 string
|
|
1625
|
-
* const bytes = await toImageBytes(base64String);
|
|
1626
|
-
*
|
|
1627
|
-
* // From Uint8Array (passthrough)
|
|
1628
|
-
* const bytes = await toImageBytes(existingBytes);
|
|
1629
|
-
* ```
|
|
1630
|
-
*/
|
|
1631
|
-
/**
|
|
1632
|
-
* Type for all supported image input formats.
|
|
1633
|
-
*/
|
|
1634
|
-
type ImageInput = Uint8Array | ArrayBuffer | Blob | string;
|
|
1635
|
-
/**
|
|
1636
|
-
* Wire format for images sent to the server.
|
|
1637
|
-
*/
|
|
1638
|
-
interface ImageWireFormat {
|
|
1639
|
-
data: Uint8Array;
|
|
1640
|
-
format: "jpeg" | "png" | "webp";
|
|
1641
|
-
}
|
|
1642
|
-
/**
|
|
1643
|
-
* Convert various image input types to Uint8Array.
|
|
1644
|
-
*
|
|
1645
|
-
* Accepts:
|
|
1646
|
-
* - Uint8Array: passed through as-is
|
|
1647
|
-
* - ArrayBuffer / Buffer: wrapped in Uint8Array
|
|
1648
|
-
* - Blob / File: read as ArrayBuffer then wrapped
|
|
1649
|
-
* - string: decoded from base64 or data URL
|
|
1650
|
-
*
|
|
1651
|
-
* @param input - Image data in any supported format
|
|
1652
|
-
* @returns Image bytes as Uint8Array
|
|
1653
|
-
*
|
|
1654
|
-
* @example
|
|
1655
|
-
* ```typescript
|
|
1656
|
-
* // From base64 string
|
|
1657
|
-
* const bytes = await toImageBytes(base64String);
|
|
1658
|
-
*
|
|
1659
|
-
* // From file (browser)
|
|
1660
|
-
* const bytes = await toImageBytes(file);
|
|
1661
|
-
* ```
|
|
1662
|
-
*/
|
|
1663
|
-
declare function toImageBytes(input: ImageInput): Promise<Uint8Array>;
|
|
1664
|
-
/**
|
|
1665
|
-
* Convert image bytes to wire format for transport.
|
|
1666
|
-
*
|
|
1667
|
-
* Images are sent as:
|
|
1668
|
-
* `{ data: <bytes>, format: "jpeg" | "png" | "webp" }`
|
|
1669
|
-
*
|
|
1670
|
-
* @param input - Image data in any supported format
|
|
1671
|
-
* @param format - Image format (defaults to "jpeg")
|
|
1672
|
-
* @returns Image in wire format
|
|
1673
|
-
*/
|
|
1674
|
-
declare function toImageWireFormat(input: ImageInput, format?: "jpeg" | "png" | "webp"): Promise<ImageWireFormat>;
|
|
1675
|
-
/**
|
|
1676
|
-
* Detect image format from bytes (magic number check).
|
|
1677
|
-
*
|
|
1678
|
-
* @param bytes - Image bytes
|
|
1679
|
-
* @returns Detected format or "unknown"
|
|
1680
|
-
*/
|
|
1681
|
-
declare function detectImageFormat(bytes: Uint8Array): "jpeg" | "png" | "webp" | "unknown";
|
|
1682
|
-
|
|
1683
1684
|
export { type CapacityInfo, type ChatChoice, type ChatChunkChoice, type ChatCompletion, type ChatCompletionChunk, type ChatCompletionRequest, type ChatDelta, type ChatFinishReason, type ChatMessage, type ChatUsage, type Classification, type ClusterStatusMessage, type ClusterSummary, type ClusterWorkerInfo, type DType, type DetectedObject, type EncodeOptions, type EncodeResult, type Entity, type ExtractOptions, type ExtractResult, type FinishReason, type GPUMetrics, type GenerateChunk, type GenerateOptions, type GenerateResult, type GenerationUsage, type ImageInput, type ImageWireFormat, InputTooLongError, type Item, LoraLoadingError, type ModelCapabilities, type ModelConfig, type ModelDims, type ModelInfo, ModelLoadFailedError, ModelLoadingError, type ModelState, type ModelStatus, type ModelSummary, type OutputType, PoolError, type PoolInfo, type PoolSpec, type PoolStatus, ProvisioningError, type Relation, RequestError, type ResponseFormat, SDK_VERSION, SIEClient, type SIEClientOptions, SIEConnectionError, SIEError, SIEStreamError, type ScoreEntry, type ScoreOptions, type ScoreResult, ServerError, type ServerInfo, type SparseResult, type SparseVector, type StatusMessage, type TimingInfo, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolSpec, type WorkerInfo, type WorkerStatusMessage, denseEmbedding, detectImageFormat, multivectorEmbedding, normalizeSparseVector, packMessage, sparseEmbedding, sparseEmbeddingMap, toFloat32Array, toImageBytes, toImageWireFormat, toNumberArray, unpackMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,91 @@
|
|
|
1
1
|
export { maxsim, maxsimBatch, maxsimDocuments } from './scoring.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Image handling utilities for the SIE TypeScript SDK.
|
|
5
|
+
*
|
|
6
|
+
* Images are serialized as bytes for transport.
|
|
7
|
+
* This module handles conversion from various input formats to Uint8Array.
|
|
8
|
+
*
|
|
9
|
+
* Supported input formats:
|
|
10
|
+
* - Uint8Array (raw bytes)
|
|
11
|
+
* - ArrayBuffer / Buffer (Node.js)
|
|
12
|
+
* - Blob / File (browser)
|
|
13
|
+
* - string (base64 or data URL)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { toImageBytes } from "@superlinked/sie-sdk";
|
|
18
|
+
*
|
|
19
|
+
* // From file input (browser)
|
|
20
|
+
* const file = document.querySelector('input[type="file"]').files[0];
|
|
21
|
+
* const bytes = await toImageBytes(file);
|
|
22
|
+
*
|
|
23
|
+
* // From base64 string
|
|
24
|
+
* const bytes = await toImageBytes(base64String);
|
|
25
|
+
*
|
|
26
|
+
* // From Uint8Array (passthrough)
|
|
27
|
+
* const bytes = await toImageBytes(existingBytes);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Type for all supported image input formats.
|
|
32
|
+
*/
|
|
33
|
+
type ImageInput = Uint8Array | ArrayBuffer | Blob | string;
|
|
34
|
+
/**
|
|
35
|
+
* Wire format for images sent to the server.
|
|
36
|
+
*/
|
|
37
|
+
interface ImageWireFormat {
|
|
38
|
+
data: Uint8Array;
|
|
39
|
+
format: "jpeg" | "png" | "webp";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Convert various image input types to Uint8Array.
|
|
43
|
+
*
|
|
44
|
+
* Accepts:
|
|
45
|
+
* - Uint8Array: passed through as-is
|
|
46
|
+
* - ArrayBuffer / Buffer: wrapped in Uint8Array
|
|
47
|
+
* - Blob / File: read as ArrayBuffer then wrapped
|
|
48
|
+
* - string: decoded from base64 or data URL
|
|
49
|
+
*
|
|
50
|
+
* @param input - Image data in any supported format
|
|
51
|
+
* @returns Image bytes as Uint8Array
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* // From base64 string
|
|
56
|
+
* const bytes = await toImageBytes(base64String);
|
|
57
|
+
*
|
|
58
|
+
* // From file (browser)
|
|
59
|
+
* const bytes = await toImageBytes(file);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare function toImageBytes(input: ImageInput): Promise<Uint8Array>;
|
|
63
|
+
/**
|
|
64
|
+
* Convert image bytes to wire format for transport.
|
|
65
|
+
*
|
|
66
|
+
* Images are sent as:
|
|
67
|
+
* `{ data: <bytes>, format: "jpeg" | "png" | "webp" }`
|
|
68
|
+
*
|
|
69
|
+
* @param input - Image data in any supported format
|
|
70
|
+
* @param format - Image format (defaults to "jpeg")
|
|
71
|
+
* @returns Image in wire format
|
|
72
|
+
*/
|
|
73
|
+
declare function toImageWireFormat(input: ImageInput, format?: "jpeg" | "png" | "webp"): Promise<ImageWireFormat>;
|
|
74
|
+
/**
|
|
75
|
+
* Detect image format from bytes (magic number check).
|
|
76
|
+
*
|
|
77
|
+
* @param bytes - Image bytes
|
|
78
|
+
* @returns Detected format or "unknown"
|
|
79
|
+
*/
|
|
80
|
+
declare function detectImageFormat(bytes: Uint8Array): "jpeg" | "png" | "webp" | "unknown";
|
|
81
|
+
|
|
3
82
|
/**
|
|
4
83
|
* Types for the SIE TypeScript SDK
|
|
5
84
|
*
|
|
6
85
|
* These types mirror the Python SDK (packages/sie_sdk/src/sie_sdk/types.py)
|
|
7
86
|
* for full feature parity.
|
|
8
87
|
*/
|
|
88
|
+
|
|
9
89
|
/**
|
|
10
90
|
* Output dtype options for quantized embeddings.
|
|
11
91
|
* Matches Python DType literal.
|
|
@@ -54,8 +134,8 @@ interface Item {
|
|
|
54
134
|
id?: string;
|
|
55
135
|
/** Text content to encode */
|
|
56
136
|
text?: string;
|
|
57
|
-
/** Images
|
|
58
|
-
images?:
|
|
137
|
+
/** Images for multimodal models; converted to wire format by the client */
|
|
138
|
+
images?: (ImageInput | ImageWireFormat)[];
|
|
59
139
|
/** Document for composite-document extractors (PDF, DOCX, HTML, ...) */
|
|
60
140
|
document?: DocumentInput;
|
|
61
141
|
/** Pre-encoded multivector (for use with maxsim utility) */
|
|
@@ -412,7 +492,7 @@ interface SIEClientOptions {
|
|
|
412
492
|
gpu?: string;
|
|
413
493
|
/** API key for authentication (sent as Bearer token) */
|
|
414
494
|
apiKey?: string;
|
|
415
|
-
/** Whether to auto-retry on
|
|
495
|
+
/** Whether to auto-retry on 503 PROVISIONING responses */
|
|
416
496
|
waitForCapacity?: boolean;
|
|
417
497
|
/** Maximum time to wait for provisioning in milliseconds (default: 300000) */
|
|
418
498
|
provisionTimeout?: number;
|
|
@@ -736,7 +816,7 @@ interface ChatCompletionChunk {
|
|
|
736
816
|
interface ChatCompletionOptions {
|
|
737
817
|
/**
|
|
738
818
|
* When `true`, retry the SAFE pre-execution capacity signals
|
|
739
|
-
* (`
|
|
819
|
+
* (`503 PROVISIONING`, `503 MODEL_LOADING`) until
|
|
740
820
|
* `provisionTimeoutMs` elapses. When `false`, the first such signal
|
|
741
821
|
* throws (`ProvisioningError` / `ModelLoadingError` / `ServerError`).
|
|
742
822
|
* Defaults to the client's `waitForCapacity` (false unless the
|
|
@@ -1103,11 +1183,11 @@ declare class SIEClient {
|
|
|
1103
1183
|
* if the consumer-supplied `extractError` returns an `SIEStreamError`, the
|
|
1104
1184
|
* generator throws it instead of yielding the chunk.
|
|
1105
1185
|
*
|
|
1106
|
-
* Retry policy mirrors {@link generate}: only
|
|
1107
|
-
* capacity signals — `
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1186
|
+
* Retry policy mirrors {@link generate}: only explicit SAFE
|
|
1187
|
+
* pre-execution capacity signals — `503 PROVISIONING` and
|
|
1188
|
+
* `503 MODEL_LOADING` — are retried while the provision budget remains.
|
|
1189
|
+
* Once the body opens we never retry (the call is non-idempotent; a
|
|
1190
|
+
* mid-stream failure must not re-issue generation).
|
|
1111
1191
|
*
|
|
1112
1192
|
* @internal
|
|
1113
1193
|
*/
|
|
@@ -1257,9 +1337,9 @@ declare class SIEClient {
|
|
|
1257
1337
|
/**
|
|
1258
1338
|
* Make a msgpack HTTP request with retry logic.
|
|
1259
1339
|
*
|
|
1260
|
-
* Retried (
|
|
1261
|
-
* -
|
|
1262
|
-
* - 503 `MODEL_LOADING` / `LORA_LOADING`
|
|
1340
|
+
* Retried (capped by `provisionTimeout`):
|
|
1341
|
+
* - 503 `PROVISIONING` when `waitForCapacity: true`
|
|
1342
|
+
* - 503 `MODEL_LOADING` / `LORA_LOADING`
|
|
1263
1343
|
* - `SIEConnectionError` with `kind === "connect"` (issue #95)
|
|
1264
1344
|
*
|
|
1265
1345
|
* `kind === "timeout"` is NOT retried — would extend the user-visible
|
|
@@ -1280,7 +1360,7 @@ declare class SIEClient {
|
|
|
1280
1360
|
private detectEndpointType;
|
|
1281
1361
|
}
|
|
1282
1362
|
|
|
1283
|
-
declare const SDK_VERSION = "0.6.
|
|
1363
|
+
declare const SDK_VERSION = "0.6.5";
|
|
1284
1364
|
|
|
1285
1365
|
/**
|
|
1286
1366
|
* Helpers for converting SIE encode results to plain JavaScript types.
|
|
@@ -1435,7 +1515,7 @@ declare class ServerError extends SIEError {
|
|
|
1435
1515
|
* Error when capacity is not available and provisioning timed out.
|
|
1436
1516
|
*
|
|
1437
1517
|
* Raised when:
|
|
1438
|
-
* - Server returns
|
|
1518
|
+
* - Server returns 503 with PROVISIONING code
|
|
1439
1519
|
* - waitForCapacity is false (caller doesn't want to wait)
|
|
1440
1520
|
* - Or provisioning timeout exceeded
|
|
1441
1521
|
*
|
|
@@ -1601,83 +1681,4 @@ declare function packMessage(data: unknown): Uint8Array;
|
|
|
1601
1681
|
*/
|
|
1602
1682
|
declare function unpackMessage<T = unknown>(data: Uint8Array): T;
|
|
1603
1683
|
|
|
1604
|
-
/**
|
|
1605
|
-
* Image handling utilities for the SIE TypeScript SDK.
|
|
1606
|
-
*
|
|
1607
|
-
* Images are serialized as bytes for transport.
|
|
1608
|
-
* This module handles conversion from various input formats to Uint8Array.
|
|
1609
|
-
*
|
|
1610
|
-
* Supported input formats:
|
|
1611
|
-
* - Uint8Array (raw bytes)
|
|
1612
|
-
* - ArrayBuffer / Buffer (Node.js)
|
|
1613
|
-
* - Blob / File (browser)
|
|
1614
|
-
* - string (base64 or data URL)
|
|
1615
|
-
*
|
|
1616
|
-
* @example
|
|
1617
|
-
* ```typescript
|
|
1618
|
-
* import { toImageBytes } from "@superlinked/sie-sdk";
|
|
1619
|
-
*
|
|
1620
|
-
* // From file input (browser)
|
|
1621
|
-
* const file = document.querySelector('input[type="file"]').files[0];
|
|
1622
|
-
* const bytes = await toImageBytes(file);
|
|
1623
|
-
*
|
|
1624
|
-
* // From base64 string
|
|
1625
|
-
* const bytes = await toImageBytes(base64String);
|
|
1626
|
-
*
|
|
1627
|
-
* // From Uint8Array (passthrough)
|
|
1628
|
-
* const bytes = await toImageBytes(existingBytes);
|
|
1629
|
-
* ```
|
|
1630
|
-
*/
|
|
1631
|
-
/**
|
|
1632
|
-
* Type for all supported image input formats.
|
|
1633
|
-
*/
|
|
1634
|
-
type ImageInput = Uint8Array | ArrayBuffer | Blob | string;
|
|
1635
|
-
/**
|
|
1636
|
-
* Wire format for images sent to the server.
|
|
1637
|
-
*/
|
|
1638
|
-
interface ImageWireFormat {
|
|
1639
|
-
data: Uint8Array;
|
|
1640
|
-
format: "jpeg" | "png" | "webp";
|
|
1641
|
-
}
|
|
1642
|
-
/**
|
|
1643
|
-
* Convert various image input types to Uint8Array.
|
|
1644
|
-
*
|
|
1645
|
-
* Accepts:
|
|
1646
|
-
* - Uint8Array: passed through as-is
|
|
1647
|
-
* - ArrayBuffer / Buffer: wrapped in Uint8Array
|
|
1648
|
-
* - Blob / File: read as ArrayBuffer then wrapped
|
|
1649
|
-
* - string: decoded from base64 or data URL
|
|
1650
|
-
*
|
|
1651
|
-
* @param input - Image data in any supported format
|
|
1652
|
-
* @returns Image bytes as Uint8Array
|
|
1653
|
-
*
|
|
1654
|
-
* @example
|
|
1655
|
-
* ```typescript
|
|
1656
|
-
* // From base64 string
|
|
1657
|
-
* const bytes = await toImageBytes(base64String);
|
|
1658
|
-
*
|
|
1659
|
-
* // From file (browser)
|
|
1660
|
-
* const bytes = await toImageBytes(file);
|
|
1661
|
-
* ```
|
|
1662
|
-
*/
|
|
1663
|
-
declare function toImageBytes(input: ImageInput): Promise<Uint8Array>;
|
|
1664
|
-
/**
|
|
1665
|
-
* Convert image bytes to wire format for transport.
|
|
1666
|
-
*
|
|
1667
|
-
* Images are sent as:
|
|
1668
|
-
* `{ data: <bytes>, format: "jpeg" | "png" | "webp" }`
|
|
1669
|
-
*
|
|
1670
|
-
* @param input - Image data in any supported format
|
|
1671
|
-
* @param format - Image format (defaults to "jpeg")
|
|
1672
|
-
* @returns Image in wire format
|
|
1673
|
-
*/
|
|
1674
|
-
declare function toImageWireFormat(input: ImageInput, format?: "jpeg" | "png" | "webp"): Promise<ImageWireFormat>;
|
|
1675
|
-
/**
|
|
1676
|
-
* Detect image format from bytes (magic number check).
|
|
1677
|
-
*
|
|
1678
|
-
* @param bytes - Image bytes
|
|
1679
|
-
* @returns Detected format or "unknown"
|
|
1680
|
-
*/
|
|
1681
|
-
declare function detectImageFormat(bytes: Uint8Array): "jpeg" | "png" | "webp" | "unknown";
|
|
1682
|
-
|
|
1683
1684
|
export { type CapacityInfo, type ChatChoice, type ChatChunkChoice, type ChatCompletion, type ChatCompletionChunk, type ChatCompletionRequest, type ChatDelta, type ChatFinishReason, type ChatMessage, type ChatUsage, type Classification, type ClusterStatusMessage, type ClusterSummary, type ClusterWorkerInfo, type DType, type DetectedObject, type EncodeOptions, type EncodeResult, type Entity, type ExtractOptions, type ExtractResult, type FinishReason, type GPUMetrics, type GenerateChunk, type GenerateOptions, type GenerateResult, type GenerationUsage, type ImageInput, type ImageWireFormat, InputTooLongError, type Item, LoraLoadingError, type ModelCapabilities, type ModelConfig, type ModelDims, type ModelInfo, ModelLoadFailedError, ModelLoadingError, type ModelState, type ModelStatus, type ModelSummary, type OutputType, PoolError, type PoolInfo, type PoolSpec, type PoolStatus, ProvisioningError, type Relation, RequestError, type ResponseFormat, SDK_VERSION, SIEClient, type SIEClientOptions, SIEConnectionError, SIEError, SIEStreamError, type ScoreEntry, type ScoreOptions, type ScoreResult, ServerError, type ServerInfo, type SparseResult, type SparseVector, type StatusMessage, type TimingInfo, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolSpec, type WorkerInfo, type WorkerStatusMessage, denseEmbedding, detectImageFormat, multivectorEmbedding, normalizeSparseVector, packMessage, sparseEmbedding, sparseEmbeddingMap, toFloat32Array, toImageBytes, toImageWireFormat, toNumberArray, unpackMessage };
|