@huggingface/tasks 0.12.8 → 0.12.10
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.cjs +125 -2
- package/dist/index.js +125 -2
- package/dist/src/model-libraries-snippets.d.ts +1 -0
- package/dist/src/model-libraries-snippets.d.ts.map +1 -1
- package/dist/src/model-libraries.d.ts +16 -2
- package/dist/src/model-libraries.d.ts.map +1 -1
- package/dist/src/tasks/automatic-speech-recognition/inference.d.ts +2 -2
- package/dist/src/tasks/chat-completion/inference.d.ts +58 -21
- package/dist/src/tasks/chat-completion/inference.d.ts.map +1 -1
- package/dist/src/tasks/image-to-text/inference.d.ts +2 -2
- package/dist/src/tasks/index.d.ts +1 -1
- package/dist/src/tasks/index.d.ts.map +1 -1
- package/dist/src/tasks/text-generation/inference.d.ts +62 -0
- package/dist/src/tasks/text-generation/inference.d.ts.map +1 -1
- package/dist/src/tasks/text-to-audio/inference.d.ts +2 -2
- package/dist/src/tasks/text-to-speech/inference.d.ts +6 -8
- package/dist/src/tasks/text-to-speech/inference.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/model-libraries-snippets.ts +6 -0
- package/src/model-libraries.ts +14 -0
- package/src/tasks/automatic-speech-recognition/inference.ts +2 -2
- package/src/tasks/chat-completion/inference.ts +66 -21
- package/src/tasks/chat-completion/spec/input.json +163 -40
- package/src/tasks/chat-completion/spec/output.json +28 -18
- package/src/tasks/chat-completion/spec/stream_output.json +57 -14
- package/src/tasks/common-definitions.json +2 -2
- package/src/tasks/image-to-text/inference.ts +2 -2
- package/src/tasks/index.ts +5 -3
- package/src/tasks/text-generation/inference.ts +62 -0
- package/src/tasks/text-generation/spec/input.json +24 -0
- package/src/tasks/text-generation/spec/stream_output.json +7 -1
- package/src/tasks/text-to-audio/inference.ts +2 -2
- package/src/tasks/text-to-speech/inference.ts +6 -8
- package/src/tasks/text-to-speech/spec/input.json +26 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Chat Completion Input.\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": "ChatCompletionInput",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"required": ["
|
|
7
|
+
"required": ["messages"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"frequency_penalty": {
|
|
10
10
|
"type": "number",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"model": {
|
|
48
48
|
"type": "string",
|
|
49
49
|
"description": "[UNUSED] ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.",
|
|
50
|
-
"example": "mistralai/Mistral-7B-Instruct-v0.2"
|
|
50
|
+
"example": "mistralai/Mistral-7B-Instruct-v0.2",
|
|
51
|
+
"nullable": true
|
|
51
52
|
},
|
|
52
53
|
"n": {
|
|
53
54
|
"type": "integer",
|
|
@@ -64,6 +65,15 @@
|
|
|
64
65
|
"example": 0.1,
|
|
65
66
|
"nullable": true
|
|
66
67
|
},
|
|
68
|
+
"response_format": {
|
|
69
|
+
"allOf": [
|
|
70
|
+
{
|
|
71
|
+
"$ref": "#/$defs/ChatCompletionInputGrammarType"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"default": "null",
|
|
75
|
+
"nullable": true
|
|
76
|
+
},
|
|
67
77
|
"seed": {
|
|
68
78
|
"type": "integer",
|
|
69
79
|
"format": "int64",
|
|
@@ -83,6 +93,14 @@
|
|
|
83
93
|
"stream": {
|
|
84
94
|
"type": "boolean"
|
|
85
95
|
},
|
|
96
|
+
"stream_options": {
|
|
97
|
+
"allOf": [
|
|
98
|
+
{
|
|
99
|
+
"$ref": "#/$defs/ChatCompletionInputStreamOptions"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"nullable": true
|
|
103
|
+
},
|
|
86
104
|
"temperature": {
|
|
87
105
|
"type": "number",
|
|
88
106
|
"format": "float",
|
|
@@ -93,7 +111,7 @@
|
|
|
93
111
|
"tool_choice": {
|
|
94
112
|
"allOf": [
|
|
95
113
|
{
|
|
96
|
-
"$ref": "#/$defs/
|
|
114
|
+
"$ref": "#/$defs/ChatCompletionInputToolChoice"
|
|
97
115
|
}
|
|
98
116
|
],
|
|
99
117
|
"nullable": true
|
|
@@ -101,7 +119,7 @@
|
|
|
101
119
|
"tool_prompt": {
|
|
102
120
|
"type": "string",
|
|
103
121
|
"description": "A prompt to be appended before the tools",
|
|
104
|
-
"example": "
|
|
122
|
+
"example": "Given the functions available, please respond with a JSON for a function call with its proper arguments that best answers the given prompt. Respond in the format {name: function name, parameters: dictionary of argument name and its value}.Do not use variables.",
|
|
105
123
|
"nullable": true
|
|
106
124
|
},
|
|
107
125
|
"tools": {
|
|
@@ -132,12 +150,10 @@
|
|
|
132
150
|
"$defs": {
|
|
133
151
|
"ChatCompletionInputMessage": {
|
|
134
152
|
"type": "object",
|
|
135
|
-
"required": ["role"],
|
|
153
|
+
"required": ["role", "content"],
|
|
136
154
|
"properties": {
|
|
137
155
|
"content": {
|
|
138
|
-
"
|
|
139
|
-
"example": "My name is David and I",
|
|
140
|
-
"nullable": true
|
|
156
|
+
"$ref": "#/$defs/ChatCompletionInputMessageContent"
|
|
141
157
|
},
|
|
142
158
|
"name": {
|
|
143
159
|
"type": "string",
|
|
@@ -147,68 +163,160 @@
|
|
|
147
163
|
"role": {
|
|
148
164
|
"type": "string",
|
|
149
165
|
"example": "user"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"title": "ChatCompletionInputMessage"
|
|
169
|
+
},
|
|
170
|
+
"ChatCompletionInputMessageContent": {
|
|
171
|
+
"oneOf": [
|
|
172
|
+
{
|
|
173
|
+
"type": "string"
|
|
150
174
|
},
|
|
151
|
-
|
|
175
|
+
{
|
|
152
176
|
"type": "array",
|
|
153
177
|
"items": {
|
|
154
|
-
"$ref": "#/$defs/
|
|
155
|
-
}
|
|
156
|
-
|
|
178
|
+
"$ref": "#/$defs/ChatCompletionInputMessageChunk"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"title": "ChatCompletionInputMessageContent"
|
|
183
|
+
},
|
|
184
|
+
"ChatCompletionInputMessageChunk": {
|
|
185
|
+
"oneOf": [
|
|
186
|
+
{
|
|
187
|
+
"type": "object",
|
|
188
|
+
"required": ["text", "type"],
|
|
189
|
+
"properties": {
|
|
190
|
+
"text": {
|
|
191
|
+
"type": "string"
|
|
192
|
+
},
|
|
193
|
+
"type": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"enum": ["text"]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"type": "object",
|
|
201
|
+
"required": ["image_url", "type"],
|
|
202
|
+
"properties": {
|
|
203
|
+
"image_url": {
|
|
204
|
+
"$ref": "#/$defs/ChatCompletionInputUrl"
|
|
205
|
+
},
|
|
206
|
+
"type": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"enum": ["image_url"]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
157
211
|
}
|
|
212
|
+
],
|
|
213
|
+
"discriminator": {
|
|
214
|
+
"propertyName": "type"
|
|
158
215
|
},
|
|
159
|
-
"title": "
|
|
216
|
+
"title": "ChatCompletionInputMessageChunk"
|
|
160
217
|
},
|
|
161
|
-
"
|
|
218
|
+
"ChatCompletionInputUrl": {
|
|
162
219
|
"type": "object",
|
|
163
|
-
"required": ["
|
|
220
|
+
"required": ["url"],
|
|
164
221
|
"properties": {
|
|
165
|
-
"
|
|
166
|
-
"$ref": "#/$defs/ChatCompletionInputFunctionDefinition"
|
|
167
|
-
},
|
|
168
|
-
"id": {
|
|
169
|
-
"type": "integer",
|
|
170
|
-
"format": "int32",
|
|
171
|
-
"minimum": 0
|
|
172
|
-
},
|
|
173
|
-
"type": {
|
|
222
|
+
"url": {
|
|
174
223
|
"type": "string"
|
|
175
224
|
}
|
|
176
225
|
},
|
|
177
|
-
"title": "
|
|
226
|
+
"title": "ChatCompletionInputUrl"
|
|
178
227
|
},
|
|
179
|
-
"
|
|
228
|
+
"ChatCompletionInputGrammarType": {
|
|
229
|
+
"oneOf": [
|
|
230
|
+
{
|
|
231
|
+
"type": "object",
|
|
232
|
+
"required": ["type", "value"],
|
|
233
|
+
"properties": {
|
|
234
|
+
"type": {
|
|
235
|
+
"type": "string",
|
|
236
|
+
"enum": ["json"]
|
|
237
|
+
},
|
|
238
|
+
"value": {
|
|
239
|
+
"description": "A string that represents a [JSON Schema](https://json-schema.org/).\n\nJSON Schema is a declarative language that allows to annotate JSON documents\nwith types and descriptions."
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"type": "object",
|
|
245
|
+
"required": ["type", "value"],
|
|
246
|
+
"properties": {
|
|
247
|
+
"type": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"enum": ["regex"]
|
|
250
|
+
},
|
|
251
|
+
"value": {
|
|
252
|
+
"type": "string"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"discriminator": {
|
|
258
|
+
"propertyName": "type"
|
|
259
|
+
},
|
|
260
|
+
"title": "ChatCompletionInputGrammarType"
|
|
261
|
+
},
|
|
262
|
+
"ChatCompletionInputStreamOptions": {
|
|
180
263
|
"type": "object",
|
|
181
|
-
"required": ["
|
|
264
|
+
"required": ["include_usage"],
|
|
182
265
|
"properties": {
|
|
183
|
-
"
|
|
184
|
-
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
},
|
|
188
|
-
"name": {
|
|
189
|
-
"type": "string"
|
|
266
|
+
"include_usage": {
|
|
267
|
+
"type": "boolean",
|
|
268
|
+
"description": "If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value.",
|
|
269
|
+
"example": "true"
|
|
190
270
|
}
|
|
191
271
|
},
|
|
192
|
-
"title": "
|
|
272
|
+
"title": "ChatCompletionInputStreamOptions"
|
|
273
|
+
},
|
|
274
|
+
"ChatCompletionInputToolChoice": {
|
|
275
|
+
"allOf": [
|
|
276
|
+
{
|
|
277
|
+
"$ref": "#/$defs/ChatCompletionInputToolType"
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"nullable": true,
|
|
281
|
+
"title": "ChatCompletionInputToolChoice"
|
|
193
282
|
},
|
|
194
283
|
"ChatCompletionInputToolType": {
|
|
195
284
|
"oneOf": [
|
|
196
285
|
{
|
|
197
286
|
"type": "object",
|
|
198
|
-
"
|
|
287
|
+
"default": null,
|
|
288
|
+
"nullable": true
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"type": "string"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"type": "object",
|
|
295
|
+
"required": ["function"],
|
|
199
296
|
"properties": {
|
|
200
|
-
"
|
|
201
|
-
"
|
|
297
|
+
"function": {
|
|
298
|
+
"$ref": "#/$defs/ChatCompletionInputFunctionName"
|
|
202
299
|
}
|
|
203
300
|
}
|
|
204
301
|
},
|
|
205
302
|
{
|
|
206
|
-
"type": "
|
|
207
|
-
"
|
|
303
|
+
"type": "object",
|
|
304
|
+
"default": null,
|
|
305
|
+
"nullable": true
|
|
208
306
|
}
|
|
209
307
|
],
|
|
210
308
|
"title": "ChatCompletionInputToolType"
|
|
211
309
|
},
|
|
310
|
+
"ChatCompletionInputFunctionName": {
|
|
311
|
+
"type": "object",
|
|
312
|
+
"required": ["name"],
|
|
313
|
+
"properties": {
|
|
314
|
+
"name": {
|
|
315
|
+
"type": "string"
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"title": "ChatCompletionInputFunctionName"
|
|
319
|
+
},
|
|
212
320
|
"ChatCompletionInputTool": {
|
|
213
321
|
"type": "object",
|
|
214
322
|
"required": ["type", "function"],
|
|
@@ -222,6 +330,21 @@
|
|
|
222
330
|
}
|
|
223
331
|
},
|
|
224
332
|
"title": "ChatCompletionInputTool"
|
|
333
|
+
},
|
|
334
|
+
"ChatCompletionInputFunctionDefinition": {
|
|
335
|
+
"type": "object",
|
|
336
|
+
"required": ["name", "arguments"],
|
|
337
|
+
"properties": {
|
|
338
|
+
"arguments": {},
|
|
339
|
+
"description": {
|
|
340
|
+
"type": "string",
|
|
341
|
+
"nullable": true
|
|
342
|
+
},
|
|
343
|
+
"name": {
|
|
344
|
+
"type": "string"
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"title": "ChatCompletionInputFunctionDefinition"
|
|
225
348
|
}
|
|
226
349
|
}
|
|
227
350
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Chat Completion 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": "ChatCompletionOutput",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"required": ["id", "
|
|
7
|
+
"required": ["id", "created", "model", "system_fingerprint", "choices", "usage"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"choices": {
|
|
10
10
|
"type": "array",
|
|
@@ -25,9 +25,6 @@
|
|
|
25
25
|
"type": "string",
|
|
26
26
|
"example": "mistralai/Mistral-7B-Instruct-v0.2"
|
|
27
27
|
},
|
|
28
|
-
"object": {
|
|
29
|
-
"type": "string"
|
|
30
|
-
},
|
|
31
28
|
"system_fingerprint": {
|
|
32
29
|
"type": "string"
|
|
33
30
|
},
|
|
@@ -110,32 +107,47 @@
|
|
|
110
107
|
"title": "ChatCompletionOutputTopLogprob"
|
|
111
108
|
},
|
|
112
109
|
"ChatCompletionOutputMessage": {
|
|
110
|
+
"oneOf": [
|
|
111
|
+
{
|
|
112
|
+
"$ref": "#/$defs/ChatCompletionOutputTextMessage"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"$ref": "#/$defs/ChatCompletionOutputToolCallMessage"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"title": "ChatCompletionOutputMessage"
|
|
119
|
+
},
|
|
120
|
+
"ChatCompletionOutputTextMessage": {
|
|
113
121
|
"type": "object",
|
|
114
|
-
"required": ["role"],
|
|
122
|
+
"required": ["role", "content"],
|
|
115
123
|
"properties": {
|
|
116
124
|
"content": {
|
|
117
125
|
"type": "string",
|
|
118
|
-
"example": "My name is David and I"
|
|
119
|
-
"nullable": true
|
|
120
|
-
},
|
|
121
|
-
"name": {
|
|
122
|
-
"type": "string",
|
|
123
|
-
"example": "\"David\"",
|
|
124
|
-
"nullable": true
|
|
126
|
+
"example": "My name is David and I"
|
|
125
127
|
},
|
|
126
128
|
"role": {
|
|
127
129
|
"type": "string",
|
|
128
130
|
"example": "user"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"title": "ChatCompletionOutputTextMessage"
|
|
134
|
+
},
|
|
135
|
+
"ChatCompletionOutputToolCallMessage": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"required": ["role", "tool_calls"],
|
|
138
|
+
"properties": {
|
|
139
|
+
"role": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"example": "assistant"
|
|
129
142
|
},
|
|
130
143
|
"tool_calls": {
|
|
131
144
|
"type": "array",
|
|
132
145
|
"items": {
|
|
133
146
|
"$ref": "#/$defs/ChatCompletionOutputToolCall"
|
|
134
|
-
}
|
|
135
|
-
"nullable": true
|
|
147
|
+
}
|
|
136
148
|
}
|
|
137
149
|
},
|
|
138
|
-
"title": "
|
|
150
|
+
"title": "ChatCompletionOutputToolCallMessage"
|
|
139
151
|
},
|
|
140
152
|
"ChatCompletionOutputToolCall": {
|
|
141
153
|
"type": "object",
|
|
@@ -145,9 +157,7 @@
|
|
|
145
157
|
"$ref": "#/$defs/ChatCompletionOutputFunctionDefinition"
|
|
146
158
|
},
|
|
147
159
|
"id": {
|
|
148
|
-
"type": "
|
|
149
|
-
"format": "int32",
|
|
150
|
-
"minimum": 0
|
|
160
|
+
"type": "string"
|
|
151
161
|
},
|
|
152
162
|
"type": {
|
|
153
163
|
"type": "string"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Chat Completion 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
5
|
"title": "ChatCompletionStreamOutput",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"required": ["id", "
|
|
7
|
+
"required": ["id", "created", "model", "system_fingerprint", "choices"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"choices": {
|
|
10
10
|
"type": "array",
|
|
@@ -25,11 +25,16 @@
|
|
|
25
25
|
"type": "string",
|
|
26
26
|
"example": "mistralai/Mistral-7B-Instruct-v0.2"
|
|
27
27
|
},
|
|
28
|
-
"object": {
|
|
29
|
-
"type": "string"
|
|
30
|
-
},
|
|
31
28
|
"system_fingerprint": {
|
|
32
29
|
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"usage": {
|
|
32
|
+
"allOf": [
|
|
33
|
+
{
|
|
34
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputUsage"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"nullable": true
|
|
33
38
|
}
|
|
34
39
|
},
|
|
35
40
|
"$defs": {
|
|
@@ -61,28 +66,44 @@
|
|
|
61
66
|
"title": "ChatCompletionStreamOutputChoice"
|
|
62
67
|
},
|
|
63
68
|
"ChatCompletionStreamOutputDelta": {
|
|
69
|
+
"oneOf": [
|
|
70
|
+
{
|
|
71
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputTextMessage"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputToolCallDelta"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"title": "ChatCompletionStreamOutputDelta"
|
|
78
|
+
},
|
|
79
|
+
"ChatCompletionStreamOutputTextMessage": {
|
|
64
80
|
"type": "object",
|
|
65
|
-
"required": ["role"],
|
|
81
|
+
"required": ["role", "content"],
|
|
66
82
|
"properties": {
|
|
67
83
|
"content": {
|
|
68
84
|
"type": "string",
|
|
69
|
-
"example": "
|
|
70
|
-
"nullable": true
|
|
85
|
+
"example": "My name is David and I"
|
|
71
86
|
},
|
|
72
87
|
"role": {
|
|
73
88
|
"type": "string",
|
|
74
89
|
"example": "user"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"title": "ChatCompletionStreamOutputTextMessage"
|
|
93
|
+
},
|
|
94
|
+
"ChatCompletionStreamOutputToolCallDelta": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"required": ["role", "tool_calls"],
|
|
97
|
+
"properties": {
|
|
98
|
+
"role": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"example": "assistant"
|
|
75
101
|
},
|
|
76
102
|
"tool_calls": {
|
|
77
|
-
"
|
|
78
|
-
{
|
|
79
|
-
"$ref": "#/$defs/ChatCompletionStreamOutputDeltaToolCall"
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
"nullable": true
|
|
103
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputDeltaToolCall"
|
|
83
104
|
}
|
|
84
105
|
},
|
|
85
|
-
"title": "
|
|
106
|
+
"title": "ChatCompletionStreamOutputToolCallDelta"
|
|
86
107
|
},
|
|
87
108
|
"ChatCompletionStreamOutputDeltaToolCall": {
|
|
88
109
|
"type": "object",
|
|
@@ -165,6 +186,28 @@
|
|
|
165
186
|
}
|
|
166
187
|
},
|
|
167
188
|
"title": "ChatCompletionStreamOutputTopLogprob"
|
|
189
|
+
},
|
|
190
|
+
"ChatCompletionStreamOutputUsage": {
|
|
191
|
+
"type": "object",
|
|
192
|
+
"required": ["prompt_tokens", "completion_tokens", "total_tokens"],
|
|
193
|
+
"properties": {
|
|
194
|
+
"completion_tokens": {
|
|
195
|
+
"type": "integer",
|
|
196
|
+
"format": "int32",
|
|
197
|
+
"minimum": 0
|
|
198
|
+
},
|
|
199
|
+
"prompt_tokens": {
|
|
200
|
+
"type": "integer",
|
|
201
|
+
"format": "int32",
|
|
202
|
+
"minimum": 0
|
|
203
|
+
},
|
|
204
|
+
"total_tokens": {
|
|
205
|
+
"type": "integer",
|
|
206
|
+
"format": "int32",
|
|
207
|
+
"minimum": 0
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"title": "ChatCompletionStreamOutputUsage"
|
|
168
211
|
}
|
|
169
212
|
}
|
|
170
213
|
}
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"max_new_tokens": {
|
|
61
61
|
"type": "integer",
|
|
62
|
-
"description": "The maximum number of tokens to generate. Takes precedence over
|
|
62
|
+
"description": "The maximum number of tokens to generate. Takes precedence over max_length."
|
|
63
63
|
},
|
|
64
64
|
"min_length": {
|
|
65
65
|
"type": "integer",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"min_new_tokens": {
|
|
69
69
|
"type": "integer",
|
|
70
|
-
"description": "The minimum number of tokens to generate. Takes precedence over
|
|
70
|
+
"description": "The minimum number of tokens to generate. Takes precedence over min_length."
|
|
71
71
|
},
|
|
72
72
|
"do_sample": {
|
|
73
73
|
"type": "boolean",
|
|
@@ -72,7 +72,7 @@ export interface GenerationParameters {
|
|
|
72
72
|
*/
|
|
73
73
|
max_length?: number;
|
|
74
74
|
/**
|
|
75
|
-
* The maximum number of tokens to generate. Takes precedence over
|
|
75
|
+
* The maximum number of tokens to generate. Takes precedence over max_length.
|
|
76
76
|
*/
|
|
77
77
|
max_new_tokens?: number;
|
|
78
78
|
/**
|
|
@@ -80,7 +80,7 @@ export interface GenerationParameters {
|
|
|
80
80
|
*/
|
|
81
81
|
min_length?: number;
|
|
82
82
|
/**
|
|
83
|
-
* The minimum number of tokens to generate. Takes precedence over
|
|
83
|
+
* The minimum number of tokens to generate. Takes precedence over min_length.
|
|
84
84
|
*/
|
|
85
85
|
min_new_tokens?: number;
|
|
86
86
|
/**
|
package/src/tasks/index.ts
CHANGED
|
@@ -39,6 +39,8 @@ import zeroShotImageClassification from "./zero-shot-image-classification/data";
|
|
|
39
39
|
import zeroShotObjectDetection from "./zero-shot-object-detection/data";
|
|
40
40
|
import imageTo3D from "./image-to-3d/data";
|
|
41
41
|
import textTo3D from "./text-to-3d/data";
|
|
42
|
+
import keypointDetection from "./keypoint-detection/data";
|
|
43
|
+
import videoTextToText from "./video-text-to-text/data";
|
|
42
44
|
|
|
43
45
|
export type * from "./audio-classification/inference";
|
|
44
46
|
export type * from "./automatic-speech-recognition/inference";
|
|
@@ -71,7 +73,7 @@ export type * from "./sentence-similarity/inference";
|
|
|
71
73
|
export type * from "./summarization/inference";
|
|
72
74
|
export type * from "./table-question-answering/inference";
|
|
73
75
|
export type { TextToImageInput, TextToImageOutput, TextToImageParameters } from "./text-to-image/inference";
|
|
74
|
-
export type {
|
|
76
|
+
export type { TextToSpeechParameters, TextToSpeechInput, TextToSpeechOutput } from "./text-to-speech/inference";
|
|
75
77
|
export type * from "./token-classification/inference";
|
|
76
78
|
export type { TranslationInput, TranslationOutput } from "./translation/inference";
|
|
77
79
|
export type {
|
|
@@ -208,7 +210,7 @@ export const TASKS_DATA: Record<PipelineType, TaskData | undefined> = {
|
|
|
208
210
|
"image-text-to-text": getData("image-text-to-text", imageTextToText),
|
|
209
211
|
"image-to-text": getData("image-to-text", imageToText),
|
|
210
212
|
"image-to-video": undefined,
|
|
211
|
-
"keypoint-detection": getData("keypoint-detection",
|
|
213
|
+
"keypoint-detection": getData("keypoint-detection", keypointDetection),
|
|
212
214
|
"mask-generation": getData("mask-generation", maskGeneration),
|
|
213
215
|
"multiple-choice": undefined,
|
|
214
216
|
"object-detection": getData("object-detection", objectDetection),
|
|
@@ -236,7 +238,7 @@ export const TASKS_DATA: Record<PipelineType, TaskData | undefined> = {
|
|
|
236
238
|
"token-classification": getData("token-classification", tokenClassification),
|
|
237
239
|
translation: getData("translation", translation),
|
|
238
240
|
"unconditional-image-generation": getData("unconditional-image-generation", unconditionalImageGeneration),
|
|
239
|
-
"video-text-to-text": getData("video-text-to-text",
|
|
241
|
+
"video-text-to-text": getData("video-text-to-text", videoTextToText),
|
|
240
242
|
"visual-question-answering": getData("visual-question-answering", visualQuestionAnswering),
|
|
241
243
|
"voice-activity-detection": undefined,
|
|
242
244
|
"zero-shot-classification": getData("zero-shot-classification", zeroShotClassification),
|
|
@@ -19,23 +19,84 @@ export interface TextGenerationInput {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface TextGenerationInputGenerateParameters {
|
|
22
|
+
/**
|
|
23
|
+
* Lora adapter id
|
|
24
|
+
*/
|
|
25
|
+
adapter_id?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Generate best_of sequences and return the one if the highest token logprobs.
|
|
28
|
+
*/
|
|
22
29
|
best_of?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to return decoder input token logprobs and ids.
|
|
32
|
+
*/
|
|
23
33
|
decoder_input_details?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to return generation details.
|
|
36
|
+
*/
|
|
24
37
|
details?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Activate logits sampling.
|
|
40
|
+
*/
|
|
25
41
|
do_sample?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The parameter for frequency penalty. 1.0 means no penalty
|
|
44
|
+
* Penalize new tokens based on their existing frequency in the text so far,
|
|
45
|
+
* decreasing the model's likelihood to repeat the same line verbatim.
|
|
46
|
+
*/
|
|
26
47
|
frequency_penalty?: number;
|
|
27
48
|
grammar?: TextGenerationInputGrammarType;
|
|
49
|
+
/**
|
|
50
|
+
* Maximum number of tokens to generate.
|
|
51
|
+
*/
|
|
28
52
|
max_new_tokens?: number;
|
|
53
|
+
/**
|
|
54
|
+
* The parameter for repetition penalty. 1.0 means no penalty.
|
|
55
|
+
* See [this paper](https://arxiv.org/pdf/1909.05858.pdf) for more details.
|
|
56
|
+
*/
|
|
29
57
|
repetition_penalty?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to prepend the prompt to the generated text
|
|
60
|
+
*/
|
|
30
61
|
return_full_text?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Random sampling seed.
|
|
64
|
+
*/
|
|
31
65
|
seed?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Stop generating tokens if a member of `stop` is generated.
|
|
68
|
+
*/
|
|
32
69
|
stop?: string[];
|
|
70
|
+
/**
|
|
71
|
+
* The value used to module the logits distribution.
|
|
72
|
+
*/
|
|
33
73
|
temperature?: number;
|
|
74
|
+
/**
|
|
75
|
+
* The number of highest probability vocabulary tokens to keep for top-k-filtering.
|
|
76
|
+
*/
|
|
34
77
|
top_k?: number;
|
|
78
|
+
/**
|
|
79
|
+
* The number of highest probability vocabulary tokens to keep for top-n-filtering.
|
|
80
|
+
*/
|
|
35
81
|
top_n_tokens?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Top-p value for nucleus sampling.
|
|
84
|
+
*/
|
|
36
85
|
top_p?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Truncate inputs tokens to the given size.
|
|
88
|
+
*/
|
|
37
89
|
truncate?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Typical Decoding mass
|
|
92
|
+
* See [Typical Decoding for Natural Language Generation](https://arxiv.org/abs/2202.00666)
|
|
93
|
+
* for more information.
|
|
94
|
+
*/
|
|
38
95
|
typical_p?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Watermarking with [A Watermark for Large Language
|
|
98
|
+
* Models](https://arxiv.org/abs/2301.10226).
|
|
99
|
+
*/
|
|
39
100
|
watermark?: boolean;
|
|
40
101
|
[property: string]: unknown;
|
|
41
102
|
}
|
|
@@ -125,6 +186,7 @@ export interface TextGenerationStreamOutput {
|
|
|
125
186
|
export interface TextGenerationStreamOutputStreamDetails {
|
|
126
187
|
finish_reason: TextGenerationOutputFinishReason;
|
|
127
188
|
generated_tokens: number;
|
|
189
|
+
input_length: number;
|
|
128
190
|
seed?: number;
|
|
129
191
|
[property: string]: unknown;
|
|
130
192
|
}
|