@xberg-io/liter-llm-wasm 2.0.2 → 2.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.
@@ -8,6 +8,58 @@
8
8
 
9
9
  export type ReadableStreamType = "bytes";
10
10
 
11
+ export interface WasmSystemMessageCamelWire {
12
+ content: WasmUserContent;
13
+ name: string | undefined;
14
+ }
15
+
16
+ export interface WasmUserMessageCamelWire {
17
+ content: WasmUserContent;
18
+ name: string | undefined;
19
+ }
20
+
21
+ export type WasmToolTypeWire = "function";
22
+
23
+ export interface WasmFunctionCallCamelWire {
24
+ name: string;
25
+ "arguments": string;
26
+ }
27
+
28
+ export interface WasmToolCallCamelWire {
29
+ id: string;
30
+ type: WasmToolTypeWire;
31
+ "function": WasmFunctionCallCamelWire;
32
+ }
33
+
34
+ export interface WasmAssistantMessageCamelWire {
35
+ content: WasmAssistantContent | undefined;
36
+ name: string | undefined;
37
+ toolCalls: WasmToolCallCamelWire[] | undefined;
38
+ refusal: string | undefined;
39
+ functionCall: WasmFunctionCallCamelWire | undefined;
40
+ reasoningContent: string | undefined;
41
+ }
42
+
43
+ export interface WasmToolMessageCamelWire {
44
+ content: WasmUserContent;
45
+ toolCallId: string;
46
+ name: string | undefined;
47
+ }
48
+
49
+ export interface WasmDeveloperMessageCamelWire {
50
+ content: string;
51
+ name: string | undefined;
52
+ }
53
+
54
+ export interface WasmFunctionMessageCamelWire {
55
+ content: string;
56
+ name: string;
57
+ }
58
+
59
+ export type WasmMessage = ({ role: "system" } & WasmSystemMessageCamelWire) | ({ role: "user" } & WasmUserMessageCamelWire) | ({ role: "assistant" } & WasmAssistantMessageCamelWire) | ({ role: "tool" } & WasmToolMessageCamelWire) | ({ role: "developer" } & WasmDeveloperMessageCamelWire) | ({ role: "function" } & WasmFunctionMessageCamelWire);
60
+
61
+
62
+
11
63
  export type WasmEmbeddingInput = string | string[] | any[];
12
64
 
13
65
  export type WasmModerationInput = string | string[];
@@ -291,6 +343,11 @@ export enum WasmBatchStatus {
291
343
  * `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`,
292
344
  * `BEDROCK_CROSS_REGION`).
293
345
  *
346
+ * A Bedrock API key in `AWS_BEARER_TOKEN_BEDROCK` authenticates on its own and
347
+ * needs none of the credential fields below. It is read per request rather than
348
+ * from this struct; in a build that can sign (the `bedrock` feature) a credential
349
+ * set here takes precedence over it.
350
+ *
294
351
  * Implements `Debug` manually (see below) so the AWS credential fields are
295
352
  * redacted rather than printed in full.
296
353
  */
@@ -1163,19 +1220,6 @@ export class WasmLlmRateLimitConfig {
1163
1220
  set windowSeconds(value: bigint | null | undefined);
1164
1221
  }
1165
1222
 
