Skip to content

Commit 499c9a7

Browse files
authored
Tweak inference-tei-import inputs (#1180)
Related to #1166 (and see #1178). In #1166, I've made possible to pass either a `string` or `string[]` as `feature-extraction` input. But since this schema is based on TEI via the `inference-tei-import` script, we also need to update it which this PR does. **Expectation:** exact same specs but this time we won't have a PR like https://github.com/huggingface/huggingface.js/pull/1178/files opened.
1 parent ac922ba commit 499c9a7

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

packages/tasks-gen/scripts/inference-tei-import.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ async function _extractAndAdapt(task: string, mainComponentName: string, type: "
6363
// but not Union[List[Union[List[int], int, str]], str]
6464
// data.delete(key);
6565
delete data[key];
66-
data["type"] = "string";
67-
data["description"] = "The text to embed.";
66+
data["title"] = "FeatureExtractionInputs";
67+
data["description"] = "The text or list of texts to embed.";
68+
data["oneOf"] = [{ type: "string" }, { type: "array", items: { type: "string" } }];
6869
} else if (key === "$ref" && typeof data[key] === "string") {
6970
// Verify reference exists
7071
const ref = (data[key] as string).split("/").pop() ?? "";

packages/tasks/src/tasks/feature-extraction/spec/input.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@
88
"properties": {
99
"inputs": {
1010
"title": "FeatureExtractionInputs",
11+
"description": "The text or list of texts to embed.",
1112
"oneOf": [
12-
{ "type": "string" },
13-
{ "type": "array", "items": { "type": "string" } }
14-
],
15-
"description": "The text or list of texts to embed."
13+
{
14+
"type": "string"
15+
},
16+
{
17+
"type": "array",
18+
"items": {
19+
"type": "string"
20+
}
21+
}
22+
]
1623
},
1724
"normalize": {
1825
"type": "boolean",

0 commit comments

Comments
 (0)