@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.
Files changed (82) hide show
  1. package/dist/browser/index.cjs +1652 -0
  2. package/dist/browser/index.js +1652 -0
  3. package/dist/index.cjs +277 -971
  4. package/dist/index.js +268 -982
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/lib/makeRequestOptions.d.ts +16 -1
  7. package/dist/src/lib/makeRequestOptions.d.ts.map +1 -1
  8. package/dist/src/providers/novita.d.ts.map +1 -1
  9. package/dist/src/snippets/getInferenceSnippets.d.ts +4 -0
  10. package/dist/src/snippets/getInferenceSnippets.d.ts.map +1 -0
  11. package/dist/src/snippets/index.d.ts +1 -4
  12. package/dist/src/snippets/index.d.ts.map +1 -1
  13. package/dist/src/tasks/cv/textToVideo.d.ts.map +1 -1
  14. package/package.json +15 -6
  15. package/src/index.ts +1 -1
  16. package/src/lib/makeRequestOptions.ts +37 -10
  17. package/src/providers/fireworks-ai.ts +1 -1
  18. package/src/providers/hf-inference.ts +1 -1
  19. package/src/providers/nebius.ts +3 -3
  20. package/src/providers/novita.ts +7 -6
  21. package/src/providers/sambanova.ts +1 -1
  22. package/src/providers/together.ts +3 -3
  23. package/src/snippets/getInferenceSnippets.ts +398 -0
  24. package/src/snippets/index.ts +1 -5
  25. package/src/snippets/templates/js/fetch/basic.jinja +19 -0
  26. package/src/snippets/templates/js/fetch/basicAudio.jinja +19 -0
  27. package/src/snippets/templates/js/fetch/basicImage.jinja +19 -0
  28. package/src/snippets/templates/js/fetch/textToAudio.jinja +41 -0
  29. package/src/snippets/templates/js/fetch/textToImage.jinja +19 -0
  30. package/src/snippets/templates/js/fetch/zeroShotClassification.jinja +22 -0
  31. package/src/snippets/templates/js/huggingface.js/basic.jinja +11 -0
  32. package/src/snippets/templates/js/huggingface.js/basicAudio.jinja +13 -0
  33. package/src/snippets/templates/js/huggingface.js/basicImage.jinja +13 -0
  34. package/src/snippets/templates/js/huggingface.js/conversational.jinja +11 -0
  35. package/src/snippets/templates/js/huggingface.js/conversationalStream.jinja +19 -0
  36. package/src/snippets/templates/js/huggingface.js/textToImage.jinja +11 -0
  37. package/src/snippets/templates/js/huggingface.js/textToVideo.jinja +10 -0
  38. package/src/snippets/templates/js/openai/conversational.jinja +13 -0
  39. package/src/snippets/templates/js/openai/conversationalStream.jinja +22 -0
  40. package/src/snippets/templates/python/fal_client/textToImage.jinja +11 -0
  41. package/src/snippets/templates/python/huggingface_hub/basic.jinja +4 -0
  42. package/src/snippets/templates/python/huggingface_hub/basicAudio.jinja +1 -0
  43. package/src/snippets/templates/python/huggingface_hub/basicImage.jinja +1 -0
  44. package/src/snippets/templates/python/huggingface_hub/conversational.jinja +6 -0
  45. package/src/snippets/templates/python/huggingface_hub/conversationalStream.jinja +8 -0
  46. package/src/snippets/templates/python/huggingface_hub/documentQuestionAnswering.jinja +5 -0
  47. package/src/snippets/templates/python/huggingface_hub/imageToImage.jinja +6 -0
  48. package/src/snippets/templates/python/huggingface_hub/importInferenceClient.jinja +6 -0
  49. package/src/snippets/templates/python/huggingface_hub/textToImage.jinja +5 -0
  50. package/src/snippets/templates/python/huggingface_hub/textToVideo.jinja +4 -0
  51. package/src/snippets/templates/python/openai/conversational.jinja +13 -0
  52. package/src/snippets/templates/python/openai/conversationalStream.jinja +15 -0
  53. package/src/snippets/templates/python/requests/basic.jinja +7 -0
  54. package/src/snippets/templates/python/requests/basicAudio.jinja +7 -0
  55. package/src/snippets/templates/python/requests/basicImage.jinja +7 -0
  56. package/src/snippets/templates/python/requests/conversational.jinja +9 -0
  57. package/src/snippets/templates/python/requests/conversationalStream.jinja +16 -0
  58. package/src/snippets/templates/python/requests/documentQuestionAnswering.jinja +13 -0
  59. package/src/snippets/templates/python/requests/imageToImage.jinja +15 -0
  60. package/src/snippets/templates/python/requests/importRequests.jinja +10 -0
  61. package/src/snippets/templates/python/requests/tabular.jinja +9 -0
  62. package/src/snippets/templates/python/requests/textToAudio.jinja +23 -0
  63. package/src/snippets/templates/python/requests/textToImage.jinja +14 -0
  64. package/src/snippets/templates/python/requests/zeroShotClassification.jinja +8 -0
  65. package/src/snippets/templates/python/requests/zeroShotImageClassification.jinja +14 -0
  66. package/src/snippets/templates/sh/curl/basic.jinja +7 -0
  67. package/src/snippets/templates/sh/curl/basicAudio.jinja +5 -0
  68. package/src/snippets/templates/sh/curl/basicImage.jinja +5 -0
  69. package/src/snippets/templates/sh/curl/conversational.jinja +7 -0
  70. package/src/snippets/templates/sh/curl/conversationalStream.jinja +7 -0
  71. package/src/snippets/templates/sh/curl/zeroShotClassification.jinja +5 -0
  72. package/src/tasks/cv/textToVideo.ts +25 -5
  73. package/src/vendor/fetch-event-source/LICENSE +21 -0
  74. package/dist/src/snippets/curl.d.ts +0 -17
  75. package/dist/src/snippets/curl.d.ts.map +0 -1
  76. package/dist/src/snippets/js.d.ts +0 -21
  77. package/dist/src/snippets/js.d.ts.map +0 -1
  78. package/dist/src/snippets/python.d.ts +0 -4
  79. package/dist/src/snippets/python.d.ts.map +0 -1
  80. package/src/snippets/curl.ts +0 -177
  81. package/src/snippets/js.ts +0 -475
  82. 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,11 @@