1166
- /**
1167
- * A chat message in a conversation.
1168
- */
1169
- export class WasmMessage {
1170
- free(): void;
1171
- [Symbol.dispose](): void;
1172
- static default(): WasmMessage;
1173
- constructor();
1174
- get 0(): any | undefined;
1175
- set 0(value: any | null | undefined);
1176
- role: string;
1177
- }
1178
-
1179
1223
  /**
1180
1224
  * Output modality requested from the model.
1181
1225
  *
@@ -2280,7 +2324,6 @@ export interface InitOutput {
2280
2324
  readonly __wbg_wasmllminflightlimitconfig_free: (a: number, b: number) => void;
2281
2325
  readonly __wbg_wasmllmproviderconfig_free: (a: number, b: number) => void;
2282
2326
  readonly __wbg_wasmllmratelimitconfig_free: (a: number, b: number) => void;
2283
- readonly __wbg_wasmmessage_free: (a: number, b: number) => void;
2284
2327
  readonly __wbg_wasmmodelinfo_free: (a: number, b: number) => void;
2285
2328
  readonly __wbg_wasmmodelobject_free: (a: number, b: number) => void;
2286
2329
  readonly __wbg_wasmmodelslistresponse_free: (a: number, b: number) => void;
@@ -2957,12 +3000,6 @@ export interface InitOutput {
2957
3000
  readonly wasmllmratelimitconfig_set_windowSeconds: (a: number, b: number, c: bigint) => void;
2958
3001
  readonly wasmllmratelimitconfig_tpm: (a: number) => [number, bigint];
2959
3002
  readonly wasmllmratelimitconfig_windowSeconds: (a: number) => [number, bigint];
2960
- readonly wasmmessage_0: (a: number) => any;
2961
- readonly wasmmessage_default: () => number;
2962
- readonly wasmmessage_new: () => number;
2963
- readonly wasmmessage_role: (a: number) => [number, number];
2964
- readonly wasmmessage_set_0: (a: number, b: number) => void;
2965
- readonly wasmmessage_set_role: (a: number, b: number, c: number) => void;
2966
3003
  readonly wasmmodelinfo_cacheCreationInputTokenCost: (a: number) => [number, number];
2967
3004
  readonly wasmmodelinfo_cacheReadInputTokenCost: (a: number) => [number, number];
2968
3005
  readonly wasmmodelinfo_default: () => number;
@@ -3419,11 +3456,11 @@ export interface InitOutput {
3419
3456
  readonly wasmwaitforbatchconfig_set_maxIntervalSecs: (a: number, b: number) => void;
3420
3457
  readonly wasmwaitforbatchconfig_set_timeoutSecs: (a: number, b: number, c: number) => void;
3421
3458
  readonly wasmwaitforbatchconfig_timeoutSecs: (a: number) => [number, number];
3422
- readonly wasm_bindgen__convert__closures_____invoke__h58f5f76183c776b1: (a: number, b: number, c: any, d: any) => void;
3423
- readonly wasm_bindgen__convert__closures_____invoke__h89fbef3cc8554636: (a: number, b: number, c: any) => [number, number];
3424
- readonly wasm_bindgen__convert__closures_____invoke__hbf60977c72e260f8: (a: number, b: number, c: any) => void;
3425
- readonly wasm_bindgen__convert__closures_____invoke__h32fc22cfd630daec: (a: number, b: number) => void;
3426
- readonly wasm_bindgen__convert__closures_____invoke__h61b63dbff0bd13e3: (a: number, b: number) => void;
3459
+ readonly wasm_bindgen__convert__closures_____invoke__h02a7923578afc9b7: (a: number, b: number, c: any) => [number, number];
3460
+ readonly wasm_bindgen__convert__closures_____invoke__h587dbcc500240430: (a: number, b: number, c: any, d: any) => void;
3461
+ readonly wasm_bindgen__convert__closures_____invoke__hdbfd17fbffcf2c62: (a: number, b: number, c: any) => void;
3462
+ readonly wasm_bindgen__convert__closures_____invoke__h2b32076d58b95548: (a: number, b: number) => void;
3463
+ readonly wasm_bindgen__convert__closures_____invoke__h53a93f9ee7253a16: (a: number, b: number) => void;
3427
3464
  readonly __wbindgen_malloc: (a: number, b: number) => number;
3428
3465
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
3429
3466
  readonly __wbindgen_exn_store: (a: number) => void;
package/liter_llm_wasm.js CHANGED
@@ -1437,6 +1437,11 @@ export const WasmBatchStatus = Object.freeze({
1437
1437
  * `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`,
1438
1438
  * `BEDROCK_CROSS_REGION`).
1439
1439
  *
1440
+ * A Bedrock API key in `AWS_BEARER_TOKEN_BEDROCK` authenticates on its own and
1441
+ * needs none of the credential fields below. It is read per request rather than
1442
+ * from this struct; in a build that can sign (the `bedrock` feature) a credential
1443
+ * set here takes precedence over it.
1444
+ *
1440
1445
  * Implements `Debug` manually (see below) so the AWS credential fields are
1441
1446
  * redacted rather than printed in full.
1442
1447
  */
@@ -7301,78 +7306,6 @@ export class WasmLlmRateLimitConfig {
7301
7306
  }
