@superlinked/sie-sdk 0.4.1 → 0.5.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
@@ -108,6 +108,37 @@ interface ModelDims {
108
108
  sparse?: number;
109
109
  multivector?: number;
110
110
  }
111
+ /**
112
+ * Advertised model capabilities.
113
+ *
114
+ * Mirrors the gateway `capabilities` object on each `/v1/models` entry
115
+ * (`ModelCapabilitiesWire`). All fields are optional; their presence
116
+ * depends on what the model config declares. `grammar` lists the
117
+ * supported grammar kinds ("json_schema" | "regex" | "ebnf").
118
+ * `code`/`sql`/`guard` are informational flags advertising validated
119
+ * generation jobs that back the model="code"/"sql"/"guard" aliases.
120
+ *
121
+ * These flags mean the model *supports* a task — they are NOT a
122
+ * precision-independent quality SLA. A flag is true at the model level even
123
+ * when quality is profile/precision-dependent (e.g. `sql` quality regresses
124
+ * under FP8; route SQL-critical traffic to a BF16 bundle via the `sql` alias).
125
+ */
126
+ interface ModelCapabilities {
127
+ /** Supported grammar kinds: ["json_schema", "regex", "ebnf"] */
128
+ grammar?: string[];
129
+ /** Whether the model supports tool / function calling */
130
+ tools?: boolean;
131
+ /** Union of LoRA served-names across profiles (display summary) */
132
+ lora_adapters?: string[];
133
+ /** Per-profile LoRA served-names, keyed by profile name */
134
+ profile_lora_adapters?: Record<string, string[]>;
135
+ /** Validated for code generation; backs model="code" */
136
+ code?: boolean;
137
+ /** Supports text-to-SQL; backs model="sql". Precision-sensitive (FP8 regresses SQL) — a support flag, not a per-profile quality guarantee. */
138
+ sql?: boolean;
139
+ /** Generative guard model; backs model="guard" */
140
+ guard?: boolean;
141
+ }
111
142
  /**
112
143
  * Information about a model returned by listModels().
113
144
  */
@@ -124,6 +155,8 @@ interface ModelInfo {
124
155
  dims?: ModelDims;
125
156
  /** Maximum sequence length the model supports */
126
157
  maxSequenceLength?: number;
158
+ /** Advertised model capabilities (grammar, tools, code/sql/guard, LoRA adapters) */
159
+ capabilities?: ModelCapabilities;
127
160
  }
128
161
  /**
129
162
  * A single score entry from reranking.
@@ -1235,7 +1268,7 @@ declare class SIEClient {
1235
1268
  private detectEndpointType;
1236
1269
  }
1237
1270
 
1238
- declare const SDK_VERSION = "0.4.1";
1271
+ declare const SDK_VERSION = "0.5.0";
1239
1272
 
1240
1273
  /**
1241
1274
  * Helpers for converting SIE encode results to plain JavaScript types.
@@ -1559,7 +1592,7 @@ declare function unpackMessage<T = unknown>(data: Uint8Array): T;
1559
1592
  /**
1560
1593
  * Image handling utilities for the SIE TypeScript SDK.
1561
1594
  *
1562
- * Per design.md Section 4.3, images are serialized as bytes for transport.
1595
+ * Images are serialized as bytes for transport.
1563
1596
  * This module handles conversion from various input formats to Uint8Array.
1564
1597
  *
1565
1598
  * Supported input formats:
@@ -1589,7 +1622,6 @@ declare function unpackMessage<T = unknown>(data: Uint8Array): T;
1589
1622
  type ImageInput = Uint8Array | ArrayBuffer | Blob | string;
1590
1623
  /**
1591
1624
  * Wire format for images sent to the server.
1592
- * Per design.md Section 4.3.
1593
1625
  */
1594
1626
  interface ImageWireFormat {
1595
1627
  data: Uint8Array;
@@ -1620,7 +1652,7 @@ declare function toImageBytes(input: ImageInput): Promise<Uint8Array>;
1620
1652
  /**
1621
1653
  * Convert image bytes to wire format for transport.
1622
1654
  *
1623
- * Per design.md Section 4.3, images are sent as:
1655
+ * Images are sent as:
1624
1656
  * `{ data: <bytes>, format: "jpeg" | "png" | "webp" }`
1625
1657
  *
1626
1658
  * @param input - Image data in any supported format
@@ -1636,4 +1668,4 @@ declare function toImageWireFormat(input: ImageInput, format?: "jpeg" | "png" |
1636
1668
  */
1637
1669
  declare function detectImageFormat(bytes: Uint8Array): "jpeg" | "png" | "webp" | "unknown";
1638
1670
 
1639
- 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 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 };
1671
+ 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
@@ -108,6 +108,37 @@ interface ModelDims {
108
108
  sparse?: number;
109
109
  multivector?: number;
110
110
  }
