@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,63 +1,227 @@
|
|
|
1
1
|
{
|
|
2
|
-
"title": "ChatCompletionInput",
|
|
3
2
|
"$id": "/inference/schemas/chat-completion/input.json",
|
|
4
3
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
5
|
-
"description": "
|
|
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
|
+
"title": "ChatCompletionInput",
|
|
6
6
|
"type": "object",
|
|
7
|
+
"required": ["model", "messages"],
|
|
7
8
|
"properties": {
|
|
8
|
-
"
|
|
9
|
+
"frequency_penalty": {
|
|
10
|
+
"type": "number",
|
|
11
|
+
"format": "float",
|
|
12
|
+
"description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far,\ndecreasing the model's likelihood to repeat the same line verbatim.",
|
|
13
|
+
"example": "1.0",
|
|
14
|
+
"nullable": true
|
|
15
|
+
},
|
|
16
|
+
"logit_bias": {
|
|
9
17
|
"type": "array",
|
|
10
|
-
"title": "ChatCompletionInputMessage",
|
|
11
18
|
"items": {
|
|
12
|
-
"type": "
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"content": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"description": "The content of the message."
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"required": ["role", "content"]
|
|
23
|
-
}
|
|
19
|
+
"type": "number",
|
|
20
|
+
"format": "float"
|
|
21
|
+
},
|
|
22
|
+
"description": "UNUSED\nModify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens\n(specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically,\nthe bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model,\nbut values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should\nresult in a ban or exclusive selection of the relevant token.",
|
|
23
|
+
"nullable": true
|
|
24
24
|
},
|
|
25
|
-
"
|
|
26
|
-
"type": "
|
|
27
|
-
"description": "
|
|
25
|
+
"logprobs": {
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"description": "Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each\noutput token returned in the content of message.",
|
|
28
|
+
"example": "false",
|
|
29
|
+
"nullable": true
|
|
28
30
|
},
|
|
29
31
|
"max_tokens": {
|
|
30
32
|
"type": "integer",
|
|
31
|
-
"
|
|
33
|
+
"format": "int32",
|
|
34
|
+
"description": "The maximum number of tokens that can be generated in the chat completion.",
|
|
35
|
+
"example": "32",
|
|
36
|
+
"nullable": true,
|
|
37
|
+
"minimum": 0
|
|
38
|
+
},
|
|
39
|
+
"messages": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": {
|
|
42
|
+
"$ref": "#/$defs/ChatCompletionInputMessage"
|
|
43
|
+
},
|
|
44
|
+
"description": "A list of messages comprising the conversation so far.",
|
|
45
|
+
"example": "[{\"role\": \"user\", \"content\": \"What is Deep Learning?\"}]"
|
|
46
|
+
},
|
|
47
|
+
"model": {
|
|
48
|
+
"type": "string",
|
|
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"
|
|
51
|
+
},
|
|
52
|
+
"n": {
|
|
53
|
+
"type": "integer",
|
|
54
|
+
"format": "int32",
|
|
55
|
+
"description": "UNUSED\nHow many chat completion choices to generate for each input message. Note that you will be charged based on the\nnumber of generated tokens across all of the choices. Keep n as 1 to minimize costs.",
|
|
56
|
+
"example": "2",
|
|
57
|
+
"nullable": true,
|
|
58
|
+
"minimum": 0
|
|
59
|
+
},
|
|
60
|
+
"presence_penalty": {
|
|
61
|
+
"type": "number",
|
|
62
|
+
"format": "float",
|
|
63
|
+
"description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far,\nincreasing the model's likelihood to talk about new topics",
|
|
64
|
+
"example": 0.1,
|
|
65
|
+
"nullable": true
|
|
32
66
|
},
|
|
33
67
|
"seed": {
|
|
34
68
|
"type": "integer",
|
|
35
|
-
"
|
|
69
|
+
"format": "int64",
|
|
70
|
+
"example": 42,
|
|
71
|
+
"nullable": true,
|
|
72
|
+
"minimum": 0
|
|
36
73
|
},
|
|
37
74
|
"stop": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "string"
|
|
78
|
+
},
|
|
79
|
+
"description": "Up to 4 sequences where the API will stop generating further tokens.",
|
|
80
|
+
"example": "null",
|
|
81
|
+
"nullable": true
|
|
41
82
|
},
|
|
42
83
|
"stream": {
|
|
43
|
-
"type": "boolean"
|
|
44
|
-
"description": "If set, partial message deltas will be sent."
|
|
84
|
+
"type": "boolean"
|
|
45
85
|
},
|
|
46
86
|
"temperature": {
|
|
47
87
|
"type": "number",
|
|
48
|
-
"
|
|
88
|
+
"format": "float",
|
|
89
|
+
"description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while\nlower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.",
|
|
90
|
+
"example": 1,
|
|
91
|
+
"nullable": true
|
|
92
|
+
},
|
|
93
|
+
"tool_choice": {
|
|
94
|
+
"allOf": [
|
|
95
|
+
{
|
|
96
|
+
"$ref": "#/$defs/ChatCompletionInputToolType"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"nullable": true
|
|
100
|
+
},
|
|
101
|
+
"tool_prompt": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"description": "A prompt to be appended before the tools",
|
|
104
|
+
"example": "\"You will be presented with a JSON schema representing a set of tools.\nIf the user request lacks of sufficient information to make a precise tool selection: Do not invent any tool's properties, instead notify with an error message.\n\nJSON Schema:\n\"",
|
|
105
|
+
"nullable": true
|
|
106
|
+
},
|
|
107
|
+
"tools": {
|
|
108
|
+
"type": "array",
|
|
109
|
+
"items": {
|
|
110
|
+
"$ref": "#/$defs/ChatCompletionInputTool"
|
|
111
|
+
},
|
|
112
|
+
"description": "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of\nfunctions the model may generate JSON inputs for.",
|
|
113
|
+
"example": "null",
|
|
114
|
+
"nullable": true
|
|
115
|
+
},
|
|
116
|
+
"top_logprobs": {
|
|
117
|
+
"type": "integer",
|
|
118
|
+
"format": "int32",
|
|
119
|
+
"description": "An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with\nan associated log probability. logprobs must be set to true if this parameter is used.",
|
|
120
|
+
"example": "5",
|
|
121
|
+
"nullable": true,
|
|
122
|
+
"minimum": 0
|
|
49
123
|
},
|
|
50
124
|
"top_p": {
|
|
51
125
|
"type": "number",
|
|
52
|
-
"
|
|
126
|
+
"format": "float",
|
|
127
|
+
"description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the\ntokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.",
|
|
128
|
+
"example": 0.95,
|
|
129
|
+
"nullable": true
|
|
53
130
|
}
|
|
54
131
|
},
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
132
|
+
"$defs": {
|
|
133
|
+
"ChatCompletionInputMessage": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"required": ["role"],
|
|
136
|
+
"properties": {
|
|
137
|
+
"content": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"example": "My name is David and I",
|
|
140
|
+
"nullable": true
|
|
141
|
+
},
|
|
142
|
+
"name": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"example": "\"David\"",
|
|
145
|
+
"nullable": true
|
|
146
|
+
},
|
|
147
|
+
"role": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"example": "user"
|
|
150
|
+
},
|
|
151
|
+
"tool_calls": {
|
|
152
|
+
"type": "array",
|
|
153
|
+
"items": {
|
|
154
|
+
"$ref": "#/$defs/ChatCompletionInputToolCall"
|
|
155
|
+
},
|
|
156
|
+
"nullable": true
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"title": "ChatCompletionInputMessage"
|
|
160
|
+
},
|
|
161
|
+
"ChatCompletionInputToolCall": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"required": ["id", "type", "function"],
|
|
164
|
+
"properties": {
|
|
165
|
+
"function": {
|
|
166
|
+
"$ref": "#/$defs/ChatCompletionInputFunctionDefinition"
|
|
167
|
+
},
|
|
168
|
+
"id": {
|
|
169
|
+
"type": "integer",
|
|
170
|
+
"format": "int32",
|
|
171
|
+
"minimum": 0
|
|
172
|
+
},
|
|
173
|
+
"type": {
|
|
174
|
+
"type": "string"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"title": "ChatCompletionInputToolCall"
|
|
178
|
+
},
|
|
179
|
+
"ChatCompletionInputFunctionDefinition": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"required": ["name", "arguments"],
|
|
182
|
+
"properties": {
|
|
183
|
+
"arguments": {},
|
|
184
|
+
"description": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"nullable": true
|
|
187
|
+
},
|
|
188
|
+
"name": {
|
|
189
|
+
"type": "string"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"title": "ChatCompletionInputFunctionDefinition"
|
|
193
|
+
},
|
|
194
|
+
"ChatCompletionInputToolType": {
|
|
195
|
+
"oneOf": [
|
|
196
|
+
{
|
|
197
|
+
"type": "object",
|
|
198
|
+
"required": ["FunctionName"],
|
|
199
|
+
"properties": {
|
|
200
|
+
"FunctionName": {
|
|
201
|
+
"type": "string"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"type": "string",
|
|
207
|
+
"enum": ["OneOf"]
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"title": "ChatCompletionInputToolType"
|
|
211
|
+
},
|
|
212
|
+
"ChatCompletionInputTool": {
|
|
213
|
+
"type": "object",
|
|
214
|
+
"required": ["type", "function"],
|
|
215
|
+
"properties": {
|
|
216
|
+
"function": {
|
|
217
|
+
"$ref": "#/$defs/ChatCompletionInputFunctionDefinition"
|
|
218
|
+
},
|
|
219
|
+
"type": {
|
|
220
|
+
"type": "string",
|
|
221
|
+
"example": "function"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"title": "ChatCompletionInputTool"
|
|
61
225
|
}
|
|
62
226
|
}
|
|
63
227
|
}
|
|
@@ -1,58 +1,196 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$id": "/inference/schemas/chat-completion/output.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
4
|
-
"description": "
|
|
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", "object", "created", "model", "system_fingerprint", "choices", "usage"],
|
|
7
8
|
"properties": {
|
|
8
9
|
"choices": {
|
|
9
10
|
"type": "array",
|
|
10
|
-
"description": "A list of chat completion choices.",
|
|
11
|
-
"title": "ChatCompletionOutputChoice",
|
|
12
11
|
"items": {
|
|
13
|
-
"
|
|
14
|
-
"properties": {
|
|
15
|
-
"finish_reason": {
|
|
16
|
-
"$ref": "#/definitions/FinishReason",
|
|
17
|
-
"description": "The reason why the generation was stopped."
|
|
18
|
-
},
|
|
19
|
-
"index": {
|
|
20
|
-
"type": "integer",
|
|
21
|
-
"description": "The index of the choice in the list of choices."
|
|
22
|
-
},
|
|
23
|
-
"message": {
|
|
24
|
-
"type": "object",
|
|
25
|
-
"properties": {
|
|
26
|
-
"role": {
|
|
27
|
-
"$ref": "/inference/schemas/chat-completion/input.json#/definitions/Role"
|
|
28
|
-
},
|
|
29
|
-
"content": {
|
|
30
|
-
"type": "string",
|
|
31
|
-
"description": "The content of the chat completion message."
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"title": "ChatCompletionOutputChoiceMessage",
|
|
35
|
-
"required": ["content", "role"]
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"required": ["finish_reason", "index", "message"]
|
|
12
|
+
"$ref": "#/$defs/ChatCompletionOutputComplete"
|
|
39
13
|
}
|
|
40
14
|
},
|
|
41
15
|
"created": {
|
|
42
16
|
"type": "integer",
|
|
43
|
-
"
|
|
17
|
+
"format": "int64",
|
|
18
|
+
"example": "1706270835",
|
|
19
|
+
"minimum": 0
|
|
20
|
+
},
|
|
21
|
+
"id": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"model": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"example": "mistralai/Mistral-7B-Instruct-v0.2"
|
|
27
|
+
},
|
|
28
|
+
"object": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"system_fingerprint": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"usage": {
|
|
35
|
+
"$ref": "#/$defs/ChatCompletionOutputUsage"
|
|
44
36
|
}
|
|
45
37
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
38
|
+
"$defs": {
|
|
39
|
+
"ChatCompletionOutputComplete": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"required": ["index", "message", "finish_reason"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"finish_reason": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"index": {
|
|
47
|
+
"type": "integer",
|
|
48
|
+
"format": "int32",
|
|
49
|
+
"minimum": 0
|
|
50
|
+
},
|
|
51
|
+
"logprobs": {
|
|
52
|
+
"allOf": [
|
|
53
|
+
{
|
|
54
|
+
"$ref": "#/$defs/ChatCompletionOutputLogprobs"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"nullable": true
|
|
58
|
+
},
|
|
59
|
+
"message": {
|
|
60
|
+
"$ref": "#/$defs/ChatCompletionOutputMessage"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"title": "ChatCompletionOutputComplete"
|
|
64
|
+
},
|
|
65
|
+
"ChatCompletionOutputLogprobs": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"required": ["content"],
|
|
68
|
+
"properties": {
|
|
69
|
+
"content": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"items": {
|
|
72
|
+
"$ref": "#/$defs/ChatCompletionOutputLogprob"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"title": "ChatCompletionOutputLogprobs"
|
|
77
|
+
},
|
|
78
|
+
"ChatCompletionOutputLogprob": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"required": ["token", "logprob", "top_logprobs"],
|
|
81
|
+
"properties": {
|
|
82
|
+
"logprob": {
|
|
83
|
+
"type": "number",
|
|
84
|
+
"format": "float"
|
|
85
|
+
},
|
|
86
|
+
"token": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"top_logprobs": {
|
|
90
|
+
"type": "array",
|
|
91
|
+
"items": {
|
|
92
|
+
"$ref": "#/$defs/ChatCompletionOutputTopLogprob"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"title": "ChatCompletionOutputLogprob"
|
|
97
|
+
},
|
|
98
|
+
"ChatCompletionOutputTopLogprob": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"required": ["token", "logprob"],
|
|
101
|
+
"properties": {
|
|
102
|
+
"logprob": {
|
|
103
|
+
"type": "number",
|
|
104
|
+
"format": "float"
|
|
105
|
+
},
|
|
106
|
+
"token": {
|
|
107
|
+
"type": "string"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"title": "ChatCompletionOutputTopLogprob"
|
|
111
|
+
},
|
|
112
|
+
"ChatCompletionOutputMessage": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"required": ["role"],
|
|
115
|
+
"properties": {
|
|
116
|
+
"content": {
|
|
117
|
+
"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
|
|
125
|
+
},
|
|
126
|
+
"role": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"example": "user"
|
|
129
|
+
},
|
|
130
|
+
"tool_calls": {
|
|
131
|
+
"type": "array",
|
|
132
|
+
"items": {
|
|
133
|
+
"$ref": "#/$defs/ChatCompletionOutputToolCall"
|
|
134
|
+
},
|
|
135
|
+
"nullable": true
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"title": "ChatCompletionOutputMessage"
|
|
139
|
+
},
|
|
140
|
+
"ChatCompletionOutputToolCall": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"required": ["id", "type", "function"],
|
|
143
|
+
"properties": {
|
|
144
|
+
"function": {
|
|
145
|
+
"$ref": "#/$defs/ChatCompletionOutputFunctionDefinition"
|
|
146
|
+
},
|
|
147
|
+
"id": {
|
|
148
|
+
"type": "integer",
|
|
149
|
+
"format": "int32",
|
|
150
|
+
"minimum": 0
|
|
151
|
+
},
|
|
152
|
+
"type": {
|
|
153
|
+
"type": "string"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"title": "ChatCompletionOutputToolCall"
|
|
157
|
+
},
|
|
158
|
+
"ChatCompletionOutputFunctionDefinition": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"required": ["name", "arguments"],
|
|
161
|
+
"properties": {
|
|
162
|
+
"arguments": {},
|
|
163
|
+
"description": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"nullable": true
|
|
166
|
+
},
|
|
167
|
+
"name": {
|
|
168
|
+
"type": "string"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"title": "ChatCompletionOutputFunctionDefinition"
|
|
172
|
+
},
|
|
173
|
+
"ChatCompletionOutputUsage": {
|
|
174
|
+
"type": "object",
|
|
175
|
+
"required": ["prompt_tokens", "completion_tokens", "total_tokens"],
|
|
176
|
+
"properties": {
|
|
177
|
+
"completion_tokens": {
|
|
178
|
+
"type": "integer",
|
|
179
|
+
"format": "int32",
|
|
180
|
+
"minimum": 0
|
|
181
|
+
},
|
|
182
|
+
"prompt_tokens": {
|
|
183
|
+
"type": "integer",
|
|
184
|
+
"format": "int32",
|
|
185
|
+
"minimum": 0
|
|
186
|
+
},
|
|
187
|
+
"total_tokens": {
|
|
188
|
+
"type": "integer",
|
|
189
|
+
"format": "int32",
|
|
190
|
+
"minimum": 0
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"title": "ChatCompletionOutputUsage"
|
|
56
194
|
}
|
|
57
195
|
}
|
|
58
196
|
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "/inference/schemas/chat-completion/stream_output.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
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
|
+
"title": "ChatCompletionStreamOutput",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["id", "object", "created", "model", "system_fingerprint", "choices"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"choices": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": {
|
|
12
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputChoice"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"created": {
|
|
16
|
+
"type": "integer",
|
|
17
|
+
"format": "int64",
|
|
18
|
+
"example": "1706270978",
|
|
19
|
+
"minimum": 0
|
|
20
|
+
},
|
|
21
|
+
"id": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"model": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"example": "mistralai/Mistral-7B-Instruct-v0.2"
|
|
27
|
+
},
|
|
28
|
+
"object": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"system_fingerprint": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"$defs": {
|
|
36
|
+
"ChatCompletionStreamOutputChoice": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": ["index", "delta"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"delta": {
|
|
41
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputDelta"
|
|
42
|
+
},
|
|
43
|
+
"finish_reason": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"nullable": true
|
|
46
|
+
},
|
|
47
|
+
"index": {
|
|
48
|
+
"type": "integer",
|
|
49
|
+
"format": "int32",
|
|
50
|
+
"minimum": 0
|
|
51
|
+
},
|
|
52
|
+
"logprobs": {
|
|
53
|
+
"allOf": [
|
|
54
|
+
{
|
|
55
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputLogprobs"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"nullable": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"title": "ChatCompletionStreamOutputChoice"
|
|
62
|
+
},
|
|
63
|
+
"ChatCompletionStreamOutputDelta": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"required": ["role"],
|
|
66
|
+
"properties": {
|
|
67
|
+
"content": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"example": "What is Deep Learning?",
|
|
70
|
+
"nullable": true
|
|
71
|
+
},
|
|
72
|
+
"role": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"example": "user"
|
|
75
|
+
},
|
|
76
|
+
"tool_calls": {
|
|
77
|
+
"allOf": [
|
|
78
|
+
{
|
|
79
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputDeltaToolCall"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"nullable": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"title": "ChatCompletionStreamOutputDelta"
|
|
86
|
+
},
|
|
87
|
+
"ChatCompletionStreamOutputDeltaToolCall": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"required": ["index", "id", "type", "function"],
|
|
90
|
+
"properties": {
|
|
91
|
+
"function": {
|
|
92
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputFunction"
|
|
93
|
+
},
|
|
94
|
+
"id": {
|
|
95
|
+
"type": "string"
|
|
96
|
+
},
|
|
97
|
+
"index": {
|
|
98
|
+
"type": "integer",
|
|
99
|
+
"format": "int32",
|
|
100
|
+
"minimum": 0
|
|
101
|
+
},
|
|
102
|
+
"type": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"title": "ChatCompletionStreamOutputDeltaToolCall"
|
|
107
|
+
},
|
|
108
|
+
"ChatCompletionStreamOutputFunction": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"required": ["arguments"],
|
|
111
|
+
"properties": {
|
|
112
|
+
"arguments": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
},
|
|
115
|
+
"name": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"nullable": true
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"title": "ChatCompletionStreamOutputFunction"
|
|
121
|
+
},
|
|
122
|
+
"ChatCompletionStreamOutputLogprobs": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"required": ["content"],
|
|
125
|
+
"properties": {
|
|
126
|
+
"content": {
|
|
127
|
+
"type": "array",
|
|
128
|
+
"items": {
|
|
129
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputLogprob"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"title": "ChatCompletionStreamOutputLogprobs"
|
|
134
|
+
},
|
|
135
|
+
"ChatCompletionStreamOutputLogprob": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"required": ["token", "logprob", "top_logprobs"],
|
|
138
|
+
"properties": {
|
|
139
|
+
"logprob": {
|
|
140
|
+
"type": "number",
|
|
141
|
+
"format": "float"
|
|
142
|
+
},
|
|
143
|
+
"token": {
|
|
144
|
+
"type": "string"
|
|
145
|
+
},
|
|
146
|
+
"top_logprobs": {
|
|
147
|
+
"type": "array",
|
|
148
|
+
"items": {
|
|
149
|
+
"$ref": "#/$defs/ChatCompletionStreamOutputTopLogprob"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"title": "ChatCompletionStreamOutputLogprob"
|
|
154
|
+
},
|
|
155
|
+
"ChatCompletionStreamOutputTopLogprob": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"required": ["token", "logprob"],
|
|
158
|
+
"properties": {
|
|
159
|
+
"logprob": {
|
|
160
|
+
"type": "number",
|
|
161
|
+
"format": "float"
|
|
162
|
+
},
|
|
163
|
+
"token": {
|
|
164
|
+
"type": "string"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"title": "ChatCompletionStreamOutputTopLogprob"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|