Skip to content

Commit 8ad5507

Browse files
authored
Fix spec for summarization and translation outputs (#503)
Output key must be `summary_text` instead of `generated_text`. See https://huggingface.co/docs/api-inference/detailed_parameters#summarization-task. **EDIT:** same for `translation`. See https://huggingface.co/docs/api-inference/detailed_parameters#translation-task.
1 parent 825e080 commit 8ad5507

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

packages/tasks/src/tasks/summarization/inference.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,12 @@ export interface Text2TextGenerationParameters {
4545
export type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
4646

4747
/**
48-
* Outputs for Summarization inference
49-
*
50-
* Outputs of inference for the Text2text Generation task
48+
* Outputs of inference for the Summarization task
5149
*/
5250
export interface SummarizationOutput {
53-
generatedText: unknown;
5451
/**
55-
* The generated text.
52+
* The summarized text.
5653
*/
57-
generated_text?: string;
54+
summary_text: string;
5855
[property: string]: unknown;
5956
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
2-
"$ref": "/inference/schemas/text2text-generation/output.json",
32
"$id": "/inference/schemas/summarization/output.json",
43
"$schema": "http://json-schema.org/draft-06/schema#",
4+
"description": "Outputs of inference for the Summarization task",
55
"title": "SummarizationOutput",
6-
"description": "Outputs for Summarization inference"
6+
"type": "object",
7+
"properties": {
8+
"summary_text": {
9+
"type": "string",
10+
"description": "The summarized text."
11+
}
12+
},
13+
"required": ["summary_text"]
714
}

packages/tasks/src/tasks/translation/inference.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,12 @@ export interface Text2TextGenerationParameters {
4545
export type Text2TextGenerationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
4646

4747
/**
48-
* Outputs for Translation inference
49-
*
50-
* Outputs of inference for the Text2text Generation task
48+
* Outputs of inference for the Translation task
5149
*/
5250
export interface TranslationOutput {
53-
generatedText: unknown;
5451
/**
55-
* The generated text.
52+
* The translated text.
5653
*/
57-
generated_text?: string;
54+
translation_text: string;
5855
[property: string]: unknown;
5956
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
2-
"$ref": "/inference/schemas/text2text-generation/output.json",
32
"$id": "/inference/schemas/translation/output.json",
43
"$schema": "http://json-schema.org/draft-06/schema#",
4+
"description": "Outputs of inference for the Translation task",
55
"title": "TranslationOutput",
6-
"description": "Outputs for Translation inference"
6+
"type": "object",
7+
"properties": {
8+
"translation_text": {
9+
"type": "string",
10+
"description": "The translated text."
11+
}
12+
},
13+
"required": ["translation_text"]
714
}

0 commit comments

Comments
 (0)