1
+ {% if provider == "fal-ai" %}
2
+ import fal_client
3
+
4
+ result = fal_client.subscribe(
5
+ "{{ providerModelId }}",
6
+ arguments={
7
+ "prompt": {{ inputs.asObj.inputs }},
8
+ },
9
+ )
10
+ print(result)
11
+ {% endif %}
@@ -0,0 +1,4 @@
1
+ result = client.{{ methodName }}(
2
+ inputs={{ inputs.asObj.inputs }},
3
+ model="{{ model.id }}",
4
+ )
@@ -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,6 @@
1
+ completion = client.chat.completions.create(
2
+ model="{{ model.id }}",
3
+ {{ inputs.asPythonString }}
4
+ )
5
+
6
+ print(completion.choices[0].message)
@@ -0,0 +1,8 @@
1
+ stream = client.chat.completions.create(
2
+ model="{{ model.id }}",
3
+ {{ inputs.asPythonString }}
4
+ stream=True,
5
+ )
6
+
7
+ for chunk in stream:
8
+ print(chunk.choices[0].delta.content, end="")
@@ -0,0 +1,5 @@
1
+ output = client.document_question_answering(
2
+ "{{ inputs.asObj.image }}",
3
+ question="{{ inputs.asObj.question }}",
4
+ model="{{ model.id }}",
5
+ )
@@ -0,0 +1,6 @@
1
+ # output is a PIL.Image object
2
+ image = client.image_to_image(
3
+ "{{ inputs.asObj.inputs }}",
4
+ prompt="{{ inputs.asObj.parameters.prompt }}",
5
+ model="{{ model.id }}",
6
+ )
@@ -0,0 +1,6 @@
1
+ from huggingface_hub import InferenceClient
2
+
3
+ client = InferenceClient(
4
+ provider="{{ provider }}",
5
+ api_key="{{ accessToken }}",
6
+ )
@@ -0,0 +1,5 @@
1
+ # output is a PIL.Image object
2
+ image = client.text_to_image(
3
+ {{ inputs.asObj.inputs }},
4
+ model="{{ model.id }}",
5
+ )
@@ -0,0 +1,4 @@
1
+ video = client.text_to_video(
2
+ {{ inputs.asObj.inputs }},
3
+ model="{{ model.id }}",
4
+ )
@@ -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,7 @@
1
+ def query(payload):
2
+ response = requests.post(API_URL, headers=headers, json=payload)
3
+ return response.json()
4
+
5
+ output = query({
6
+ "inputs": {{ providerInputs.asObj.inputs }},
7
+ })
@@ -0,0 +1,7 @@
1
+ def query(filename):
2
+ with open(filename, "rb") as f:
3
+ data = f.read()
4
+ response = requests.post(API_URL, headers={"Content-Type": "audio/flac", **headers}, data=data)
5
+ return response.json()
6
+
7
+ output = query({{ providerInputs.asObj.inputs }})
@@ -0,0 +1,7 @@
1
+ def query(filename):
2
+ with open(filename, "rb") as f:
3
+ data = f.read()
4
+ response = requests.post(API_URL, headers={"Content-Type": "image/jpeg", **headers}, data=data)
5
+ return response.json()
6
+
7
+ output = query({{ providerInputs.asObj.inputs }})
@@ -0,0 +1,9 @@
1
+ def query(payload):
2
+ response = requests.post(API_URL, headers=headers, json=payload)
3
+ return response.json()
4
+
5
+ response = query({
6
+ {{ providerInputs.asJsonString }}
7
+ })
8
+
9
+ print(response["choices"][0]["message"])
@@ -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,10 @@
1
+ {% if importBase64 %}
2
+ import base64
3
+ {% endif %}
4
+ {% if importJson %}
5
+ import json
6
+ {% endif %}
7
+ import requests
8
+
9
+ API_URL = "{{ fullUrl }}"
10
+ headers = {"Authorization": "{{ authorizationHeader }}"}
@@ -0,0 +1,9 @@
1
+ def query(payload):
2
+ response = requests.post(API_URL, headers=headers, json=payload)
3
+ return response.content
4
+
5
+ response = query({
6
+ "inputs": {
7
+ "data": {{ providerInputs.asObj.inputs }}
8
+ },
9
+ })
@@ -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,8 @@
1
+ def query(payload):
2
+ response = requests.post(API_URL, headers=headers, json=payload)
3
+ return response.json()
4
+
5
+ output = query({
6
+ "inputs": {{ providerInputs.asObj.inputs }},
7
+ "parameters": {"candidate_labels": ["refund", "legal", "faq"]},
8
+ })
@@ -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
+ })
@@ -0,0 +1,7 @@
1
+ curl {{ fullUrl }} \
2
+ -X POST \
3
+ -H 'Authorization: {{ authorizationHeader }}' \
4
+ -H 'Content-Type: application/json' \
5
+ -d '{
6
+ {{ providerInputs.asCurlString }}
7
+ }'
@@ -0,0 +1,5 @@
1
+ curl {{ fullUrl }} \
2
+ -X POST \
3
+ -H 'Authorization: {{ authorizationHeader }}' \
4
+ -H 'Content-Type: audio/flac' \
5
+ --data-binary @{{ providerInputs.asObj.inputs }}
@@ -0,0 +1,5 @@
1
+ curl {{ fullUrl }} \
2
+ -X POST \
3
+ -H 'Authorization: {{ authorizationHeader }}' \
4
+ -H 'Content-Type: image/jpeg' \
5
+ --data-binary @{{ providerInputs.asObj.inputs }}
@@ -0,0 +1,7 @@
1
+ curl {{ fullUrl }} \
2
+ -H 'Authorization: {{ authorizationHeader }}' \
3
+ -H 'Content-Type: application/json' \
4
+ -d '{
5
+ {{ providerInputs.asCurlString }},
6
+ "stream": false
7
+ }'
@@ -0,0 +1,7 @@
1
+ curl {{ fullUrl }} \
2
+ -H 'Authorization: {{ authorizationHeader }}' \
3
+ -H 'Content-Type: application/json' \
4
+ -d '{
5
+ {{ providerInputs.asCurlString }},
6
+ "stream": true
7
+ }'
@@ -0,0 +1,5 @@
1
+ curl {{ fullUrl }} \
2
+ -X POST \
3
+ -d '{"inputs": {{ providerInputs.asObj.inputs }}, "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}' \
4
+ -H 'Content-Type: application/json' \
5
+ -H 'Authorization: {{ authorizationHeader }}'
@@ -20,7 +20,13 @@ interface ReplicateOutput {
20
20
  output: string;
21
21
  }
22
22
 
23
- const SUPPORTED_PROVIDERS = ["fal-ai", "replicate"] as const satisfies readonly InferenceProvider[];
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"}