111
+ /**
112
+ * Advertised model capabilities.
113
+ *
114
+ * Mirrors the gateway `capabilities` object on each `/v1/models` entry
115
+ * (`ModelCapabilitiesWire`). All fields are optional; their presence
116
+ * depends on what the model config declares. `grammar` lists the
117
+ * supported grammar kinds ("json_schema" | "regex" | "ebnf").
118
+ * `code`/`sql`/`guard` are informational flags advertising validated
119
+ * generation jobs that back the model="code"/"sql"/"guard" aliases.
120
+ *
121
+ * These flags mean the model *supports* a task — they are NOT a
122
+ * precision-independent quality SLA. A flag is true at the model level even
123
+ * when quality is profile/precision-dependent (e.g. `sql` quality regresses
124
+ * under FP8; route SQL-critical traffic to a BF16 bundle via the `sql` alias).
125
+ */
126
+ interface ModelCapabilities {
127
+ /** Supported grammar kinds: ["json_schema", "regex", "ebnf"] */
128
+ grammar?: string[];
129
+ /** Whether the model supports tool / function calling */
130
+ tools?: boolean;
131
+ /** Union of LoRA served-names across profiles (display summary) */
132
+ lora_adapters?: string[];
133
+ /** Per-profile LoRA served-names, keyed by profile name */
134
+ profile_lora_adapters?: Record<string, string[]>;
135
+ /** Validated for code generation; backs model="code" */
136
+ code?: boolean;
137
+ /** Supports text-to-SQL; backs model="sql". Precision-sensitive (FP8 regresses SQL) — a support flag, not a per-profile quality guarantee. */
138
+ sql?: boolean;
139
+ /** Generative guard model; backs model="guard" */
140
+ guard?: boolean;
141
+ }
111
142
  /**
112
143
  * Information about a model returned by listModels().
113
144
  */
@@ -124,6 +155,8 @@ interface ModelInfo {
124
155
  dims?: ModelDims;
125
156
  /** Maximum sequence length the model supports */
126
157
  maxSequenceLength?: number;
158
+ /** Advertised model capabilities (grammar, tools, code/sql/guard, LoRA adapters) */
159
+ capabilities?: ModelCapabilities;
127
160
  }
128
161
  /**
129
162
  * A single score entry from reranking.
@@ -1235,7 +1268,7 @@ declare class SIEClient {
1235
1268
  private detectEndpointType;
1236
1269
  }
1237
1270
 
1238
- declare const SDK_VERSION = "0.4.1";
1271
+ declare const SDK_VERSION = "0.5.0";
1239
1272
 
1240
1273
  /**
1241
1274
  * Helpers for converting SIE encode results to plain JavaScript types.
@@ -1559,7 +1592,7 @@ declare function unpackMessage<T = unknown>(data: Uint8Array): T;
1559
1592
  /**
1560
1593
  * Image handling utilities for the SIE TypeScript SDK.
1561
1594
  *
1562
- * Per design.md Section 4.3, images are serialized as bytes for transport.
1595
+ * Images are serialized as bytes for transport.
1563
1596
  * This module handles conversion from various input formats to Uint8Array.
1564
1597
  *
1565
1598
  * Supported input formats:
@@ -1589,7 +1622,6 @@ declare function unpackMessage<T = unknown>(data: Uint8Array): T;
1589
1622
  type ImageInput = Uint8Array | ArrayBuffer | Blob | string;
1590
1623
  /**
1591
1624
  * Wire format for images sent to the server.
1592
- * Per design.md Section 4.3.
1593
1625
  */
1594
1626
  interface ImageWireFormat {
1595
1627
  data: Uint8Array;
@@ -1620,7 +1652,7 @@ declare function toImageBytes(input: ImageInput): Promise<Uint8Array>;
1620
1652
  /**
1621
1653
  * Convert image bytes to wire format for transport.
1622
1654
  *
1623
- * Per design.md Section 4.3, images are sent as:
1655
+ * Images are sent as:
1624
1656
  * `{ data: <bytes>, format: "jpeg" | "png" | "webp" }`
1625
1657
  *
1626
1658
  * @param input - Image data in any supported format
@@ -1636,4 +1668,4 @@ declare function toImageWireFormat(input: ImageInput, format?: "jpeg" | "png" |
1636
1668
  */
1637
1669
  declare function detectImageFormat(bytes: Uint8Array): "jpeg" | "png" | "webp" | "unknown";
1638
1670
 
1639
- 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 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 };
1671
+ 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.js CHANGED
@@ -269,7 +269,7 @@ function packMessage(data) {
269
269
  return encode(data, { extensionCodec });
270
270
  }
271
271
  function isNumpyArrayMap(obj) {
272
- if (typeof obj !== "object" || obj === null) {
272
+ if (obj === null || typeof obj !== "object") {
273
273
  return false;
274
274
  }
275
275
  const map = obj;
@@ -796,7 +796,7 @@ function extractDataPayload(block) {
796
796
  }
797
797
 
798
798
  // src/version.ts
799
- var SDK_VERSION = "0.4.1";
799
+ var SDK_VERSION = "0.5.0";
800
800
 
801
801
  // src/client.ts
802
802
  function sleep2(ms) {
@@ -2091,10 +2091,11 @@ var SIEClient = class {
2091
2091
  createWebSocket(url) {
2092
2092
  const headers = this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : void 0;
2093
2093
  try {
2094
- if (headers) {
2095
- return new WebSocket(url, [], { headers });
2094
+ if (!headers) {
2095
+ return new WebSocket(url);
2096
2096
  }
2097
- return new WebSocket(url);
2097
+ const args = [url, [], { headers }];
2098
+ return Reflect.construct(WebSocket, args);
2098
2099
  } catch (error) {
2099
2100
  if (headers) {
2100
2101
  throw new SIEConnectionError(