@@ -109,9 +109,10 @@ export class Pipeline extends Callable {
109
109
/**
110
110
* Executes the task associated with the pipeline.
111
111
* @param {any } texts The input texts to be processed.
112
+ * @param {...any } unused Only used to fix Liskov Substitution Principle errors.
112
113
* @returns {Promise<any> } A promise that resolves to an array containing the inputs and outputs of the task.
113
114
*/
114
- async _call ( texts ) {
115
+ async _call ( texts , ... unused ) {
115
116
// Run tokenization
116
117
let model_inputs = this . tokenizer ( texts , {
117
118
padding : true ,
@@ -301,6 +302,16 @@ export class TokenClassificationPipeline extends Pipeline {
301
302
}
302
303
}
303
304
305
+ /**
306
+ * @typedef {object } QuestionAnsweringResult
307
+ * @property {string } answer - The answer.
308
+ * @property {number } score - The score.
309
+ */
310
+
311
+ /**
312
+ * @typedef {Promise<QuestionAnsweringResult|QuestionAnsweringResult[]> } QuestionAnsweringReturnType
313
+ */
314
+
304
315
/**
305
316
* Question Answering pipeline using any `ModelForQuestionAnswering`.
306
317
*
@@ -324,9 +335,9 @@ export class QuestionAnsweringPipeline extends Pipeline {
324
335
* @param {string|string[] } context The context(s) where the answer(s) can be found.
325
336
* @param {Object } options An optional object containing the following properties:
326
337
* @param {number } [options.topk=1] The number of top answer predictions to be returned.
327
- * @returns {Promise<any> } A promise that resolves to an array or object containing the predicted answers and scores.
338
+ * @returns {QuestionAnsweringReturnType } A promise that resolves to an array or object
339
+ * containing the predicted answers and scores.
328
340
*/
329
- // @ts -ignore
330
341
async _call ( question , context , {
331
342
topk = 1
332
343
} = { } ) {
@@ -760,7 +771,6 @@ export class ZeroShotClassificationPipeline extends Pipeline {
760
771
* candidate by doing a softmax of the entailment score vs. the contradiction score.
761
772
* @return {Promise<Object|Object[]> } The prediction(s), as a map (or list of maps) from label to score.
762
773
*/
763
- // @ts -ignore
764
774
async _call ( texts , candidate_labels , {
765
775
hypothesis_template = "This example is {}." ,
766
776
multi_label = false ,
@@ -1602,7 +1612,6 @@ export class ZeroShotImageClassificationPipeline extends Pipeline {
1602
1612
* @param {string } [options.hypothesis_template] The hypothesis template to use for zero-shot classification. Default: "This is a photo of {}".
1603
1613
* @returns {Promise<any> } An array of classifications for each input image or a single classification object if only one input image is provided.
1604
1614
*/
1605
- // @ts -ignore
1606
1615
async _call ( images , candidate_labels , {
1607
1616
hypothesis_template = "This is a photo of {}"
1608
1617
} = { } ) {
0 commit comments