@huggingface/tasks 0.12.24 → 0.12.26

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/index.cjs CHANGED
@@ -6337,7 +6337,7 @@ __export(curl_exports, {
6337
6337
  // src/snippets/common.ts
6338
6338
  function stringifyMessages(messages, opts) {
6339
6339
  const keyRole = opts.attributeKeyQuotes ? `"role"` : "role";
6340
- const keyContent = opts.attributeKeyQuotes ? `"role"` : "role";
6340
+ const keyContent = opts.attributeKeyQuotes ? `"content"` : "content";
6341
6341
  const messagesStringified = messages.map(({ role, content }) => {
6342
6342
  if (typeof content === "string") {
6343
6343
  content = JSON.stringify(content).slice(1, -1);
@@ -6779,10 +6779,10 @@ function getPythonInferenceSnippet(model, accessToken, opts) {
6779
6779
  return {
6780
6780
  ...snippet,
6781
6781
  content: `import requests
6782
-
6782
+
6783
6783
  API_URL = "https://api-inference.huggingface.co/models/${model.id}"
6784
6784
  headers = {"Authorization": ${accessToken ? `"Bearer ${accessToken}"` : `f"Bearer {API_TOKEN}"`}}
6785
-
6785
+
6786
6786
  ${snippet.content}`
6787
6787
  };
6788
6788
  });
package/dist/index.js CHANGED
@@ -6299,7 +6299,7 @@ __export(curl_exports, {
6299
6299
  // src/snippets/common.ts
6300
6300
  function stringifyMessages(messages, opts) {
6301
6301
  const keyRole = opts.attributeKeyQuotes ? `"role"` : "role";
6302
- const keyContent = opts.attributeKeyQuotes ? `"role"` : "role";
6302
+ const keyContent = opts.attributeKeyQuotes ? `"content"` : "content";
6303
6303
  const messagesStringified = messages.map(({ role, content }) => {
6304
6304
  if (typeof content === "string") {
6305
6305
  content = JSON.stringify(content).slice(1, -1);
@@ -6741,10 +6741,10 @@ function getPythonInferenceSnippet(model, accessToken, opts) {
6741
6741
  return {
6742
6742
  ...snippet,
6743
6743
  content: `import requests
6744
-
6744
+
6745
6745
  API_URL = "https://api-inference.huggingface.co/models/${model.id}"
6746
6746
  headers = {"Authorization": ${accessToken ? `"Bearer ${accessToken}"` : `f"Bearer {API_TOKEN}"`}}
6747
-
6747
+
6748
6748
  ${snippet.content}`
6749
6749
  };
6750
6750
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@huggingface/tasks",
3
3
  "packageManager": "pnpm@8.10.5",
4
- "version": "0.12.24",
4
+ "version": "0.12.26",
5
5
  "description": "List of ML tasks for huggingface.co/tasks",
6
6
  "repository": "https://github.com/huggingface/huggingface.js.git",
7
7
  "publishConfig": {
@@ -10,7 +10,7 @@ export interface StringifyMessagesOptions {
10
10
 
11
11
  export function stringifyMessages(messages: ChatCompletionInputMessage[], opts: StringifyMessagesOptions): string {
12
12
  const keyRole = opts.attributeKeyQuotes ? `"role"` : "role";
13
- const keyContent = opts.attributeKeyQuotes ? `"role"` : "role";
13
+ const keyContent = opts.attributeKeyQuotes ? `"content"` : "content";
14
14
 
15
15
  const messagesStringified = messages.map(({ role, content }) => {
16
16
  if (typeof content === "string") {
@@ -324,10 +324,10 @@ export function getPythonInferenceSnippet(
324
324
  return {
325
325
  ...snippet,
326
326
  content: `import requests
327
-
327
+
328
328
  API_URL = "https://api-inference.huggingface.co/models/${model.id}"
329
329
  headers = {"Authorization": ${accessToken ? `"Bearer ${accessToken}"` : `f"Bearer {API_TOKEN}"`}}
330
-
330
+
331
331
  ${snippet.content}`,
332
332
  };
333
333
  });