modelfusion 0.53.1 → 0.53.2

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.
Files changed (33) hide show
  1. package/core/FunctionOptions.d.ts +4 -3
  2. package/model-function/embed/embed.cjs +16 -0
  3. package/model-function/embed/embed.d.ts +16 -0
  4. package/model-function/embed/embed.js +16 -0
  5. package/model-function/generate-image/generateImage.cjs +12 -3
  6. package/model-function/generate-image/generateImage.d.ts +12 -3
  7. package/model-function/generate-image/generateImage.js +12 -3
  8. package/model-function/generate-speech/generateSpeech.cjs +16 -1
  9. package/model-function/generate-speech/generateSpeech.d.ts +16 -1
  10. package/model-function/generate-speech/generateSpeech.js +16 -1
  11. package/model-function/generate-speech/streamSpeech.cjs +22 -1
  12. package/model-function/generate-speech/streamSpeech.d.ts +22 -1
  13. package/model-function/generate-speech/streamSpeech.js +22 -1
  14. package/model-function/generate-structure/generateStructure.cjs +41 -0
  15. package/model-function/generate-structure/generateStructure.d.ts +41 -0
  16. package/model-function/generate-structure/generateStructure.js +41 -0
  17. package/model-function/generate-structure/generateStructureOrText.cjs +62 -0
  18. package/model-function/generate-structure/generateStructureOrText.d.ts +62 -0
  19. package/model-function/generate-structure/generateStructureOrText.js +62 -0
  20. package/model-function/generate-structure/streamStructure.cjs +72 -1
  21. package/model-function/generate-structure/streamStructure.d.ts +68 -1
  22. package/model-function/generate-structure/streamStructure.js +72 -1
  23. package/model-function/generate-text/generateText.cjs +14 -6
  24. package/model-function/generate-text/generateText.d.ts +14 -6
  25. package/model-function/generate-text/generateText.js +14 -6
  26. package/model-function/generate-text/streamText.cjs +25 -0
  27. package/model-function/generate-text/streamText.d.ts +25 -0
  28. package/model-function/generate-text/streamText.js +25 -0
  29. package/model-function/generate-transcription/generateTranscription.cjs +10 -5
  30. package/model-function/generate-transcription/generateTranscription.d.ts +10 -5
  31. package/model-function/generate-transcription/generateTranscription.js +10 -5
  32. package/model-function/tokenize-text/Tokenizer.d.ts +27 -3
  33. package/package.json +1 -1
@@ -1,19 +1,43 @@
1
+ /**
2
+ * Interface for a basic tokenizer capable of converting text into tokens.
3
+ *
4
+ * This serves as the base for tokenization functionalities where the focus is on the transformation of input text into a series of numeric tokens.
5
+ */
1
6
  export interface BasicTokenizer {
2
7
  /**
3
- * Get the tokens that represent the given text.
8
+ * Asynchronously tokenize the given text into a sequence of numeric tokens.
9
+ *
10
+ * @param text - Input text string that needs to be tokenized.
11
+ * @returns A promise containing an array of numbers, where each number is a token representing a part or the whole of the input text.
4
12
  */
5
13
  tokenize: (text: string) => PromiseLike<Array<number>>;
6
14
  }
15
+ /**
16
+ * Interface for a comprehensive tokenizer that extends the basic tokenization capabilities.
17
+ *
18
+ * In addition to basic tokenization, this interface provides methods for detokenization and
19
+ * retrieving the original text corresponding to each token, enabling a more informative and reversible transformation process.
20
+ */
7
21
  export interface FullTokenizer extends BasicTokenizer {
8
22
  /**
9
- * Get the tokens that represent the given text and the text for each token.
23
+ * Asynchronously tokenize the given text, providing both the numeric tokens and their corresponding text.
24
+ *
25
+ * @param text - Input text string to be tokenized.
26
+ * @returns A promise containing an object with two arrays:
27
+ * 1. `tokens` - An array of numbers where each number is a token.
28
+ * 2. `tokenTexts` - An array of strings where each string represents the original text corresponding to each token.
10
29
  */
11
30
  tokenizeWithTexts: (text: string) => PromiseLike<{
12
31
  tokens: Array<number>;
13
32
  tokenTexts: Array<string>;
14
33
  }>;
15
34
  /**
16
- * Get the text that represents the given tokens.
35
+ * Asynchronously revert a sequence of numeric tokens back into the original text.
36
+ * Detokenization is the process of transforming tokens back to a human-readable format, and it's essential in scenarios
37
+ * where the output needs to be interpretable or when the tokenization process has to be reversible.
38
+ *
39
+ * @param tokens - An array of numeric tokens to be converted back to text.
40
+ * @returns A promise containing a string that represents the original text corresponding to the sequence of input tokens.
17
41
  */
18
42
  detokenize: (tokens: Array<number>) => PromiseLike<string>;
19
43
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modelfusion",
3
3
  "description": "Build multimodal applications, chatbots, and agents with JavaScript and TypeScript.",
4
- "version": "0.53.1",
4
+ "version": "0.53.2",
5
5
  "author": "Lars Grammel",
6
6
  "license": "MIT",
7
7
  "keywords": [