7302
7307
  if (Symbol.dispose) WasmLlmRateLimitConfig.prototype[Symbol.dispose] = WasmLlmRateLimitConfig.prototype.free;
7303
7308
 
7304
- /**
7305
- * A chat message in a conversation.
7306
- */
7307
- export class WasmMessage {
7308
- static __wrap(ptr) {
7309
- const obj = Object.create(WasmMessage.prototype);
7310
- obj.__wbg_ptr = ptr;
7311
- WasmMessageFinalization.register(obj, obj.__wbg_ptr, obj);
7312
- return obj;
7313
- }
7314
- __destroy_into_raw() {
7315
- const ptr = this.__wbg_ptr;
7316
- this.__wbg_ptr = 0;
7317
- WasmMessageFinalization.unregister(this);
7318
- return ptr;
7319
- }
7320
- free() {
7321
- const ptr = this.__destroy_into_raw();
7322
- wasm.__wbg_wasmmessage_free(ptr, 0);
7323
- }
7324
- /**
7325
- * @returns {any | undefined}
7326
- */
7327
- get 0() {
7328
- const ret = wasm.wasmmessage_0(this.__wbg_ptr);
7329
- return ret;
7330
- }
7331
- /**
7332
- * @returns {WasmMessage}
7333
- */
7334
- static default() {
7335
- const ret = wasm.wasmmessage_default();
7336
- return WasmMessage.__wrap(ret);
7337
- }
7338
- constructor() {
7339
- const ret = wasm.wasmmessage_new();
7340
- this.__wbg_ptr = ret;
7341
- WasmMessageFinalization.register(this, this.__wbg_ptr, this);
7342
- return this;
7343
- }
7344
- /**
7345
- * @returns {string}
7346
- */
7347
- get role() {
7348
- let deferred1_0;
7349
- let deferred1_1;
7350
- try {
7351
- const ret = wasm.wasmmessage_role(this.__wbg_ptr);
7352
- deferred1_0 = ret[0];
7353
- deferred1_1 = ret[1];
7354
- return getStringFromWasm0(ret[0], ret[1]);
7355
- } finally {
7356
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
7357
- }
7358
- }
7359
- /**
7360
- * @param {any | null} [value]
7361
- */
7362
- set 0(value) {
7363
- wasm.wasmmessage_set_0(this.__wbg_ptr, isLikeNone(value) ? 0 : addToExternrefTable0(value));
7364
- }
7365
- /**
7366
- * @param {string} value
7367
- */
7368
- set role(value) {
7369
- const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7370
- const len0 = WASM_VECTOR_LEN;
7371
- wasm.wasmmessage_set_role(this.__wbg_ptr, ptr0, len0);
7372
- }
7373
- }
7374
- if (Symbol.dispose) WasmMessage.prototype[Symbol.dispose] = WasmMessage.prototype.free;
7375
-
7376
7309
  /**
7377
7310
  * Output modality requested from the model.
7378
7311
  *
@@ -13337,7 +13270,7 @@ function __wbg_get_imports() {
13337
13270
  const a = state0.a;
13338
13271
  state0.a = 0;
13339
13272
  try {
13340
- return wasm_bindgen__convert__closures_____invoke__h58f5f76183c776b1(a, state0.b, arg0, arg1);
13273
+ return wasm_bindgen__convert__closures_____invoke__h587dbcc500240430(a, state0.b, arg0, arg1);
13341
13274
  } finally {
13342
13275
  state0.a = a;
13343
13276
  }
@@ -13739,23 +13672,23 @@ function __wbg_get_imports() {
13739
13672
  return ret;
13740
13673
  },
13741
13674
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
13742
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 905, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13743
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbf60977c72e260f8);
13675
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 923, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13676
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hdbfd17fbffcf2c62);
13744
13677
  return ret;
13745
13678
  },
13746
13679
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
13747
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 920, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
13748
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h89fbef3cc8554636);
13680
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 938, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
13681
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h02a7923578afc9b7);
13749
13682
  return ret;
13750
13683
  },
13751
13684
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
13752
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 820, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13753
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h32fc22cfd630daec);
13685
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 838, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13686
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h53a93f9ee7253a16);
13754
13687
  return ret;
13755
13688
  },
13756
13689
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
13757
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 853, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13758
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h61b63dbff0bd13e3);
13690
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 871, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13691
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2b32076d58b95548);
13759
13692
  return ret;
13760
13693
  },
13761
13694
  __wbindgen_generic_0000000000000005: function(arg0) {
@@ -13801,27 +13734,27 @@ function __wbg_get_imports() {
13801
13734
  };
13802
13735
  }
13803
13736
 
13804
- function wasm_bindgen__convert__closures_____invoke__h32fc22cfd630daec(arg0, arg1) {
13805
- wasm.wasm_bindgen__convert__closures_____invoke__h32fc22cfd630daec(arg0, arg1);
13737
+ function wasm_bindgen__convert__closures_____invoke__h53a93f9ee7253a16(arg0, arg1) {
13738
+ wasm.wasm_bindgen__convert__closures_____invoke__h53a93f9ee7253a16(arg0, arg1);
13806
13739
  }
13807
13740
 
13808
- function wasm_bindgen__convert__closures_____invoke__h61b63dbff0bd13e3(arg0, arg1) {
13809
- wasm.wasm_bindgen__convert__closures_____invoke__h61b63dbff0bd13e3(arg0, arg1);
13741
+ function wasm_bindgen__convert__closures_____invoke__h2b32076d58b95548(arg0, arg1) {
13742
+ wasm.wasm_bindgen__convert__closures_____invoke__h2b32076d58b95548(arg0, arg1);
13810
13743
  }
13811
13744
 
13812
- function wasm_bindgen__convert__closures_____invoke__hbf60977c72e260f8(arg0, arg1, arg2) {
13813
- wasm.wasm_bindgen__convert__closures_____invoke__hbf60977c72e260f8(arg0, arg1, arg2);
13745
+ function wasm_bindgen__convert__closures_____invoke__hdbfd17fbffcf2c62(arg0, arg1, arg2) {
13746
+ wasm.wasm_bindgen__convert__closures_____invoke__hdbfd17fbffcf2c62(arg0, arg1, arg2);
13814
13747
  }
13815
13748
 
13816
- function wasm_bindgen__convert__closures_____invoke__h89fbef3cc8554636(arg0, arg1, arg2) {
13817
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h89fbef3cc8554636(arg0, arg1, arg2);
13749
+ function wasm_bindgen__convert__closures_____invoke__h02a7923578afc9b7(arg0, arg1, arg2) {
13750
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h02a7923578afc9b7(arg0, arg1, arg2);
13818
13751
  if (ret[1]) {
13819
13752
  throw takeFromExternrefTable0(ret[0]);
13820
13753
  }
13821
13754
  }
13822
13755
 
13823
- function wasm_bindgen__convert__closures_____invoke__h58f5f76183c776b1(arg0, arg1, arg2, arg3) {
13824
- wasm.wasm_bindgen__convert__closures_____invoke__h58f5f76183c776b1(arg0, arg1, arg2, arg3);
13756
+ function wasm_bindgen__convert__closures_____invoke__h587dbcc500240430(arg0, arg1, arg2, arg3) {
13757
+ wasm.wasm_bindgen__convert__closures_____invoke__h587dbcc500240430(arg0, arg1, arg2, arg3);
13825
13758
  }
13826
13759
 
13827
13760
 
@@ -14000,9 +13933,6 @@ const WasmLlmProviderConfigFinalization = (typeof FinalizationRegistry === 'unde
14000
13933
  const WasmLlmRateLimitConfigFinalization = (typeof FinalizationRegistry === 'undefined')
14001
13934
  ? { register: () => {}, unregister: () => {} }
14002
13935
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmllmratelimitconfig_free(ptr, 1));
14003
- const WasmMessageFinalization = (typeof FinalizationRegistry === 'undefined')
14004
- ? { register: () => {}, unregister: () => {} }
14005
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmmessage_free(ptr, 1));
14006
13936
  const WasmModelInfoFinalization = (typeof FinalizationRegistry === 'undefined')
14007
13937
  ? { register: () => {}, unregister: () => {} }
14008
13938
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmmodelinfo_free(ptr, 1));
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@xberg-io/liter-llm-wasm",
3
3
  "type": "module",
4
4
  "description": "Universal LLM API client with Rust-powered polyglot bindings.",
5
- "version": "2.0.2",
5
+ "version": "2.1.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",