@botpress/zai 1.0.0-beta.7 → 1.0.0-beta.8

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
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@botpress/client';
2
2
  import sdk from '@botpress/sdk';
3
- import * as wasm from '@botpress/wasm';
3
+ import { TextTokenizer } from '@botpress/wasm';
4
4
 
5
5
  type GenerationMetadata = sdk.z.input<typeof GenerationMetadata>;
6
6
  declare const GenerationMetadata: sdk.ZodObject<{
@@ -626,7 +626,7 @@ declare const ZaiConfig: sdk.ZodObject<{
626
626
  namespace?: string;
627
627
  }>;
628
628
  declare class Zai {
629
- protected static tokenizer: wasm.TextTokenizer;
629
+ protected static tokenizer: TextTokenizer;
630
630
  protected client: Client;
631
631
  private originalConfig;
632
632
  private userId;
@@ -644,7 +644,7 @@ declare class Zai {
644
644
  }>;
645
645
  /** @internal */
646
646
  private _callModel;
647
- protected getTokenizer(): Promise<wasm.TextTokenizer>;
647
+ protected getTokenizer(): Promise<TextTokenizer>;
648
648
  protected get taskId(): string;
649
649
  with(options: Partial<ZaiConfig>): Zai;
650
650
  learn(taskId: string): Zai;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@botpress/client';
2
2
  import sdk from '@botpress/sdk';
3
- import * as wasm from '@botpress/wasm';
3
+ import { TextTokenizer } from '@botpress/wasm';
4
4
 
5
5
  type GenerationMetadata = sdk.z.input<typeof GenerationMetadata>;
6
6
  declare const GenerationMetadata: sdk.ZodObject<{
@@ -626,7 +626,7 @@ declare const ZaiConfig: sdk.ZodObject<{
626
626
  namespace?: string;
627
627
  }>;
628
628
  declare class Zai {
629
- protected static tokenizer: wasm.TextTokenizer;
629
+ protected static tokenizer: TextTokenizer;
630
630
  protected client: Client;
631
631
  private originalConfig;
632
632
  private userId;
@@ -644,7 +644,7 @@ declare class Zai {
644
644
  }>;
645
645
  /** @internal */
646
646
  private _callModel;
647
- protected getTokenizer(): Promise<wasm.TextTokenizer>;
647
+ protected getTokenizer(): Promise<TextTokenizer>;
648
648
  protected get taskId(): string;
649
649
  with(options: Partial<ZaiConfig>): Zai;
650
650
  learn(taskId: string): Zai;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
 
4
4
  // src/zai.ts
5
5
  import sdk3 from "@botpress/sdk";
6
- import * as wasm from "@botpress/wasm";
6
+ import { getWasmTokenizer } from "@botpress/wasm";
7
7
 
8
8
  // src/adapters/botpress-table.ts
9
9
  import sdk2 from "@botpress/sdk";
@@ -753,7 +753,12 @@ var Zai = class _Zai {
753
753
  } while (--retries > 0);
754
754
  }
755
755
  async getTokenizer() {
756
- _Zai.tokenizer ??= await wasm.getWasmTokenizer();
756
+ _Zai.tokenizer ??= await (async () => {
757
+ while (!getWasmTokenizer) {
758
+ await new Promise((resolve) => setTimeout(resolve, 25));
759
+ }
760
+ return getWasmTokenizer();
761
+ })();
757
762
  return _Zai.tokenizer;
758
763
  }
759
764
  get taskId() {