@huggingface/tasks 0.9.1 → 0.10.1

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 (190) hide show
  1. package/README.md +12 -14
  2. package/dist/index.cjs +91 -18
  3. package/dist/index.js +90 -18
  4. package/dist/scripts/inference-codegen.d.ts +2 -0
  5. package/dist/scripts/inference-codegen.d.ts.map +1 -0
  6. package/dist/scripts/inference-tgi-import.d.ts +2 -0
  7. package/dist/scripts/inference-tgi-import.d.ts.map +1 -0
  8. package/dist/src/default-widget-inputs.d.ts +6 -0
  9. package/dist/src/default-widget-inputs.d.ts.map +1 -0
  10. package/dist/src/index.d.ts +17 -0
  11. package/dist/src/index.d.ts.map +1 -0
  12. package/dist/src/library-to-tasks.d.ts +11 -0
  13. package/dist/src/library-to-tasks.d.ts.map +1 -0
  14. package/dist/src/local-apps.d.ts +104 -0
  15. package/dist/src/local-apps.d.ts.map +1 -0
  16. package/dist/src/model-data.d.ts +144 -0
  17. package/dist/src/model-data.d.ts.map +1 -0
  18. package/dist/src/model-libraries-downloads.d.ts +26 -0
  19. package/dist/src/model-libraries-downloads.d.ts.map +1 -0
  20. package/dist/src/model-libraries-snippets.d.ts +43 -0
  21. package/dist/src/model-libraries-snippets.d.ts.map +1 -0
  22. package/dist/src/model-libraries.d.ts +501 -0
  23. package/dist/src/model-libraries.d.ts.map +1 -0
  24. package/dist/src/pipelines.d.ts +404 -0
  25. package/dist/src/pipelines.d.ts.map +1 -0
  26. package/dist/src/snippets/curl.d.ts +9 -0
  27. package/dist/src/snippets/curl.d.ts.map +1 -0
  28. package/dist/src/snippets/index.d.ts +6 -0
  29. package/dist/src/snippets/index.d.ts.map +1 -0
  30. package/dist/src/snippets/inputs.d.ts +3 -0
  31. package/dist/src/snippets/inputs.d.ts.map +1 -0
  32. package/dist/src/snippets/js.d.ts +11 -0
  33. package/dist/src/snippets/js.d.ts.map +1 -0
  34. package/dist/src/snippets/python.d.ts +14 -0
  35. package/dist/src/snippets/python.d.ts.map +1 -0
  36. package/dist/src/snippets/types.d.ts +8 -0
  37. package/dist/src/snippets/types.d.ts.map +1 -0
  38. package/dist/src/tasks/audio-classification/data.d.ts +4 -0
  39. package/dist/src/tasks/audio-classification/data.d.ts.map +1 -0
  40. package/dist/src/tasks/audio-classification/inference.d.ts +52 -0
  41. package/dist/src/tasks/audio-classification/inference.d.ts.map +1 -0
  42. package/dist/src/tasks/audio-to-audio/data.d.ts +4 -0
  43. package/dist/src/tasks/audio-to-audio/data.d.ts.map +1 -0
  44. package/dist/src/tasks/automatic-speech-recognition/data.d.ts +4 -0
  45. package/dist/src/tasks/automatic-speech-recognition/data.d.ts.map +1 -0
  46. package/dist/src/tasks/automatic-speech-recognition/inference.d.ts +154 -0
  47. package/dist/src/tasks/automatic-speech-recognition/inference.d.ts.map +1 -0
  48. package/dist/src/tasks/chat-completion/inference.d.ts +254 -0
  49. package/dist/src/tasks/chat-completion/inference.d.ts.map +1 -0
  50. package/dist/src/tasks/depth-estimation/data.d.ts +4 -0
  51. package/dist/src/tasks/depth-estimation/data.d.ts.map +1 -0
  52. package/dist/src/tasks/depth-estimation/inference.d.ts +36 -0
  53. package/dist/src/tasks/depth-estimation/inference.d.ts.map +1 -0
  54. package/dist/src/tasks/document-question-answering/data.d.ts +4 -0
  55. package/dist/src/tasks/document-question-answering/data.d.ts.map +1 -0
  56. package/dist/src/tasks/document-question-answering/inference.d.ts +111 -0
  57. package/dist/src/tasks/document-question-answering/inference.d.ts.map +1 -0
  58. package/dist/src/tasks/feature-extraction/data.d.ts +4 -0
  59. package/dist/src/tasks/feature-extraction/data.d.ts.map +1 -0
  60. package/dist/src/tasks/feature-extraction/inference.d.ts +23 -0
  61. package/dist/src/tasks/feature-extraction/inference.d.ts.map +1 -0
  62. package/dist/src/tasks/fill-mask/data.d.ts +4 -0
  63. package/dist/src/tasks/fill-mask/data.d.ts.map +1 -0
  64. package/dist/src/tasks/fill-mask/inference.d.ts +63 -0
  65. package/dist/src/tasks/fill-mask/inference.d.ts.map +1 -0
  66. package/dist/src/tasks/image-classification/data.d.ts +4 -0
  67. package/dist/src/tasks/image-classification/data.d.ts.map +1 -0
  68. package/dist/src/tasks/image-classification/inference.d.ts +52 -0
  69. package/dist/src/tasks/image-classification/inference.d.ts.map +1 -0
  70. package/dist/src/tasks/image-feature-extraction/data.d.ts +4 -0
  71. package/dist/src/tasks/image-feature-extraction/data.d.ts.map +1 -0
  72. package/dist/src/tasks/image-segmentation/data.d.ts +4 -0
  73. package/dist/src/tasks/image-segmentation/data.d.ts.map +1 -0
  74. package/dist/src/tasks/image-segmentation/inference.d.ts +66 -0
  75. package/dist/src/tasks/image-segmentation/inference.d.ts.map +1 -0
  76. package/dist/src/tasks/image-to-image/data.d.ts +4 -0
  77. package/dist/src/tasks/image-to-image/data.d.ts.map +1 -0
  78. package/dist/src/tasks/image-to-image/inference.d.ts +64 -0
  79. package/dist/src/tasks/image-to-image/inference.d.ts.map +1 -0
  80. package/dist/src/tasks/image-to-text/data.d.ts +4 -0
  81. package/dist/src/tasks/image-to-text/data.d.ts.map +1 -0
  82. package/dist/src/tasks/image-to-text/inference.d.ts +139 -0
  83. package/dist/src/tasks/image-to-text/inference.d.ts.map +1 -0
  84. package/dist/src/tasks/index.d.ts +87 -0
  85. package/dist/src/tasks/index.d.ts.map +1 -0
  86. package/dist/src/tasks/mask-generation/data.d.ts +4 -0
  87. package/dist/src/tasks/mask-generation/data.d.ts.map +1 -0
  88. package/dist/src/tasks/object-detection/data.d.ts +4 -0
  89. package/dist/src/tasks/object-detection/data.d.ts.map +1 -0
  90. package/dist/src/tasks/object-detection/inference.d.ts +63 -0
  91. package/dist/src/tasks/object-detection/inference.d.ts.map +1 -0
  92. package/dist/src/tasks/placeholder/data.d.ts +4 -0
  93. package/dist/src/tasks/placeholder/data.d.ts.map +1 -0
  94. package/dist/src/tasks/question-answering/data.d.ts +4 -0
  95. package/dist/src/tasks/question-answering/data.d.ts.map +1 -0
  96. package/dist/src/tasks/question-answering/inference.d.ts +100 -0
  97. package/dist/src/tasks/question-answering/inference.d.ts.map +1 -0
  98. package/dist/src/tasks/reinforcement-learning/data.d.ts +4 -0
  99. package/dist/src/tasks/reinforcement-learning/data.d.ts.map +1 -0
  100. package/dist/src/tasks/sentence-similarity/data.d.ts +4 -0
  101. package/dist/src/tasks/sentence-similarity/data.d.ts.map +1 -0
  102. package/dist/src/tasks/sentence-similarity/inference.d.ts +32 -0
  103. package/dist/src/tasks/sentence-similarity/inference.d.ts.map +1 -0
  104. package/dist/src/tasks/summarization/data.d.ts +4 -0
  105. package/dist/src/tasks/summarization/data.d.ts.map +1 -0
  106. package/dist/src/tasks/summarization/inference.d.ts +55 -0
  107. package/dist/src/tasks/summarization/inference.d.ts.map +1 -0
  108. package/dist/src/tasks/table-question-answering/data.d.ts +4 -0
  109. package/dist/src/tasks/table-question-answering/data.d.ts.map +1 -0
  110. package/dist/src/tasks/table-question-answering/inference.d.ts +62 -0
  111. package/dist/src/tasks/table-question-answering/inference.d.ts.map +1 -0
  112. package/dist/src/tasks/tabular-classification/data.d.ts +4 -0
  113. package/dist/src/tasks/tabular-classification/data.d.ts.map +1 -0
  114. package/dist/src/tasks/tabular-regression/data.d.ts +4 -0
  115. package/dist/src/tasks/tabular-regression/data.d.ts.map +1 -0
  116. package/dist/src/tasks/text-classification/data.d.ts +4 -0
  117. package/dist/src/tasks/text-classification/data.d.ts.map +1 -0
  118. package/dist/src/tasks/text-classification/inference.d.ts +52 -0
  119. package/dist/src/tasks/text-classification/inference.d.ts.map +1 -0
  120. package/dist/src/tasks/text-generation/data.d.ts +4 -0
  121. package/dist/src/tasks/text-generation/data.d.ts.map +1 -0
  122. package/dist/src/tasks/text-generation/inference.d.ts +126 -0
  123. package/dist/src/tasks/text-generation/inference.d.ts.map +1 -0
  124. package/dist/src/tasks/text-to-audio/inference.d.ts +139 -0
  125. package/dist/src/tasks/text-to-audio/inference.d.ts.map +1 -0
  126. package/dist/src/tasks/text-to-image/data.d.ts +4 -0
  127. package/dist/src/tasks/text-to-image/data.d.ts.map +1 -0
  128. package/dist/src/tasks/text-to-image/inference.d.ts +68 -0
  129. package/dist/src/tasks/text-to-image/inference.d.ts.map +1 -0
  130. package/dist/src/tasks/text-to-speech/data.d.ts +4 -0
  131. package/dist/src/tasks/text-to-speech/data.d.ts.map +1 -0
  132. package/dist/src/tasks/text-to-speech/inference.d.ts +143 -0
  133. package/dist/src/tasks/text-to-speech/inference.d.ts.map +1 -0
  134. package/dist/src/tasks/text-to-video/data.d.ts +4 -0
  135. package/dist/src/tasks/text-to-video/data.d.ts.map +1 -0
  136. package/dist/src/tasks/text2text-generation/inference.d.ts +54 -0
  137. package/dist/src/tasks/text2text-generation/inference.d.ts.map +1 -0
  138. package/dist/src/tasks/token-classification/data.d.ts +4 -0
  139. package/dist/src/tasks/token-classification/data.d.ts.map +1 -0
  140. package/dist/src/tasks/token-classification/inference.d.ts +83 -0
  141. package/dist/src/tasks/token-classification/inference.d.ts.map +1 -0
  142. package/dist/src/tasks/translation/data.d.ts +4 -0
  143. package/dist/src/tasks/translation/data.d.ts.map +1 -0
  144. package/dist/src/tasks/translation/inference.d.ts +55 -0
  145. package/dist/src/tasks/translation/inference.d.ts.map +1 -0
  146. package/dist/src/tasks/unconditional-image-generation/data.d.ts +4 -0
  147. package/dist/src/tasks/unconditional-image-generation/data.d.ts.map +1 -0
  148. package/dist/src/tasks/video-classification/data.d.ts +4 -0
  149. package/dist/src/tasks/video-classification/data.d.ts.map +1 -0
  150. package/dist/src/tasks/video-classification/inference.d.ts +60 -0
  151. package/dist/src/tasks/video-classification/inference.d.ts.map +1 -0
  152. package/dist/src/tasks/visual-question-answering/data.d.ts +4 -0
  153. package/dist/src/tasks/visual-question-answering/data.d.ts.map +1 -0
  154. package/dist/src/tasks/visual-question-answering/inference.d.ts +64 -0
  155. package/dist/src/tasks/visual-question-answering/inference.d.ts.map +1 -0
  156. package/dist/src/tasks/zero-shot-classification/data.d.ts +4 -0
  157. package/dist/src/tasks/zero-shot-classification/data.d.ts.map +1 -0
  158. package/dist/src/tasks/zero-shot-classification/inference.d.ts +68 -0
  159. package/dist/src/tasks/zero-shot-classification/inference.d.ts.map +1 -0
  160. package/dist/src/tasks/zero-shot-image-classification/data.d.ts +4 -0
  161. package/dist/src/tasks/zero-shot-image-classification/data.d.ts.map +1 -0
  162. package/dist/src/tasks/zero-shot-image-classification/inference.d.ts +62 -0
  163. package/dist/src/tasks/zero-shot-image-classification/inference.d.ts.map +1 -0
  164. package/dist/src/tasks/zero-shot-object-detection/data.d.ts +4 -0
  165. package/dist/src/tasks/zero-shot-object-detection/data.d.ts.map +1 -0
  166. package/dist/src/tasks/zero-shot-object-detection/inference.d.ts +67 -0
  167. package/dist/src/tasks/zero-shot-object-detection/inference.d.ts.map +1 -0
  168. package/dist/src/tokenizer-data.d.ts +26 -0
  169. package/dist/src/tokenizer-data.d.ts.map +1 -0
  170. package/dist/src/widget-example.d.ts +86 -0
  171. package/dist/src/widget-example.d.ts.map +1 -0
  172. package/package.json +8 -6
  173. package/src/index.ts +3 -0
  174. package/src/local-apps.ts +119 -0
  175. package/src/model-data.ts +1 -5
  176. package/src/model-libraries-snippets.ts +21 -18
  177. package/src/model-libraries.ts +9 -0
  178. package/src/tasks/chat-completion/inference.ts +204 -85
  179. package/src/tasks/chat-completion/spec/input.json +198 -34
  180. package/src/tasks/chat-completion/spec/output.json +178 -40
  181. package/src/tasks/chat-completion/spec/stream_output.json +170 -0
  182. package/src/tasks/index.ts +7 -8
  183. package/src/tasks/text-generation/inference.ts +58 -170
  184. package/src/tasks/text-generation/spec/input.json +130 -29
  185. package/src/tasks/text-generation/spec/output.json +104 -90
  186. package/src/tasks/text-generation/spec/stream_output.json +97 -0
  187. package/tsconfig.json +3 -1
  188. package/dist/index.d.ts +0 -3542
  189. package/src/tasks/chat-completion/spec/output_stream.json +0 -48
  190. package/src/tasks/text-generation/spec/output_stream.json +0 -47
