Skip to content

Commit e6332ab

Browse files
authored
featureExtraction should use FeatureExtractionInput (#1235)
Read the comment https://github.com/huggingface/huggingface.js/pull/1235/files#r1973270449
1 parent 11e07c0 commit e6332ab

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

packages/inference/src/tasks/nlp/featureExtraction.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1+
import type { FeatureExtractionInput } from "@huggingface/tasks";
12
import { InferenceOutputError } from "../../lib/InferenceOutputError";
23
import type { BaseArgs, Options } from "../../types";
34
import { request } from "../custom/request";
45

5-
export type FeatureExtractionArgs = BaseArgs & {
6-
/**
7-
* The inputs is a string or a list of strings to get the features from.
8-
*
9-
* inputs: "That is a happy person",
10-
*
11-
*/
12-
inputs: string | string[];
13-
};
6+
export type FeatureExtractionArgs = BaseArgs & FeatureExtractionInput;
147

158
/**
169
* Returned values are a multidimensional array of floats (dimension depending on if you sent a string or a list of string, and if the automatic reduction, usually mean_pooling for instance was applied for you or not. This should be explained on the model's README).

packages/inference/src/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ChatCompletionInput, PipelineType } from "@huggingface/tasks";
1+
import type { ChatCompletionInput, FeatureExtractionInput, PipelineType } from "@huggingface/tasks";
22

33
/**
44
* HF model id, like "meta-llama/Llama-3.3-70B-Instruct"
@@ -86,6 +86,7 @@ export type RequestArgs = BaseArgs &
8686
| { text: string }
8787
| { audio_url: string }
8888
| ChatCompletionInput
89+
| FeatureExtractionInput
8990
) & {
9091
parameters?: Record<string, unknown>;
9192
};

0 commit comments

Comments
 (0)