@huggingface/tasks 0.13.1-test → 0.13.1-test2
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/package.json +4 -2
- package/src/dataset-libraries.ts +89 -0
- package/src/default-widget-inputs.ts +718 -0
- package/src/gguf.ts +40 -0
- package/src/hardware.ts +482 -0
- package/src/index.ts +59 -0
- package/src/library-to-tasks.ts +76 -0
- package/src/local-apps.ts +412 -0
- package/src/model-data.ts +149 -0
- package/src/model-libraries-downloads.ts +18 -0
- package/src/model-libraries-snippets.ts +1128 -0
- package/src/model-libraries.ts +820 -0
- package/src/pipelines.ts +698 -0
- package/src/snippets/common.ts +39 -0
- package/src/snippets/curl.spec.ts +94 -0
- package/src/snippets/curl.ts +120 -0
- package/src/snippets/index.ts +7 -0
- package/src/snippets/inputs.ts +167 -0
- package/src/snippets/js.spec.ts +148 -0
- package/src/snippets/js.ts +305 -0
- package/src/snippets/python.spec.ts +144 -0
- package/src/snippets/python.ts +321 -0
- package/src/snippets/types.ts +16 -0
- package/src/tasks/audio-classification/about.md +86 -0
- package/src/tasks/audio-classification/data.ts +81 -0
- package/src/tasks/audio-classification/inference.ts +52 -0
- package/src/tasks/audio-classification/spec/input.json +35 -0
- package/src/tasks/audio-classification/spec/output.json +11 -0
- package/src/tasks/audio-to-audio/about.md +56 -0
- package/src/tasks/audio-to-audio/data.ts +70 -0
- package/src/tasks/automatic-speech-recognition/about.md +90 -0
- package/src/tasks/automatic-speech-recognition/data.ts +82 -0
- package/src/tasks/automatic-speech-recognition/inference.ts +160 -0
- package/src/tasks/automatic-speech-recognition/spec/input.json +35 -0
- package/src/tasks/automatic-speech-recognition/spec/output.json +38 -0
- package/src/tasks/chat-completion/inference.ts +322 -0
- package/src/tasks/chat-completion/spec/input.json +350 -0
- package/src/tasks/chat-completion/spec/output.json +206 -0
- package/src/tasks/chat-completion/spec/stream_output.json +213 -0
- package/src/tasks/common-definitions.json +100 -0
- package/src/tasks/depth-estimation/about.md +45 -0
- package/src/tasks/depth-estimation/data.ts +70 -0
- package/src/tasks/depth-estimation/inference.ts +35 -0
- package/src/tasks/depth-estimation/spec/input.json +25 -0
- package/src/tasks/depth-estimation/spec/output.json +16 -0
- package/src/tasks/document-question-answering/about.md +53 -0
- package/src/tasks/document-question-answering/data.ts +85 -0
- package/src/tasks/document-question-answering/inference.ts +110 -0
- package/src/tasks/document-question-answering/spec/input.json +85 -0
- package/src/tasks/document-question-answering/spec/output.json +36 -0
- package/src/tasks/feature-extraction/about.md +72 -0
- package/src/tasks/feature-extraction/data.ts +57 -0
- package/src/tasks/feature-extraction/inference.ts +40 -0
- package/src/tasks/feature-extraction/spec/input.json +47 -0
- package/src/tasks/feature-extraction/spec/output.json +15 -0
- package/src/tasks/fill-mask/about.md +51 -0
- package/src/tasks/fill-mask/data.ts +79 -0
- package/src/tasks/fill-mask/inference.ts +62 -0
- package/src/tasks/fill-mask/spec/input.json +38 -0
- package/src/tasks/fill-mask/spec/output.json +29 -0
- package/src/tasks/image-classification/about.md +50 -0
- package/src/tasks/image-classification/data.ts +88 -0
- package/src/tasks/image-classification/inference.ts +52 -0
- package/src/tasks/image-classification/spec/input.json +35 -0
- package/src/tasks/image-classification/spec/output.json +11 -0
- package/src/tasks/image-feature-extraction/about.md +23 -0
- package/src/tasks/image-feature-extraction/data.ts +59 -0
- package/src/tasks/image-segmentation/about.md +63 -0
- package/src/tasks/image-segmentation/data.ts +99 -0
- package/src/tasks/image-segmentation/inference.ts +69 -0
- package/src/tasks/image-segmentation/spec/input.json +45 -0
- package/src/tasks/image-segmentation/spec/output.json +26 -0
- package/src/tasks/image-text-to-text/about.md +76 -0
- package/src/tasks/image-text-to-text/data.ts +102 -0
- package/src/tasks/image-to-3d/about.md +62 -0
- package/src/tasks/image-to-3d/data.ts +75 -0
- package/src/tasks/image-to-image/about.md +129 -0
- package/src/tasks/image-to-image/data.ts +101 -0
- package/src/tasks/image-to-image/inference.ts +68 -0
- package/src/tasks/image-to-image/spec/input.json +55 -0
- package/src/tasks/image-to-image/spec/output.json +12 -0
- package/src/tasks/image-to-text/about.md +61 -0
- package/src/tasks/image-to-text/data.ts +82 -0
- package/src/tasks/image-to-text/inference.ts +143 -0
- package/src/tasks/image-to-text/spec/input.json +34 -0
- package/src/tasks/image-to-text/spec/output.json +14 -0
- package/src/tasks/index.ts +312 -0
- package/src/tasks/keypoint-detection/about.md +57 -0
- package/src/tasks/keypoint-detection/data.ts +50 -0
- package/src/tasks/mask-generation/about.md +65 -0
- package/src/tasks/mask-generation/data.ts +55 -0
- package/src/tasks/object-detection/about.md +37 -0
- package/src/tasks/object-detection/data.ts +86 -0
- package/src/tasks/object-detection/inference.ts +75 -0
- package/src/tasks/object-detection/spec/input.json +31 -0
- package/src/tasks/object-detection/spec/output.json +50 -0
- package/src/tasks/placeholder/about.md +15 -0
- package/src/tasks/placeholder/data.ts +21 -0
- package/src/tasks/placeholder/spec/input.json +35 -0
- package/src/tasks/placeholder/spec/output.json +17 -0
- package/src/tasks/question-answering/about.md +56 -0
- package/src/tasks/question-answering/data.ts +75 -0
- package/src/tasks/question-answering/inference.ts +99 -0
- package/src/tasks/question-answering/spec/input.json +67 -0
- package/src/tasks/question-answering/spec/output.json +29 -0
- package/src/tasks/reinforcement-learning/about.md +167 -0
- package/src/tasks/reinforcement-learning/data.ts +75 -0
- package/src/tasks/sentence-similarity/about.md +97 -0
- package/src/tasks/sentence-similarity/data.ts +101 -0
- package/src/tasks/sentence-similarity/inference.ts +32 -0
- package/src/tasks/sentence-similarity/spec/input.json +40 -0
- package/src/tasks/sentence-similarity/spec/output.json +12 -0
- package/src/tasks/summarization/about.md +58 -0
- package/src/tasks/summarization/data.ts +76 -0
- package/src/tasks/summarization/inference.ts +57 -0
- package/src/tasks/summarization/spec/input.json +42 -0
- package/src/tasks/summarization/spec/output.json +14 -0
- package/src/tasks/table-question-answering/about.md +43 -0
- package/src/tasks/table-question-answering/data.ts +59 -0
- package/src/tasks/table-question-answering/inference.ts +61 -0
- package/src/tasks/table-question-answering/spec/input.json +44 -0
- package/src/tasks/table-question-answering/spec/output.json +40 -0
- package/src/tasks/tabular-classification/about.md +65 -0
- package/src/tasks/tabular-classification/data.ts +68 -0
- package/src/tasks/tabular-regression/about.md +87 -0
- package/src/tasks/tabular-regression/data.ts +57 -0
- package/src/tasks/text-classification/about.md +173 -0
- package/src/tasks/text-classification/data.ts +103 -0
- package/src/tasks/text-classification/inference.ts +51 -0
- package/src/tasks/text-classification/spec/input.json +35 -0
- package/src/tasks/text-classification/spec/output.json +11 -0
- package/src/tasks/text-generation/about.md +154 -0
- package/src/tasks/text-generation/data.ts +114 -0
- package/src/tasks/text-generation/inference.ts +200 -0
- package/src/tasks/text-generation/spec/input.json +219 -0
- package/src/tasks/text-generation/spec/output.json +179 -0
- package/src/tasks/text-generation/spec/stream_output.json +103 -0
- package/src/tasks/text-to-3d/about.md +62 -0
- package/src/tasks/text-to-3d/data.ts +56 -0
- package/src/tasks/text-to-audio/inference.ts +143 -0
- package/src/tasks/text-to-audio/spec/input.json +31 -0
- package/src/tasks/text-to-audio/spec/output.json +17 -0
- package/src/tasks/text-to-image/about.md +96 -0
- package/src/tasks/text-to-image/data.ts +100 -0
- package/src/tasks/text-to-image/inference.ts +75 -0
- package/src/tasks/text-to-image/spec/input.json +63 -0
- package/src/tasks/text-to-image/spec/output.json +13 -0
- package/src/tasks/text-to-speech/about.md +63 -0
- package/src/tasks/text-to-speech/data.ts +79 -0
- package/src/tasks/text-to-speech/inference.ts +145 -0
- package/src/tasks/text-to-speech/spec/input.json +31 -0
- package/src/tasks/text-to-speech/spec/output.json +7 -0
- package/src/tasks/text-to-video/about.md +41 -0
- package/src/tasks/text-to-video/data.ts +102 -0
- package/src/tasks/text2text-generation/inference.ts +55 -0
- package/src/tasks/text2text-generation/spec/input.json +55 -0
- package/src/tasks/text2text-generation/spec/output.json +14 -0
- package/src/tasks/token-classification/about.md +76 -0
- package/src/tasks/token-classification/data.ts +92 -0
- package/src/tasks/token-classification/inference.ts +85 -0
- package/src/tasks/token-classification/spec/input.json +65 -0
- package/src/tasks/token-classification/spec/output.json +37 -0
- package/src/tasks/translation/about.md +65 -0
- package/src/tasks/translation/data.ts +70 -0
- package/src/tasks/translation/inference.ts +67 -0
- package/src/tasks/translation/spec/input.json +50 -0
- package/src/tasks/translation/spec/output.json +14 -0
- package/src/tasks/unconditional-image-generation/about.md +50 -0
- package/src/tasks/unconditional-image-generation/data.ts +72 -0
- package/src/tasks/video-classification/about.md +37 -0
- package/src/tasks/video-classification/data.ts +84 -0
- package/src/tasks/video-classification/inference.ts +59 -0
- package/src/tasks/video-classification/spec/input.json +42 -0
- package/src/tasks/video-classification/spec/output.json +10 -0
- package/src/tasks/video-text-to-text/about.md +98 -0
- package/src/tasks/video-text-to-text/data.ts +66 -0
- package/src/tasks/visual-question-answering/about.md +48 -0
- package/src/tasks/visual-question-answering/data.ts +97 -0
- package/src/tasks/visual-question-answering/inference.ts +62 -0
- package/src/tasks/visual-question-answering/spec/input.json +41 -0
- package/src/tasks/visual-question-answering/spec/output.json +21 -0
- package/src/tasks/zero-shot-classification/about.md +40 -0
- package/src/tasks/zero-shot-classification/data.ts +70 -0
- package/src/tasks/zero-shot-classification/inference.ts +67 -0
- package/src/tasks/zero-shot-classification/spec/input.json +50 -0
- package/src/tasks/zero-shot-classification/spec/output.json +11 -0
- package/src/tasks/zero-shot-image-classification/about.md +75 -0
- package/src/tasks/zero-shot-image-classification/data.ts +84 -0
- package/src/tasks/zero-shot-image-classification/inference.ts +61 -0
- package/src/tasks/zero-shot-image-classification/spec/input.json +45 -0
- package/src/tasks/zero-shot-image-classification/spec/output.json +10 -0
- package/src/tasks/zero-shot-object-detection/about.md +45 -0
- package/src/tasks/zero-shot-object-detection/data.ts +67 -0
- package/src/tasks/zero-shot-object-detection/inference.ts +66 -0
- package/src/tasks/zero-shot-object-detection/spec/input.json +40 -0
- package/src/tasks/zero-shot-object-detection/spec/output.json +47 -0
- package/src/tokenizer-data.ts +32 -0
- package/src/widget-example.ts +125 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
3
|
+
*
|
|
4
|
+
* Using src/scripts/inference-codegen
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Inputs for Zero Shot Object Detection inference
|
|
8
|
+
*/
|
|
9
|
+
export interface ZeroShotObjectDetectionInput {
|
|
10
|
+
/**
|
|
11
|
+
* The input image data, with candidate labels
|
|
12
|
+
*/
|
|
13
|
+
inputs: ZeroShotObjectDetectionInputData;
|
|
14
|
+
/**
|
|
15
|
+
* Additional inference parameters
|
|
16
|
+
*/
|
|
17
|
+
parameters?: {
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
};
|
|
20
|
+
[property: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The input image data, with candidate labels
|
|
24
|
+
*/
|
|
25
|
+
export interface ZeroShotObjectDetectionInputData {
|
|
26
|
+
/**
|
|
27
|
+
* The candidate labels for this image
|
|
28
|
+
*/
|
|
29
|
+
candidateLabels: string[];
|
|
30
|
+
/**
|
|
31
|
+
* The image data to generate bounding boxes from
|
|
32
|
+
*/
|
|
33
|
+
image: unknown;
|
|
34
|
+
[property: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The predicted bounding box. Coordinates are relative to the top left corner of the input
|
|
38
|
+
* image.
|
|
39
|
+
*/
|
|
40
|
+
export interface BoundingBox {
|
|
41
|
+
xmax: number;
|
|
42
|
+
xmin: number;
|
|
43
|
+
ymax: number;
|
|
44
|
+
ymin: number;
|
|
45
|
+
[property: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
export type ZeroShotObjectDetectionOutput = ZeroShotObjectDetectionOutputElement[];
|
|
48
|
+
/**
|
|
49
|
+
* Outputs of inference for the Zero Shot Object Detection task
|
|
50
|
+
*/
|
|
51
|
+
export interface ZeroShotObjectDetectionOutputElement {
|
|
52
|
+
/**
|
|
53
|
+
* The predicted bounding box. Coordinates are relative to the top left corner of the input
|
|
54
|
+
* image.
|
|
55
|
+
*/
|
|
56
|
+
box: BoundingBox;
|
|
57
|
+
/**
|
|
58
|
+
* A candidate label
|
|
59
|
+
*/
|
|
60
|
+
label: string;
|
|
61
|
+
/**
|
|
62
|
+
* The associated score / probability
|
|
63
|
+
*/
|
|
64
|
+
score: number;
|
|
65
|
+
[property: string]: unknown;
|
|
66
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "/inference/schemas/zero-shot-object-detection/input.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
4
|
+
"description": "Inputs for Zero Shot Object Detection inference",
|
|
5
|
+
"title": "ZeroShotObjectDetectionInput",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"inputs": {
|
|
9
|
+
"description": "The input image data, with candidate labels",
|
|
10
|
+
"type": "object",
|
|
11
|
+
"title": "ZeroShotObjectDetectionInputData",
|
|
12
|
+
"properties": {
|
|
13
|
+
"image": {
|
|
14
|
+
"description": "The image data to generate bounding boxes from"
|
|
15
|
+
},
|
|
16
|
+
"candidateLabels": {
|
|
17
|
+
"description": "The candidate labels for this image",
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": ["image", "candidateLabels"]
|
|
25
|
+
},
|
|
26
|
+
"parameters": {
|
|
27
|
+
"description": "Additional inference parameters",
|
|
28
|
+
"$ref": "#/$defs/ZeroShotObjectDetectionParameters"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"$defs": {
|
|
32
|
+
"ZeroShotObjectDetectionParameters": {
|
|
33
|
+
"title": "ZeroShotObjectDetectionParameters",
|
|
34
|
+
"description": "Additional inference parameters for Zero Shot Object Detection",
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"required": ["inputs"]
|
|
40
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "/inference/schemas/zero-shot-object-detection/output.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
4
|
+
"description": "Outputs of inference for the Zero Shot Object Detection task",
|
|
5
|
+
"title": "ZeroShotObjectDetectionOutput",
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"title": "ZeroShotObjectDetectionOutputElement",
|
|
10
|
+
"properties": {
|
|
11
|
+
"label": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "A candidate label"
|
|
14
|
+
},
|
|
15
|
+
"score": {
|
|
16
|
+
"type": "number",
|
|
17
|
+
"description": "The associated score / probability"
|
|
18
|
+
},
|
|
19
|
+
"box": {
|
|
20
|
+
"$ref": "#/$defs/BoundingBox",
|
|
21
|
+
"description": "The predicted bounding box. Coordinates are relative to the top left corner of the input image."
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": ["box", "label", "score"]
|
|
25
|
+
},
|
|
26
|
+
"$defs": {
|
|
27
|
+
"BoundingBox": {
|
|
28
|
+
"title": "BoundingBox",
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"xmin": {
|
|
32
|
+
"type": "integer"
|
|
33
|
+
},
|
|
34
|
+
"xmax": {
|
|
35
|
+
"type": "integer"
|
|
36
|
+
},
|
|
37
|
+
"ymin": {
|
|
38
|
+
"type": "integer"
|
|
39
|
+
},
|
|
40
|
+
"ymax": {
|
|
41
|
+
"type": "integer"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": ["xmin", "xmax", "ymin", "ymax"]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const SPECIAL_TOKENS_ATTRIBUTES = [
|
|
2
|
+
"bos_token",
|
|
3
|
+
"eos_token",
|
|
4
|
+
"unk_token",
|
|
5
|
+
"sep_token",
|
|
6
|
+
"pad_token",
|
|
7
|
+
"cls_token",
|
|
8
|
+
"mask_token",
|
|
9
|
+
// additional_special_tokens (TODO)
|
|
10
|
+
] as const;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Public interface for a tokenizer's special tokens mapping
|
|
14
|
+
*/
|
|
15
|
+
export interface AddedToken {
|
|
16
|
+
__type: "AddedToken";
|
|
17
|
+
content?: string;
|
|
18
|
+
lstrip?: boolean;
|
|
19
|
+
normalized?: boolean;
|
|
20
|
+
rstrip?: boolean;
|
|
21
|
+
single_word?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type SpecialTokensMap = {
|
|
24
|
+
[key in (typeof SPECIAL_TOKENS_ATTRIBUTES)[number]]?: string | AddedToken | null;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Public interface for tokenizer config
|
|
28
|
+
*/
|
|
29
|
+
export interface TokenizerConfig extends SpecialTokensMap {
|
|
30
|
+
use_default_system_prompt?: boolean;
|
|
31
|
+
chat_template?: string | Array<{ name: string; template: string }>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* See default-widget-inputs.ts for the default widget inputs, this files only contains the types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ChatCompletionInputMessage } from "./tasks/index.js";
|
|
6
|
+
|
|
7
|
+
type TableData = Record<string, (string | number)[]>;
|
|
8
|
+
|
|
9
|
+
//#region outputs
|
|
10
|
+
export type WidgetExampleOutputLabels = Array<{ label: string; score: number }>;
|
|
11
|
+
export interface WidgetExampleOutputAnswerScore {
|
|
12
|
+
answer: string;
|
|
13
|
+
score: number;
|
|
14
|
+
}
|
|
15
|
+
export interface WidgetExampleOutputText {
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WidgetExampleOutputUrl {
|
|
19
|
+
url: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type WidgetExampleOutput =
|
|
23
|
+
| WidgetExampleOutputLabels
|
|
24
|
+
| WidgetExampleOutputAnswerScore
|
|
25
|
+
| WidgetExampleOutputText
|
|
26
|
+
| WidgetExampleOutputUrl;
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
export interface WidgetExampleBase<TOutput> {
|
|
30
|
+
example_title?: string;
|
|
31
|
+
group?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Potential overrides to API parameters for this specific example
|
|
34
|
+
* (takes precedences over the model card metadata's inference.parameters)
|
|
35
|
+
*/
|
|
36
|
+
parameters?: {
|
|
37
|
+
/// token-classification
|
|
38
|
+
aggregation_strategy?: string;
|
|
39
|
+
/// text-generation
|
|
40
|
+
top_k?: number;
|
|
41
|
+
top_p?: number;
|
|
42
|
+
temperature?: number;
|
|
43
|
+
max_new_tokens?: number;
|
|
44
|
+
do_sample?: boolean;
|
|
45
|
+
/// text-to-image
|
|
46
|
+
negative_prompt?: string;
|
|
47
|
+
guidance_scale?: number;
|
|
48
|
+
num_inference_steps?: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Optional output
|
|
52
|
+
*/
|
|
53
|
+
output?: TOutput;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface WidgetExampleChatInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
|
|
57
|
+
messages: ChatCompletionInputMessage[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface WidgetExampleTextInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
|
|
61
|
+
text: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface WidgetExampleTextAndContextInput<TOutput = WidgetExampleOutput>
|
|
65
|
+
extends WidgetExampleTextInput<TOutput> {
|
|
66
|
+
context: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface WidgetExampleTextAndTableInput<TOutput = WidgetExampleOutput> extends WidgetExampleTextInput<TOutput> {
|
|
70
|
+
table: TableData;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface WidgetExampleAssetInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
|
|
74
|
+
src: string;
|
|
75
|
+
}
|
|
76
|
+
export interface WidgetExampleAssetAndPromptInput<TOutput = WidgetExampleOutput>
|
|
77
|
+
extends WidgetExampleAssetInput<TOutput> {
|
|
78
|
+
prompt: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type WidgetExampleAssetAndTextInput<TOutput = WidgetExampleOutput> = WidgetExampleAssetInput<TOutput> &
|
|
82
|
+
WidgetExampleTextInput<TOutput>;
|
|
83
|
+
|
|
84
|
+
export type WidgetExampleAssetAndZeroShotInput<TOutput = WidgetExampleOutput> = WidgetExampleAssetInput<TOutput> &
|
|
85
|
+
WidgetExampleZeroShotTextInput<TOutput>;
|
|
86
|
+
|
|
87
|
+
export interface WidgetExampleStructuredDataInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
|
|
88
|
+
structured_data: TableData;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface WidgetExampleTableDataInput<TOutput = WidgetExampleOutput> extends WidgetExampleBase<TOutput> {
|
|
92
|
+
table: TableData;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface WidgetExampleZeroShotTextInput<TOutput = WidgetExampleOutput> extends WidgetExampleTextInput<TOutput> {
|
|
96
|
+
text: string;
|
|
97
|
+
candidate_labels: string;
|
|
98
|
+
multi_class: boolean;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface WidgetExampleSentenceSimilarityInput<TOutput = WidgetExampleOutput>
|
|
102
|
+
extends WidgetExampleBase<TOutput> {
|
|
103
|
+
source_sentence: string;
|
|
104
|
+
sentences: string[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
|
|
109
|
+
export type WidgetExample<TOutput = WidgetExampleOutput> =
|
|
110
|
+
| WidgetExampleChatInput<TOutput>
|
|
111
|
+
| WidgetExampleTextInput<TOutput>
|
|
112
|
+
| WidgetExampleTextAndContextInput<TOutput>
|
|
113
|
+
| WidgetExampleTextAndTableInput<TOutput>
|
|
114
|
+
| WidgetExampleAssetInput<TOutput>
|
|
115
|
+
| WidgetExampleAssetAndPromptInput<TOutput>
|
|
116
|
+
| WidgetExampleAssetAndTextInput<TOutput>
|
|
117
|
+
| WidgetExampleAssetAndZeroShotInput<TOutput>
|
|
118
|
+
| WidgetExampleStructuredDataInput<TOutput>
|
|
119
|
+
| WidgetExampleTableDataInput<TOutput>
|
|
120
|
+
| WidgetExampleZeroShotTextInput<TOutput>
|
|
121
|
+
| WidgetExampleSentenceSimilarityInput<TOutput>;
|
|
122
|
+
|
|
123
|
+
type KeysOfUnion<T> = T extends unknown ? keyof T : never;
|
|
124
|
+
|
|
125
|
+
export type WidgetExampleAttribute = KeysOfUnion<WidgetExample>;
|