@@ -1,165 +1,179 @@
1
1
  {
2
2
  "$id": "/inference/schemas/text-generation/output.json",
3
3
  "$schema": "http://json-schema.org/draft-06/schema#",
4
- "description": "Outputs for Text Generation inference",
4
+ "description": "Text Generation Output.\n\nAuto-generated from TGI specs.\nFor more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.",
5
5
  "title": "TextGenerationOutput",
6
6
  "type": "object",
7
+ "required": ["generated_text"],
7
8
  "properties": {
9
+ "details": {
10
+ "allOf": [
11
+ {
12
+ "$ref": "#/$defs/TextGenerationOutputDetails"
13
+ }
14
+ ],
15
+ "nullable": true
16
+ },
8
17
  "generated_text": {
9
18
  "type": "string",
10
- "description": "The generated text"
11
- },
12
- "details": {
13
- "$ref": "#/$defs/Details",
14
- "description": "When enabled, details about the generation"
19
+ "example": "test"
15
20
  }
16
21
  },
17
- "required": ["generated_text"],
18
22
  "$defs": {
19
- "FinishReason": {
20
- "type": "string",
21
- "title": "TextGenerationFinishReason",
22
- "description": "The reason why the generation was stopped.",
23
- "oneOf": [
24
- { "const": "length", "description": "length: The generated sequence reached the maximum allowed length" },
25
- { "const": "eos_token", "description": "eos_token: The model generated an end-of-sentence (EOS) token" },
26
- {
27
- "const": "stop_sequence",
28
- "description": "stop_sequence: One of the sequence in stop_sequences was generated"
29
- }
30
- ]
31
- },
32
- "PrefillToken": {
33
- "title": "TextGenerationPrefillToken",
23
+ "TextGenerationOutputDetails": {
34
24
  "type": "object",
25
+ "required": ["finish_reason", "generated_tokens", "prefill", "tokens"],
35
26
  "properties": {
36
- "id": {
37
- "type": "integer"
38
- },
39
- "logprob": {
40
- "type": "number"
41
- },
42
- "text": {
43
- "type": "string",
44
- "description": "The text associated with that token"
45
- }
46
- },
47
- "required": ["id", "logprob", "text"]
48
- },
49
- "Token": {
50
- "type": "object",
51
- "title": "TextGenerationOutputToken",
52
- "properties": {
53
- "id": {
54
- "type": "integer"
55
- },
56
- "logprob": {
57
- "type": "number"
58
- },
59
- "special": {
60
- "type": "boolean",
61
- "description": "Whether or not that token is a special one"
27
+ "best_of_sequences": {
28
+ "type": "array",
29
+ "items": {
30
+ "$ref": "#/$defs/TextGenerationOutputBestOfSequence"
31
+ },
32
+ "nullable": true
62
33
  },
63
- "text": {
64
- "type": "string",
65
- "description": "The text associated with that token"
66
- }
67
- },
68
- "required": ["id", "special", "text"]
69
- },
70
- "Details": {
71
- "type": "object",
72
- "title": "TextGenerationOutputDetails",
73
- "properties": {
74
34
  "finish_reason": {
75
- "$ref": "#/$defs/FinishReason",
76
- "description": "The reason why the generation was stopped."
35
+ "$ref": "#/$defs/TextGenerationOutputFinishReason"
77
36
  },
78
37
  "generated_tokens": {
79
38
  "type": "integer",
80
- "description": "The number of generated tokens"
39
+ "format": "int32",
40
+ "example": 1,
41
+ "minimum": 0
81
42
  },
82
43
  "prefill": {
83
44
  "type": "array",
84
45
  "items": {
85
- "$ref": "#/$defs/PrefillToken"
46
+ "$ref": "#/$defs/TextGenerationOutputPrefillToken"
86
47
  }
87
48
  },
88
49
  "seed": {
89
50
  "type": "integer",
90
- "description": "The random seed used for generation"
51
+ "format": "int64",
52
+ "example": 42,
53
+ "nullable": true,
54
+ "minimum": 0
91
55
  },
92
56
  "tokens": {
93
57
  "type": "array",
94
- "description": "The generated tokens and associated details",
95
58
  "items": {
96
- "$ref": "#/$defs/Token"
59
+ "$ref": "#/$defs/TextGenerationOutputToken"
97
60
  }
98
61
  },
99
62
  "top_tokens": {
100
63
  "type": "array",
101
- "description": "Most likely tokens",
102
64
  "items": {
103
65
  "type": "array",
104
66
  "items": {
105
- "$ref": "#/$defs/Token"
67
+ "$ref": "#/$defs/TextGenerationOutputToken"
106
68
  }
107
69
  }
108
- },
109
- "best_of_sequences": {
110
- "type": "array",
111
- "description": "Details about additional sequences when best_of is provided",
112
- "items": {
113
- "$ref": "#/$defs/SequenceDetails"
114
- }
115
70
  }
116
71
  },
117
- "required": ["finish_reason", "generated_tokens", "prefill", "tokens"]
72
+ "title": "TextGenerationOutputDetails"
118
73
  },
119
- "SequenceDetails": {
74
+ "TextGenerationOutputBestOfSequence": {
120
75
  "type": "object",
121
- "title": "TextGenerationOutputSequenceDetails",
76
+ "required": ["generated_text", "finish_reason", "generated_tokens", "prefill", "tokens"],
122
77
  "properties": {
78
+ "finish_reason": {
79
+ "$ref": "#/$defs/TextGenerationOutputFinishReason"
80
+ },
123
81
  "generated_text": {
124
82
  "type": "string",
125
- "description": "The generated text"
126
- },
127
- "finish_reason": {
128
- "$ref": "#/$defs/FinishReason"
83
+ "example": "test"
129
84
  },
130
85
  "generated_tokens": {
131
86
  "type": "integer",
132
- "description": "The number of generated tokens"
87
+ "format": "int32",
88
+ "example": 1,
89
+ "minimum": 0
133
90
  },
134
91
  "prefill": {
135
92
  "type": "array",
136
93
  "items": {
137
- "$ref": "#/$defs/PrefillToken"
94
+ "$ref": "#/$defs/TextGenerationOutputPrefillToken"
138
95
  }
139
96
  },
140
97
  "seed": {
141
98
  "type": "integer",
142
- "description": "The random seed used for generation"
99
+ "format": "int64",
100
+ "example": 42,
101
+ "nullable": true,
102
+ "minimum": 0
143
103
  },
144
104
  "tokens": {
145
105
  "type": "array",
146
- "description": "The generated tokens and associated details",
147
106
  "items": {
148
- "$ref": "#/$defs/Token"
107
+ "$ref": "#/$defs/TextGenerationOutputToken"
149
108
  }
150
109
  },
151
110
  "top_tokens": {
152
111
  "type": "array",
153
- "description": "Most likely tokens",
154
112
  "items": {
155
113
  "type": "array",
156
114
  "items": {
157
- "$ref": "#/$defs/Token"
115
+ "$ref": "#/$defs/TextGenerationOutputToken"
158
116
  }
159
117
  }
160
118
  }
161
119
  },
162
- "required": ["generated_text", "finish_reason", "generated_tokens", "prefill", "tokens"]
120
+ "title": "TextGenerationOutputBestOfSequence"
121
+ },
122
+ "TextGenerationOutputFinishReason": {
123
+ "type": "string",
124
+ "enum": ["length", "eos_token", "stop_sequence"],
125
+ "example": "Length",
126
+ "title": "TextGenerationOutputFinishReason"
127
+ },
128
+ "TextGenerationOutputPrefillToken": {
129
+ "type": "object",
130
+ "required": ["id", "text", "logprob"],
131
+ "properties": {
132
+ "id": {
133
+ "type": "integer",
134
+ "format": "int32",
135
+ "example": 0,
136
+ "minimum": 0
137
+ },
138
+ "logprob": {
139
+ "type": "number",
140
+ "format": "float",
141
+ "example": -0.34,
142
+ "nullable": true
143
+ },
144
+ "text": {
145
+ "type": "string",
146
+ "example": "test"
147
+ }
148
+ },
149
+ "title": "TextGenerationOutputPrefillToken"
150
+ },
151
+ "TextGenerationOutputToken": {
152
+ "type": "object",
153
+ "required": ["id", "text", "logprob", "special"],
154
+ "properties": {
155
+ "id": {
156
+ "type": "integer",
157
+ "format": "int32",
158
+ "example": 0,
159
+ "minimum": 0
160
+ },
161
+ "logprob": {
162
+ "type": "number",
163
+ "format": "float",
164
+ "example": -0.34,
165
+ "nullable": true
166
+ },
167
+ "special": {
168
+ "type": "boolean",
169
+ "example": "false"
170
+ },
171
+ "text": {
172
+ "type": "string",
173
+ "example": "test"
174
+ }
175
+ },
176
+ "title": "TextGenerationOutputToken"
163
177
  }
164
178
  }
165
179
  }
@@ -0,0 +1,97 @@
1
+ {
2
+ "$id": "/inference/schemas/text-generation/stream_output.json",
3
+ "$schema": "http://json-schema.org/draft-06/schema#",
4
+ "description": "Text Generation Stream Output.\n\nAuto-generated from TGI specs.\nFor more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.",
5
+ "title": "TextGenerationStreamOutput",
6
+ "type": "object",
7
+ "required": ["index", "token"],
8
+ "properties": {
9
+ "details": {
10
+ "allOf": [
11
+ {
12
+ "$ref": "#/$defs/TextGenerationStreamOutputStreamDetails"
13
+ }
14
+ ],
15
+ "default": "null",
16
+ "nullable": true
17
+ },
18
+ "generated_text": {
19
+ "type": "string",
20
+ "default": "null",
21
+ "example": "test",
22
+ "nullable": true
23
+ },
24
+ "index": {
25
+ "type": "integer",
26
+ "format": "int32",
27
+ "minimum": 0
28
+ },
29
+ "token": {
30
+ "$ref": "#/$defs/TextGenerationStreamOutputToken"
31
+ },
32
+ "top_tokens": {
33
+ "type": "array",
34
+ "items": {
35
+ "$ref": "#/$defs/TextGenerationStreamOutputToken"
36
+ }
37
+ }
38
+ },
39
+ "$defs": {
40
+ "TextGenerationStreamOutputStreamDetails": {
41
+ "type": "object",
42
+ "required": ["finish_reason", "generated_tokens"],
43
+ "properties": {
44
+ "finish_reason": {
45
+ "$ref": "#/$defs/TextGenerationStreamOutputFinishReason"
46
+ },
47
+ "generated_tokens": {
48
+ "type": "integer",
49
+ "format": "int32",
50
+ "example": 1,
51
+ "minimum": 0
52
+ },
53
+ "seed": {
54
+ "type": "integer",
55
+ "format": "int64",
56
+ "example": 42,
57
+ "nullable": true,
58
+ "minimum": 0
59
+ }
60
+ },
61
+ "title": "TextGenerationStreamOutputStreamDetails"
62
+ },
63
+ "TextGenerationStreamOutputFinishReason": {
64
+ "type": "string",
65
+ "enum": ["length", "eos_token", "stop_sequence"],
66
+ "example": "Length",
67
+ "title": "TextGenerationStreamOutputFinishReason"
68
+ },
69
+ "TextGenerationStreamOutputToken": {
70
+ "type": "object",
71
+ "required": ["id", "text", "logprob", "special"],
72
+ "properties": {
73
+ "id": {
74
+ "type": "integer",
75
+ "format": "int32",
76
+ "example": 0,
77
+ "minimum": 0
78
+ },
79
+ "logprob": {
80
+ "type": "number",
81
+ "format": "float",
82
+ "example": -0.34,
83
+ "nullable": true
84
+ },
85
+ "special": {
86
+ "type": "boolean",
87
+ "example": "false"
88
+ },
89
+ "text": {
90
+ "type": "string",
91
+ "example": "test"
92
+ }
93
+ },
94
+ "title": "TextGenerationStreamOutputToken"
95
+ }
96
+ }
97
+ }
package/tsconfig.json CHANGED
@@ -11,7 +11,9 @@
11
11
  "strictNullChecks": true,
12
12
  "skipLibCheck": true,
13
13
  "noImplicitOverride": true,
14
- "outDir": "./dist"
14
+ "outDir": "./dist",
15
+ "declaration": true,
16
+ "declarationMap": true
15
17
  },
16
18
  "include": ["src", "scripts"],
17
19
  "exclude": ["dist"]