@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.
- package/README.md +12 -14
- package/dist/index.cjs +91 -18
- package/dist/index.js +90 -18
- package/dist/scripts/inference-codegen.d.ts +2 -0
- package/dist/scripts/inference-codegen.d.ts.map +1 -0
- package/dist/scripts/inference-tgi-import.d.ts +2 -0
- package/dist/scripts/inference-tgi-import.d.ts.map +1 -0
- package/dist/src/default-widget-inputs.d.ts +6 -0
- package/dist/src/default-widget-inputs.d.ts.map +1 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/library-to-tasks.d.ts +11 -0
- package/dist/src/library-to-tasks.d.ts.map +1 -0
- package/dist/src/local-apps.d.ts +104 -0
- package/dist/src/local-apps.d.ts.map +1 -0
- package/dist/src/model-data.d.ts +144 -0
- package/dist/src/model-data.d.ts.map +1 -0
- package/dist/src/model-libraries-downloads.d.ts +26 -0
- package/dist/src/model-libraries-downloads.d.ts.map +1 -0
- package/dist/src/model-libraries-snippets.d.ts +43 -0
- package/dist/src/model-libraries-snippets.d.ts.map +1 -0
- package/dist/src/model-libraries.d.ts +501 -0
- package/dist/src/model-libraries.d.ts.map +1 -0
- package/dist/src/pipelines.d.ts +404 -0
- package/dist/src/pipelines.d.ts.map +1 -0
- package/dist/src/snippets/curl.d.ts +9 -0
- package/dist/src/snippets/curl.d.ts.map +1 -0
- package/dist/src/snippets/index.d.ts +6 -0
- package/dist/src/snippets/index.d.ts.map +1 -0
- package/dist/src/snippets/inputs.d.ts +3 -0
- package/dist/src/snippets/inputs.d.ts.map +1 -0
- package/dist/src/snippets/js.d.ts +11 -0
- package/dist/src/snippets/js.d.ts.map +1 -0
- package/dist/src/snippets/python.d.ts +14 -0
- package/dist/src/snippets/python.d.ts.map +1 -0
- package/dist/src/snippets/types.d.ts +8 -0
- package/dist/src/snippets/types.d.ts.map +1 -0
- package/dist/src/tasks/audio-classification/data.d.ts +4 -0
- package/dist/src/tasks/audio-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/audio-classification/inference.d.ts +52 -0
- package/dist/src/tasks/audio-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/audio-to-audio/data.d.ts +4 -0
- package/dist/src/tasks/audio-to-audio/data.d.ts.map +1 -0
- package/dist/src/tasks/automatic-speech-recognition/data.d.ts +4 -0
- package/dist/src/tasks/automatic-speech-recognition/data.d.ts.map +1 -0
- package/dist/src/tasks/automatic-speech-recognition/inference.d.ts +154 -0
- package/dist/src/tasks/automatic-speech-recognition/inference.d.ts.map +1 -0
- package/dist/src/tasks/chat-completion/inference.d.ts +254 -0
- package/dist/src/tasks/chat-completion/inference.d.ts.map +1 -0
- package/dist/src/tasks/depth-estimation/data.d.ts +4 -0
- package/dist/src/tasks/depth-estimation/data.d.ts.map +1 -0
- package/dist/src/tasks/depth-estimation/inference.d.ts +36 -0
- package/dist/src/tasks/depth-estimation/inference.d.ts.map +1 -0
- package/dist/src/tasks/document-question-answering/data.d.ts +4 -0
- package/dist/src/tasks/document-question-answering/data.d.ts.map +1 -0
- package/dist/src/tasks/document-question-answering/inference.d.ts +111 -0
- package/dist/src/tasks/document-question-answering/inference.d.ts.map +1 -0
- package/dist/src/tasks/feature-extraction/data.d.ts +4 -0
- package/dist/src/tasks/feature-extraction/data.d.ts.map +1 -0
- package/dist/src/tasks/feature-extraction/inference.d.ts +23 -0
- package/dist/src/tasks/feature-extraction/inference.d.ts.map +1 -0
- package/dist/src/tasks/fill-mask/data.d.ts +4 -0
- package/dist/src/tasks/fill-mask/data.d.ts.map +1 -0
- package/dist/src/tasks/fill-mask/inference.d.ts +63 -0
- package/dist/src/tasks/fill-mask/inference.d.ts.map +1 -0
- package/dist/src/tasks/image-classification/data.d.ts +4 -0
- package/dist/src/tasks/image-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/image-classification/inference.d.ts +52 -0
- package/dist/src/tasks/image-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/image-feature-extraction/data.d.ts +4 -0
- package/dist/src/tasks/image-feature-extraction/data.d.ts.map +1 -0
- package/dist/src/tasks/image-segmentation/data.d.ts +4 -0
- package/dist/src/tasks/image-segmentation/data.d.ts.map +1 -0
- package/dist/src/tasks/image-segmentation/inference.d.ts +66 -0
- package/dist/src/tasks/image-segmentation/inference.d.ts.map +1 -0
- package/dist/src/tasks/image-to-image/data.d.ts +4 -0
- package/dist/src/tasks/image-to-image/data.d.ts.map +1 -0
- package/dist/src/tasks/image-to-image/inference.d.ts +64 -0
- package/dist/src/tasks/image-to-image/inference.d.ts.map +1 -0
- package/dist/src/tasks/image-to-text/data.d.ts +4 -0
- package/dist/src/tasks/image-to-text/data.d.ts.map +1 -0
- package/dist/src/tasks/image-to-text/inference.d.ts +139 -0
- package/dist/src/tasks/image-to-text/inference.d.ts.map +1 -0
- package/dist/src/tasks/index.d.ts +87 -0
- package/dist/src/tasks/index.d.ts.map +1 -0
- package/dist/src/tasks/mask-generation/data.d.ts +4 -0
- package/dist/src/tasks/mask-generation/data.d.ts.map +1 -0
- package/dist/src/tasks/object-detection/data.d.ts +4 -0
- package/dist/src/tasks/object-detection/data.d.ts.map +1 -0
- package/dist/src/tasks/object-detection/inference.d.ts +63 -0
- package/dist/src/tasks/object-detection/inference.d.ts.map +1 -0
- package/dist/src/tasks/placeholder/data.d.ts +4 -0
- package/dist/src/tasks/placeholder/data.d.ts.map +1 -0
- package/dist/src/tasks/question-answering/data.d.ts +4 -0
- package/dist/src/tasks/question-answering/data.d.ts.map +1 -0
- package/dist/src/tasks/question-answering/inference.d.ts +100 -0
- package/dist/src/tasks/question-answering/inference.d.ts.map +1 -0
- package/dist/src/tasks/reinforcement-learning/data.d.ts +4 -0
- package/dist/src/tasks/reinforcement-learning/data.d.ts.map +1 -0
- package/dist/src/tasks/sentence-similarity/data.d.ts +4 -0
- package/dist/src/tasks/sentence-similarity/data.d.ts.map +1 -0
- package/dist/src/tasks/sentence-similarity/inference.d.ts +32 -0
- package/dist/src/tasks/sentence-similarity/inference.d.ts.map +1 -0
- package/dist/src/tasks/summarization/data.d.ts +4 -0
- package/dist/src/tasks/summarization/data.d.ts.map +1 -0
- package/dist/src/tasks/summarization/inference.d.ts +55 -0
- package/dist/src/tasks/summarization/inference.d.ts.map +1 -0
- package/dist/src/tasks/table-question-answering/data.d.ts +4 -0
- package/dist/src/tasks/table-question-answering/data.d.ts.map +1 -0
- package/dist/src/tasks/table-question-answering/inference.d.ts +62 -0
- package/dist/src/tasks/table-question-answering/inference.d.ts.map +1 -0
- package/dist/src/tasks/tabular-classification/data.d.ts +4 -0
- package/dist/src/tasks/tabular-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/tabular-regression/data.d.ts +4 -0
- package/dist/src/tasks/tabular-regression/data.d.ts.map +1 -0
- package/dist/src/tasks/text-classification/data.d.ts +4 -0
- package/dist/src/tasks/text-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/text-classification/inference.d.ts +52 -0
- package/dist/src/tasks/text-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-generation/data.d.ts +4 -0
- package/dist/src/tasks/text-generation/data.d.ts.map +1 -0
- package/dist/src/tasks/text-generation/inference.d.ts +126 -0
- package/dist/src/tasks/text-generation/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-to-audio/inference.d.ts +139 -0
- package/dist/src/tasks/text-to-audio/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-to-image/data.d.ts +4 -0
- package/dist/src/tasks/text-to-image/data.d.ts.map +1 -0
- package/dist/src/tasks/text-to-image/inference.d.ts +68 -0
- package/dist/src/tasks/text-to-image/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-to-speech/data.d.ts +4 -0
- package/dist/src/tasks/text-to-speech/data.d.ts.map +1 -0
- package/dist/src/tasks/text-to-speech/inference.d.ts +143 -0
- package/dist/src/tasks/text-to-speech/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-to-video/data.d.ts +4 -0
- package/dist/src/tasks/text-to-video/data.d.ts.map +1 -0
- package/dist/src/tasks/text2text-generation/inference.d.ts +54 -0
- package/dist/src/tasks/text2text-generation/inference.d.ts.map +1 -0
- package/dist/src/tasks/token-classification/data.d.ts +4 -0
- package/dist/src/tasks/token-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/token-classification/inference.d.ts +83 -0
- package/dist/src/tasks/token-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/translation/data.d.ts +4 -0
- package/dist/src/tasks/translation/data.d.ts.map +1 -0
- package/dist/src/tasks/translation/inference.d.ts +55 -0
- package/dist/src/tasks/translation/inference.d.ts.map +1 -0
- package/dist/src/tasks/unconditional-image-generation/data.d.ts +4 -0
- package/dist/src/tasks/unconditional-image-generation/data.d.ts.map +1 -0
- package/dist/src/tasks/video-classification/data.d.ts +4 -0
- package/dist/src/tasks/video-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/video-classification/inference.d.ts +60 -0
- package/dist/src/tasks/video-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/visual-question-answering/data.d.ts +4 -0
- package/dist/src/tasks/visual-question-answering/data.d.ts.map +1 -0
- package/dist/src/tasks/visual-question-answering/inference.d.ts +64 -0
- package/dist/src/tasks/visual-question-answering/inference.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-classification/data.d.ts +4 -0
- package/dist/src/tasks/zero-shot-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-classification/inference.d.ts +68 -0
- package/dist/src/tasks/zero-shot-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-image-classification/data.d.ts +4 -0
- package/dist/src/tasks/zero-shot-image-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-image-classification/inference.d.ts +62 -0
- package/dist/src/tasks/zero-shot-image-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-object-detection/data.d.ts +4 -0
- package/dist/src/tasks/zero-shot-object-detection/data.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-object-detection/inference.d.ts +67 -0
- package/dist/src/tasks/zero-shot-object-detection/inference.d.ts.map +1 -0
- package/dist/src/tokenizer-data.d.ts +26 -0
- package/dist/src/tokenizer-data.d.ts.map +1 -0
- package/dist/src/widget-example.d.ts +86 -0
- package/dist/src/widget-example.d.ts.map +1 -0
- package/package.json +8 -6
- package/src/index.ts +3 -0
- package/src/local-apps.ts +119 -0
- package/src/model-data.ts +1 -5
- package/src/model-libraries-snippets.ts +21 -18
- package/src/model-libraries.ts +9 -0
- package/src/tasks/chat-completion/inference.ts +204 -85
- package/src/tasks/chat-completion/spec/input.json +198 -34
- package/src/tasks/chat-completion/spec/output.json +178 -40
- package/src/tasks/chat-completion/spec/stream_output.json +170 -0
- package/src/tasks/index.ts +7 -8
- package/src/tasks/text-generation/inference.ts +58 -170
- package/src/tasks/text-generation/spec/input.json +130 -29
- package/src/tasks/text-generation/spec/output.json +104 -90
- package/src/tasks/text-generation/spec/stream_output.json +97 -0
- package/tsconfig.json +3 -1
- package/dist/index.d.ts +0 -3542
- package/src/tasks/chat-completion/spec/output_stream.json +0 -48
- 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": "
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
37
|
-
"type": "
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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/
|
|
76
|
-
"description": "The reason why the generation was stopped."
|
|
35
|
+
"$ref": "#/$defs/TextGenerationOutputFinishReason"
|
|
77
36
|
},
|
|
78
37
|
"generated_tokens": {
|
|
79
38
|
"type": "integer",
|
|
80
|
-
"
|
|
39
|
+
"format": "int32",
|
|
40
|
+
"example": 1,
|
|
41
|
+
"minimum": 0
|
|
81
42
|
},
|
|
82
43
|
"prefill": {
|
|
83
44
|
"type": "array",
|
|
84
45
|
"items": {
|
|
85
|
-
"$ref": "#/$defs/
|
|
46
|
+
"$ref": "#/$defs/TextGenerationOutputPrefillToken"
|
|
86
47
|
}
|
|
87
48
|
},
|
|
88
49
|
"seed": {
|
|
89
50
|
"type": "integer",
|
|
90
|
-
"
|
|
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/
|
|
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/
|
|
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
|
-
"
|
|
72
|
+
"title": "TextGenerationOutputDetails"
|
|
118
73
|
},
|
|
119
|
-
"
|
|
74
|
+
"TextGenerationOutputBestOfSequence": {
|
|
120
75
|
"type": "object",
|
|
121
|
-
"
|
|
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
|
-
"
|
|
126
|
-
},
|
|
127
|
-
"finish_reason": {
|
|
128
|
-
"$ref": "#/$defs/FinishReason"
|
|
83
|
+
"example": "test"
|
|
129
84
|
},
|
|
130
85
|
"generated_tokens": {
|
|
131
86
|
"type": "integer",
|
|
132
|
-
"
|
|
87
|
+
"format": "int32",
|
|
88
|
+
"example": 1,
|
|
89
|
+
"minimum": 0
|
|
133
90
|
},
|
|
134
91
|
"prefill": {
|
|
135
92
|
"type": "array",
|
|
136
93
|
"items": {
|
|
137
|
-
"$ref": "#/$defs/
|
|
94
|
+
"$ref": "#/$defs/TextGenerationOutputPrefillToken"
|
|
138
95
|
}
|
|
139
96
|
},
|
|
140
97
|
"seed": {
|
|
141
98
|
"type": "integer",
|
|
142
|
-
"
|
|
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/
|
|
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/
|
|
115
|
+
"$ref": "#/$defs/TextGenerationOutputToken"
|
|
158
116
|
}
|
|
159
117
|
}
|
|
160
118
|
}
|
|
161
119
|
},
|
|
162
|
-
"
|
|
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