@huggingface/inference 3.5.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.cjs +1652 -0
- package/dist/browser/index.js +1652 -0
- package/dist/index.cjs +277 -971
- package/dist/index.js +268 -982
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/lib/makeRequestOptions.d.ts +16 -1
- package/dist/src/lib/makeRequestOptions.d.ts.map +1 -1
- package/dist/src/providers/novita.d.ts.map +1 -1
- package/dist/src/snippets/getInferenceSnippets.d.ts +4 -0
- package/dist/src/snippets/getInferenceSnippets.d.ts.map +1 -0
- package/dist/src/snippets/index.d.ts +1 -4
- package/dist/src/snippets/index.d.ts.map +1 -1
- package/dist/src/tasks/cv/textToVideo.d.ts.map +1 -1
- package/package.json +15 -6
- package/src/index.ts +1 -1
- package/src/lib/makeRequestOptions.ts +37 -10
- package/src/providers/fireworks-ai.ts +1 -1
- package/src/providers/hf-inference.ts +1 -1
- package/src/providers/nebius.ts +3 -3
- package/src/providers/novita.ts +7 -6
- package/src/providers/sambanova.ts +1 -1
- package/src/providers/together.ts +3 -3
- package/src/snippets/getInferenceSnippets.ts +398 -0
- package/src/snippets/index.ts +1 -5
- package/src/snippets/templates/js/fetch/basic.jinja +19 -0
- package/src/snippets/templates/js/fetch/basicAudio.jinja +19 -0
- package/src/snippets/templates/js/fetch/basicImage.jinja +19 -0
- package/src/snippets/templates/js/fetch/textToAudio.jinja +41 -0
- package/src/snippets/templates/js/fetch/textToImage.jinja +19 -0
- package/src/snippets/templates/js/fetch/zeroShotClassification.jinja +22 -0
- package/src/snippets/templates/js/huggingface.js/basic.jinja +11 -0
- package/src/snippets/templates/js/huggingface.js/basicAudio.jinja +13 -0
- package/src/snippets/templates/js/huggingface.js/basicImage.jinja +13 -0
- package/src/snippets/templates/js/huggingface.js/conversational.jinja +11 -0
- package/src/snippets/templates/js/huggingface.js/conversationalStream.jinja +19 -0
- package/src/snippets/templates/js/huggingface.js/textToImage.jinja +11 -0
- package/src/snippets/templates/js/huggingface.js/textToVideo.jinja +10 -0
- package/src/snippets/templates/js/openai/conversational.jinja +13 -0
- package/src/snippets/templates/js/openai/conversationalStream.jinja +22 -0
- package/src/snippets/templates/python/fal_client/textToImage.jinja +11 -0
- package/src/snippets/templates/python/huggingface_hub/basic.jinja +4 -0
- package/src/snippets/templates/python/huggingface_hub/basicAudio.jinja +1 -0
- package/src/snippets/templates/python/huggingface_hub/basicImage.jinja +1 -0
- package/src/snippets/templates/python/huggingface_hub/conversational.jinja +6 -0
- package/src/snippets/templates/python/huggingface_hub/conversationalStream.jinja +8 -0
- package/src/snippets/templates/python/huggingface_hub/documentQuestionAnswering.jinja +5 -0
- package/src/snippets/templates/python/huggingface_hub/imageToImage.jinja +6 -0
- package/src/snippets/templates/python/huggingface_hub/importInferenceClient.jinja +6 -0
- package/src/snippets/templates/python/huggingface_hub/textToImage.jinja +5 -0
- package/src/snippets/templates/python/huggingface_hub/textToVideo.jinja +4 -0
- package/src/snippets/templates/python/openai/conversational.jinja +13 -0
- package/src/snippets/templates/python/openai/conversationalStream.jinja +15 -0
- package/src/snippets/templates/python/requests/basic.jinja +7 -0
- package/src/snippets/templates/python/requests/basicAudio.jinja +7 -0
- package/src/snippets/templates/python/requests/basicImage.jinja +7 -0
- package/src/snippets/templates/python/requests/conversational.jinja +9 -0
- package/src/snippets/templates/python/requests/conversationalStream.jinja +16 -0
- package/src/snippets/templates/python/requests/documentQuestionAnswering.jinja +13 -0
- package/src/snippets/templates/python/requests/imageToImage.jinja +15 -0
- package/src/snippets/templates/python/requests/importRequests.jinja +10 -0
- package/src/snippets/templates/python/requests/tabular.jinja +9 -0
- package/src/snippets/templates/python/requests/textToAudio.jinja +23 -0
- package/src/snippets/templates/python/requests/textToImage.jinja +14 -0
- package/src/snippets/templates/python/requests/zeroShotClassification.jinja +8 -0
- package/src/snippets/templates/python/requests/zeroShotImageClassification.jinja +14 -0
- package/src/snippets/templates/sh/curl/basic.jinja +7 -0
- package/src/snippets/templates/sh/curl/basicAudio.jinja +5 -0
- package/src/snippets/templates/sh/curl/basicImage.jinja +5 -0
- package/src/snippets/templates/sh/curl/conversational.jinja +7 -0
- package/src/snippets/templates/sh/curl/conversationalStream.jinja +7 -0
- package/src/snippets/templates/sh/curl/zeroShotClassification.jinja +5 -0
- package/src/tasks/cv/textToVideo.ts +25 -5
- package/src/vendor/fetch-event-source/LICENSE +21 -0
- package/dist/src/snippets/curl.d.ts +0 -17
- package/dist/src/snippets/curl.d.ts.map +0 -1
- package/dist/src/snippets/js.d.ts +0 -21
- package/dist/src/snippets/js.d.ts.map +0 -1
- package/dist/src/snippets/python.d.ts +0 -4
- package/dist/src/snippets/python.d.ts.map +0 -1
- package/src/snippets/curl.ts +0 -177
- package/src/snippets/js.ts +0 -475
- package/src/snippets/python.ts +0 -563
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OpenAI } from "openai";
|
|
2
|
+
|
|
3
|
+
const client = new OpenAI({
|
|
4
|
+
baseURL: "{{ baseUrl }}",
|
|
5
|
+
apiKey: "{{ accessToken }}",
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
let out = "";
|
|
9
|
+
|
|
10
|
+
const stream = await client.chat.completions.create({
|
|
11
|
+
provider: "{{ provider }}",
|
|
12
|
+
model: "{{ model.id }}",
|
|
13
|
+
{{ inputs.asTsString }}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
for await (const chunk of stream) {
|
|
17
|
+
if (chunk.choices && chunk.choices.length > 0) {
|
|
18
|
+
const newContent = chunk.choices[0].delta.content;
|
|
19
|
+
out += newContent;
|
|
20
|
+
console.log(newContent);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
output = client.{{ methodName }}({{ inputs.asObj.inputs }}, model="{{ model.id }}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
output = client.{{ methodName }}({{ inputs.asObj.inputs }}, model="{{ model.id }}")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from openai import OpenAI
|
|
2
|
+
|
|
3
|
+
client = OpenAI(
|
|
4
|
+
base_url="{{ baseUrl }}",
|
|
5
|
+
api_key="{{ accessToken }}"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
completion = client.chat.completions.create(
|
|
9
|
+
model="{{ providerModelId }}",
|
|
10
|
+
{{ inputs.asPythonString }}
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
print(completion.choices[0].message)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from openai import OpenAI
|
|
2
|
+
|
|
3
|
+
client = OpenAI(
|
|
4
|
+
base_url="{{ baseUrl }}",
|
|
5
|
+
api_key="{{ accessToken }}"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
stream = client.chat.completions.create(
|
|
9
|
+
model="{{ providerModelId }}",
|
|
10
|
+
{{ inputs.asPythonString }}
|
|
11
|
+
stream=True,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
for chunk in stream:
|
|
15
|
+
print(chunk.choices[0].delta.content, end="")
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
def query(payload):
|
|
2
|
+
response = requests.post(API_URL, headers=headers, json=payload, stream=True)
|
|
3
|
+
for line in response.iter_lines():
|
|
4
|
+
if not line.startswith(b"data:"):
|
|
5
|
+
continue
|
|
6
|
+
if line.strip() == b"data: [DONE]":
|
|
7
|
+
return
|
|
8
|
+
yield json.loads(line.decode("utf-8").lstrip("data:").rstrip("/n"))
|
|
9
|
+
|
|
10
|
+
chunks = query({
|
|
11
|
+
{{ providerInputs.asJsonString }},
|
|
12
|
+
"stream": True,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
for chunk in chunks:
|
|
16
|
+
print(chunk["choices"][0]["delta"]["content"], end="")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
def query(payload):
|
|
2
|
+
with open(payload["image"], "rb") as f:
|
|
3
|
+
img = f.read()
|
|
4
|
+
payload["image"] = base64.b64encode(img).decode("utf-8")
|
|
5
|
+
response = requests.post(API_URL, headers=headers, json=payload)
|
|
6
|
+
return response.json()
|
|
7
|
+
|
|
8
|
+
output = query({
|
|
9
|
+
"inputs": {
|
|
10
|
+
"image": "{{ inputs.asObj.image }}",
|
|
11
|
+
"question": "{{ inputs.asObj.question }}",
|
|
12
|
+
},
|
|
13
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
def query(payload):
|
|
2
|
+
with open(payload["inputs"], "rb") as f:
|
|
3
|
+
img = f.read()
|
|
4
|
+
payload["inputs"] = base64.b64encode(img).decode("utf-8")
|
|
5
|
+
response = requests.post(API_URL, headers=headers, json=payload)
|
|
6
|
+
return response.content
|
|
7
|
+
|
|
8
|
+
image_bytes = query({
|
|
9
|
+
{{ providerInputs.asJsonString }}
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
# You can access the image with PIL.Image for example
|
|
13
|
+
import io
|
|
14
|
+
from PIL import Image
|
|
15
|
+
image = Image.open(io.BytesIO(image_bytes))
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{% if model.library_name == "transformers" %}
|
|
2
|
+
def query(payload):
|
|
3
|
+
response = requests.post(API_URL, headers=headers, json=payload)
|
|
4
|
+
return response.content
|
|
5
|
+
|
|
6
|
+
audio_bytes = query({
|
|
7
|
+
"inputs": {{ providerInputs.asObj.inputs }},
|
|
8
|
+
})
|
|
9
|
+
# You can access the audio with IPython.display for example
|
|
10
|
+
from IPython.display import Audio
|
|
11
|
+
Audio(audio_bytes)
|
|
12
|
+
{% else %}
|
|
13
|
+
def query(payload):
|
|
14
|
+
response = requests.post(API_URL, headers=headers, json=payload)
|
|
15
|
+
return response.json()
|
|
16
|
+
|
|
17
|
+
audio, sampling_rate = query({
|
|
18
|
+
"inputs": {{ providerInputs.asObj.inputs }},
|
|
19
|
+
})
|
|
20
|
+
# You can access the audio with IPython.display for example
|
|
21
|
+
from IPython.display import Audio
|
|
22
|
+
Audio(audio, rate=sampling_rate)
|
|
23
|
+
{% endif %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{% if provider == "hf-inference" %}
|
|
2
|
+
def query(payload):
|
|
3
|
+
response = requests.post(API_URL, headers=headers, json=payload)
|
|
4
|
+
return response.content
|
|
5
|
+
|
|
6
|
+
image_bytes = query({
|
|
7
|
+
"inputs": {{ providerInputs.asObj.inputs }},
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
# You can access the image with PIL.Image for example
|
|
11
|
+
import io
|
|
12
|
+
from PIL import Image
|
|
13
|
+
image = Image.open(io.BytesIO(image_bytes))
|
|
14
|
+
{% endif %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
def query(data):
|
|
2
|
+
with open(data["image_path"], "rb") as f:
|
|
3
|
+
img = f.read()
|
|
4
|
+
payload={
|
|
5
|
+
"parameters": data["parameters"],
|
|
6
|
+
"inputs": base64.b64encode(img).decode("utf-8")
|
|
7
|
+
}
|
|
8
|
+
response = requests.post(API_URL, headers=headers, json=payload)
|
|
9
|
+
return response.json()
|
|
10
|
+
|
|
11
|
+
output = query({
|
|
12
|
+
"image_path": {{ providerInputs.asObj.inputs }},
|
|
13
|
+
"parameters": {"candidate_labels": ["cat", "dog", "llama"]},
|
|
14
|
+
})
|
|
@@ -20,7 +20,13 @@ interface ReplicateOutput {
|
|
|
20
20
|
output: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
interface NovitaOutput {
|
|
24
|
+
video: {
|
|
25
|
+
video_url: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const SUPPORTED_PROVIDERS = ["fal-ai", "novita", "replicate"] as const satisfies readonly InferenceProvider[];
|
|
24
30
|
|
|
25
31
|
export async function textToVideo(args: TextToVideoArgs, options?: Options): Promise<TextToVideoOutput> {
|
|
26
32
|
if (!args.provider || !typedInclude(SUPPORTED_PROVIDERS, args.provider)) {
|
|
@@ -30,14 +36,13 @@ export async function textToVideo(args: TextToVideoArgs, options?: Options): Pro
|
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
const payload =
|
|
33
|
-
args.provider === "fal-ai" || args.provider === "replicate"
|
|
39
|
+
args.provider === "fal-ai" || args.provider === "replicate" || args.provider === "novita"
|
|
34
40
|
? { ...omit(args, ["inputs", "parameters"]), ...args.parameters, prompt: args.inputs }
|
|
35
41
|
: args;
|
|
36
|
-
const res = await request<FalAiOutput | ReplicateOutput>(payload, {
|
|
42
|
+
const res = await request<FalAiOutput | ReplicateOutput | NovitaOutput>(payload, {
|
|
37
43
|
...options,
|
|
38
44
|
task: "text-to-video",
|
|
39
45
|
});
|
|
40
|
-
|
|
41
46
|
if (args.provider === "fal-ai") {
|
|
42
47
|
const isValidOutput =
|
|
43
48
|
typeof res === "object" &&
|
|
@@ -51,7 +56,22 @@ export async function textToVideo(args: TextToVideoArgs, options?: Options): Pro
|
|
|
51
56
|
if (!isValidOutput) {
|
|
52
57
|
throw new InferenceOutputError("Expected { video: { url: string } }");
|
|
53
58
|
}
|
|
54
|
-
const urlResponse = await fetch(res.video.url);
|
|
59
|
+
const urlResponse = await fetch((res as FalAiOutput).video.url);
|
|
60
|
+
return await urlResponse.blob();
|
|
61
|
+
} else if (args.provider === "novita") {
|
|
62
|
+
const isValidOutput =
|
|
63
|
+
typeof res === "object" &&
|
|
64
|
+
!!res &&
|
|
65
|
+
"video" in res &&
|
|
66
|
+
typeof res.video === "object" &&
|
|
67
|
+
!!res.video &&
|
|
68
|
+
"video_url" in res.video &&
|
|
69
|
+
typeof res.video.video_url === "string" &&
|
|
70
|
+
isUrl(res.video.video_url);
|
|
71
|
+
if (!isValidOutput) {
|
|
72
|
+
throw new InferenceOutputError("Expected { video: { video_url: string } }");
|
|
73
|
+
}
|
|
74
|
+
const urlResponse = await fetch((res as NovitaOutput).video.video_url);
|
|
55
75
|
return await urlResponse.blob();
|
|
56
76
|
} else {
|
|
57
77
|
/// TODO: Replicate: handle the case where the generation request "times out" / is async (ie output is null)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type SnippetInferenceProvider } from "@huggingface/tasks";
|
|
2
|
-
import type { PipelineType } from "@huggingface/tasks/src/pipelines.js";
|
|
3
|
-
import type { ChatCompletionInputMessage, GenerationParameters } from "@huggingface/tasks/src/tasks/index.js";
|
|
4
|
-
import { type InferenceSnippet, type ModelDataMinimal } from "@huggingface/tasks";
|
|
5
|
-
export declare const snippetBasic: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
6
|
-
export declare const snippetTextGeneration: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: {
|
|
7
|
-
streaming?: boolean;
|
|
8
|
-
messages?: ChatCompletionInputMessage[];
|
|
9
|
-
temperature?: GenerationParameters["temperature"];
|
|
10
|
-
max_tokens?: GenerationParameters["max_tokens"];
|
|
11
|
-
top_p?: GenerationParameters["top_p"];
|
|
12
|
-
}) => InferenceSnippet[];
|
|
13
|
-
export declare const snippetZeroShotClassification: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
14
|
-
export declare const snippetFile: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
15
|
-
export declare const curlSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
|
|
16
|
-
export declare function getCurlInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: Record<string, unknown>): InferenceSnippet[];
|
|
17
|
-
//# sourceMappingURL=curl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../src/snippets/curl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC9G,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAIrB,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,YAAY,UACjB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAelB,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAC1B,gBAAgB,eACV,MAAM,YACT,wBAAwB,oBAChB,MAAM,SACjB;IACN,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACxC,WAAW,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAClD,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;CACtC,KACC,gBAAgB,EA2ClB,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAclB,CAAC;AAEF,eAAO,MAAM,WAAW,UAChB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAalB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,OAAO,CACjC,MAAM,CACL,YAAY,EACZ,CACC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,eAAe,CAAC,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,gBAAgB,EAAE,CACvB,CA0BD,CAAC;AAEF,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,eAAe,CAAC,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,gBAAgB,EAAE,CAIpB"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type SnippetInferenceProvider } from "@huggingface/tasks";
|
|
2
|
-
import type { PipelineType } from "@huggingface/tasks/src/pipelines.js";
|
|
3
|
-
import type { ChatCompletionInputMessage, GenerationParameters } from "@huggingface/tasks/src/tasks/index.js";
|
|
4
|
-
import { type InferenceSnippet, type ModelDataMinimal } from "@huggingface/tasks";
|
|
5
|
-
export declare const snippetBasic: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
6
|
-
export declare const snippetTextGeneration: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: {
|
|
7
|
-
streaming?: boolean;
|
|
8
|
-
messages?: ChatCompletionInputMessage[];
|
|
9
|
-
temperature?: GenerationParameters["temperature"];
|
|
10
|
-
max_tokens?: GenerationParameters["max_tokens"];
|
|
11
|
-
top_p?: GenerationParameters["top_p"];
|
|
12
|
-
}) => InferenceSnippet[];
|
|
13
|
-
export declare const snippetZeroShotClassification: (model: ModelDataMinimal, accessToken: string) => InferenceSnippet[];
|
|
14
|
-
export declare const snippetTextToImage: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
15
|
-
export declare const snippetTextToVideo: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
16
|
-
export declare const snippetTextToAudio: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
17
|
-
export declare const snippetAutomaticSpeechRecognition: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
18
|
-
export declare const snippetFile: (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider) => InferenceSnippet[];
|
|
19
|
-
export declare const jsSnippets: Partial<Record<PipelineType, (model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: Record<string, unknown>) => InferenceSnippet[]>>;
|
|
20
|
-
export declare function getJsInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: Record<string, unknown>): InferenceSnippet[];
|
|
21
|
-
//# sourceMappingURL=js.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../../src/snippets/js.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,qCAAqC,CAAC;AACpF,OAAO,KAAK,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC9G,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAIrB,MAAM,oBAAoB,CAAC;AAgB5B,eAAO,MAAM,YAAY,UACjB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EA8ClB,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAC1B,gBAAgB,eACV,MAAM,YACT,wBAAwB,oBAChB,MAAM,SACjB;IACN,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACxC,WAAW,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAClD,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;CACtC,KACC,gBAAgB,EA+GlB,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAAW,gBAAgB,eAAe,MAAM,KAAG,gBAAgB,EA2B5G,CAAC;AAEF,eAAO,MAAM,kBAAkB,UACvB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EA4ClB,CAAC;AAEF,eAAO,MAAM,kBAAkB,UACvB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAqBlB,CAAC;AAEF,eAAO,MAAM,kBAAkB,UACvB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAgDlB,CAAC;AAEF,eAAO,MAAM,iCAAiC,UACtC,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EAsBlB,CAAC;AAEF,eAAO,MAAM,WAAW,UAChB,gBAAgB,eACV,MAAM,YACT,wBAAwB,KAChC,gBAAgB,EA6BlB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,OAAO,CAC/B,MAAM,CACL,YAAY,EACZ,CACC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,eAAe,CAAC,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,gBAAgB,EAAE,CACvB,CA2BD,CAAC;AAEF,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,eAAe,CAAC,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,gBAAgB,EAAE,CAIpB"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type SnippetInferenceProvider } from "@huggingface/tasks";
|
|
2
|
-
import { type InferenceSnippet, type ModelDataMinimal } from "@huggingface/tasks";
|
|
3
|
-
export declare function getPythonInferenceSnippet(model: ModelDataMinimal, accessToken: string, provider: SnippetInferenceProvider, providerModelId?: string, opts?: Record<string, unknown>): InferenceSnippet[];
|
|
4
|
-
//# sourceMappingURL=python.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../src/snippets/python.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAGlF,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAIrB,MAAM,oBAAoB,CAAC;AAkgB5B,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,wBAAwB,EAClC,eAAe,CAAC,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,gBAAgB,EAAE,CAiBpB"}
|