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

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 { TextTokenizer } from '@botpress/wasm';
3
+ import * as wasm 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: TextTokenizer;
629
+ protected static tokenizer: wasm.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<TextTokenizer>;
647
+ protected getTokenizer(): Promise<wasm.TextTokenizer>;
648
648
  protected get taskId(): string;
649
649
  with(options: Partial<ZaiConfig>): Zai;
650
650
  learn(taskId: string): Zai;
@@ -658,7 +658,7 @@ declare const Options$6: sdk.ZodObject<{
658
658
  }, {
659
659
  length?: number;
660
660
  }>;
661
- declare module '../zai' {
661
+ declare module '@botpress/zai' {
662
662
  interface Zai {
663
663
  /** Generates a text of the desired length according to the prompt */
664
664
  text(prompt: string, options?: Options$6): Promise<string>;
@@ -691,7 +691,7 @@ declare const Options$5: sdk.ZodObject<{
691
691
  output?: string;
692
692
  }[];
693
693
  }>;
694
- declare module '../zai' {
694
+ declare module '@botpress/zai' {
695
695
  interface Zai {
696
696
  /** Rewrites a string according to match the prompt */
697
697
  rewrite(original: string, prompt: string, options?: Options$5): Promise<string>;
@@ -736,7 +736,7 @@ declare const Options$4: sdk.ZodObject<{
736
736
  overlap?: number;
737
737
  };
738
738
  }>;
739
- declare module '../zai' {
739
+ declare module '@botpress/zai' {
740
740
  interface Zai {
741
741
  /** Summarizes a text of any length to a summary of the desired length */
742
742
  summarize(original: string, options?: Options$4): Promise<string>;
@@ -771,7 +771,7 @@ declare const Options$3: sdk.ZodObject<{
771
771
  reason?: string;
772
772
  }[];
773
773
  }>;
774
- declare module '../zai' {
774
+ declare module '@botpress/zai' {
775
775
  interface Zai {
776
776
  /** Checks wether a condition is true or not */
777
777
  check(input: unknown, condition: string, options?: Options$3): Promise<boolean>;
@@ -809,7 +809,7 @@ declare const Options$2: sdk.ZodObject<{
809
809
  }[];
810
810
  tokensPerItem?: number;
811
811
  }>;
812
- declare module '../zai' {
812
+ declare module '@botpress/zai' {
813
813
  interface Zai {
814
814
  /** Filters elements of an array against a condition */
815
815
  filter<T>(input: Array<T>, condition: string, options?: Options$2): Promise<Array<T>>;
@@ -827,7 +827,7 @@ declare const Options$1: sdk.ZodObject<{
827
827
  instructions?: string;
828
828
  chunkLength?: number;
829
829
  }>;
830
- declare module '../zai' {
830
+ declare module '@botpress/zai' {
831
831
  interface Zai {
832
832
  /** Extracts one or many elements from an arbitrary input */
833
833
  extract<S extends sdk.z.AnyZodObject>(input: unknown, schema: S, options?: Options$1): Promise<sdk.z.infer<S>>;
@@ -904,7 +904,7 @@ declare const Options: sdk.ZodObject<{
904
904
  }>;
905
905
  type Labels<T extends string> = Record<T, string>;
906
906
  declare const Labels: sdk.ZodEffects<sdk.ZodRecord<sdk.ZodString, sdk.ZodString>, Record<string, string>, Record<string, string>>;
907
- declare module '../zai' {
907
+ declare module '@botpress/zai' {
908
908
  interface Zai {
909
909
  /** Tags the provided input with a list of predefined labels */
910
910
  label<T extends string>(input: unknown, labels: Labels<T>, options?: Options<T>): Promise<{
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 { TextTokenizer } from '@botpress/wasm';
3
+ import * as wasm 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: TextTokenizer;
629
+ protected static tokenizer: wasm.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<TextTokenizer>;
647
+ protected getTokenizer(): Promise<wasm.TextTokenizer>;
648
648
  protected get taskId(): string;
649
649
  with(options: Partial<ZaiConfig>): Zai;
650
650
  learn(taskId: string): Zai;
@@ -658,7 +658,7 @@ declare const Options$6: sdk.ZodObject<{
658
658
  }, {
659
659
  length?: number;
660
660
  }>;
661
- declare module '../zai' {
661
+ declare module '@botpress/zai' {
662
662
  interface Zai {
663
663
  /** Generates a text of the desired length according to the prompt */
664
664
  text(prompt: string, options?: Options$6): Promise<string>;
@@ -691,7 +691,7 @@ declare const Options$5: sdk.ZodObject<{
691
691
  output?: string;
692
692
  }[];
693
693
  }>;
694
- declare module '../zai' {
694
+ declare module '@botpress/zai' {
695
695
  interface Zai {
696
696
  /** Rewrites a string according to match the prompt */
697
697
  rewrite(original: string, prompt: string, options?: Options$5): Promise<string>;
@@ -736,7 +736,7 @@ declare const Options$4: sdk.ZodObject<{
736
736
  overlap?: number;
737
737
  };
738
738
  }>;
739
- declare module '../zai' {
739
+ declare module '@botpress/zai' {
740
740
  interface Zai {
741
741
  /** Summarizes a text of any length to a summary of the desired length */
742
742
  summarize(original: string, options?: Options$4): Promise<string>;
@@ -771,7 +771,7 @@ declare const Options$3: sdk.ZodObject<{
771
771
  reason?: string;
772
772
  }[];
773
773
  }>;
774
- declare module '../zai' {
774
+ declare module '@botpress/zai' {
775
775
  interface Zai {
776
776
  /** Checks wether a condition is true or not */
777
777
  check(input: unknown, condition: string, options?: Options$3): Promise<boolean>;
@@ -809,7 +809,7 @@ declare const Options$2: sdk.ZodObject<{
809
809
  }[];
810
810
  tokensPerItem?: number;
811
811
  }>;
812
- declare module '../zai' {
812
+ declare module '@botpress/zai' {
813
813
  interface Zai {
814
814
  /** Filters elements of an array against a condition */
815
815
  filter<T>(input: Array<T>, condition: string, options?: Options$2): Promise<Array<T>>;
@@ -827,7 +827,7 @@ declare const Options$1: sdk.ZodObject<{
827
827
  instructions?: string;
828
828
  chunkLength?: number;
829
829
  }>;
830
- declare module '../zai' {
830
+ declare module '@botpress/zai' {
831
831
  interface Zai {
832
832
  /** Extracts one or many elements from an arbitrary input */
833
833
  extract<S extends sdk.z.AnyZodObject>(input: unknown, schema: S, options?: Options$1): Promise<sdk.z.infer<S>>;
@@ -904,7 +904,7 @@ declare const Options: sdk.ZodObject<{
904
904
  }>;
905
905
  type Labels<T extends string> = Record<T, string>;
906
906
  declare const Labels: sdk.ZodEffects<sdk.ZodRecord<sdk.ZodString, sdk.ZodString>, Record<string, string>, Record<string, string>>;
907
- declare module '../zai' {
907
+ declare module '@botpress/zai' {
908
908
  interface Zai {
909
909
  /** Tags the provided input with a list of predefined labels */
910
910
  label<T extends string>(input: unknown, labels: Labels<T>, options?: Options<T>): Promise<{
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 { getWasmTokenizer } from "@botpress/wasm";
6
+ import * as wasm from "@botpress/wasm";
7
7
 
8
8
  // src/adapters/botpress-table.ts
9
9
  import sdk2 from "@botpress/sdk";
@@ -753,7 +753,7 @@ var Zai = class _Zai {
753
753
  } while (--retries > 0);
754
754
  }
755
755
  async getTokenizer() {
756
- _Zai.tokenizer ??= await getWasmTokenizer();
756
+ _Zai.tokenizer ??= await wasm.getWasmTokenizer();
757
757
  return _Zai.tokenizer;
758
758
  }
759
759
  get taskId() {