Skip to content

Commit

Permalink
Correclty type ASR output
Browse files Browse the repository at this point in the history
  • Loading branch information
SBrandeis committed Jan 26, 2024
1 parent 49a8151 commit e4f3d13
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/tasks/src/tasks/automatic-speech-recognition/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,27 @@ export interface GenerationParameters {
temperature?: number;
[property: string]: unknown;
}
export interface AutomaticSpeechRecognitionOutputChunk {
/**
* A chunk of text identified by the model
*/
text: string;
/**
* The start and end timestamps corresponding with the text
*/
timestamps: number[];
[property: string]: unknown;
}
export type AutomaticSpeechRecognitionOutput = AutomaticSpeechRecognitionOutputElement[];
/**
* Outputs of inference for the Automatic Speech Recognition task
*/
export interface AutomaticSpeechRecognitionOutputElement {
/**
* When returnTimestamps is enabled, chunks contains a list of audio chunks identified by
* the model.
*/
chunks?: AutomaticSpeechRecognitionOutputChunk[];
/**
* The recognized text.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@
"text": {
"type": "string",
"description": "The recognized text."
},
"chunks": {
"type": "array",
"description": "When returnTimestamps is enabled, chunks contains a list of audio chunks identified by the model.",
"items": {
"type": "object",
"title": "AutomaticSpeechRecognitionOutputChunk",
"properties": {
"text": { "type": "string", "description": "A chunk of text identified by the model" },
"timestamps": {
"type": "array",
"description": "The start and end timestamps corresponding with the text",
"items": { "type": "number" },
"minLength": 2,
"maxLength": 2
}
},
"required": ["text", "timestamps"]
}
}
},
"required": ["text"]
Expand Down

0 comments on commit e4f3d13

Please sign in to comment.