@huggingface/inference 3.13.2-tshy → 3.14.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.
@@ -1 +1 @@
1
- {"version":3,"file":"InferenceClient.d.ts","sourceRoot":"","sources":["../../src/InferenceClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQ1C,KAAK,IAAI,GAAG,OAAO,KAAK,CAAC;AAEzB,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;gBAGxC,WAAW,SAAK,EAChB,cAAc,GAAE,OAAO,GAAG;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;KAChB;IAsBP;;;;OAIG;IACI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe;CAGrD;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI;CAAG;AAEhD;;;GAGG;AACH,qBAAa,WAAY,SAAQ,eAAe;CAAG;AACnD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;CAAG"}
1
+ {"version":3,"file":"InferenceClient.d.ts","sourceRoot":"","sources":["../../src/InferenceClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAO1C,KAAK,IAAI,GAAG,OAAO,KAAK,CAAC;AAEzB,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;gBAGxC,WAAW,SAAK,EAChB,cAAc,GAAE,OAAO,GAAG;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;KAChB;IAsBP;;;;OAIG;IACI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe;CAGrD;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI;CAAG;AAEhD;;;GAGG;AACH,qBAAa,WAAY,SAAQ,eAAe;CAAG;AACnD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;CAAG"}
@@ -37,7 +37,6 @@ exports.InferenceClientEndpoint = exports.HfInference = exports.InferenceClient
37
37
  const tasks = __importStar(require("./tasks/index.js"));
38
38
  const omit_js_1 = require("./utils/omit.js");
39
39
  const typedEntries_js_1 = require("./utils/typedEntries.js");
40
- /import\s+([^\s]+)\s+from\s+(['"])(\.{1,2}\/[^'"]+?)(?<!\.js)\2/g;
41
40
  class InferenceClient {
42
41
  accessToken;
43
42
  defaultOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"makeRequestOptions.d.ts","sourceRoot":"","sources":["../../../src/lib/makeRequestOptions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAEtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAShE;;;GAGG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,WAAW,GAAG;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,EACD,cAAc,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,EACpD,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,oEAAoE;IACpE,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,GACC,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAmE7C;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAClD,aAAa,EAAE,MAAM,EACrB,cA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AC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,EACD,OAAO,EAAE,6BAA6B,GAAG,SAAS,EAClD,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,GACC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CA+EpC"}
@@ -1,14 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.makeRequestOptions = makeRequestOptions;
7
4
  exports.makeRequestOptionsFromResolvedModel = makeRequestOptionsFromResolvedModel;
8
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
9
- // @ts-ignore this works or not depending on commonjs/ESM - see https://github.com/microsoft/TypeScript/issues/51783
10
- const package_json_1 = __importDefault(require("../../package.json"));
11
5
  const config_js_1 = require("../config.js");
6
+ const package_js_1 = require("../package.js");
12
7
  const getInferenceProviderMapping_js_1 = require("./getInferenceProviderMapping.js");
13
8
  const isUrl_js_1 = require("./isUrl.js");
14
9
  /**
@@ -110,7 +105,7 @@ function makeRequestOptionsFromResolvedModel(resolvedModel, providerHelper, args
110
105
  }
111
106
  // Add user-agent to headers
112
107
  // e.g. @huggingface/inference/3.1.3
113
- const ownUserAgent = `${package_json_1.default.name}/${package_json_1.default.version}`;
108
+ const ownUserAgent = `${package_js_1.PACKAGE_NAME}/${package_js_1.PACKAGE_VERSION}`;
114
109
  const userAgent = [ownUserAgent, typeof navigator !== "undefined" ? navigator.userAgent : undefined]
115
110
  .filter((x) => x !== undefined)
116
111
  .join(" ");
@@ -0,0 +1,3 @@
1
+ export declare const PACKAGE_VERSION = "3.14.0";
2
+ export declare const PACKAGE_NAME = "@huggingface/inference";
3
+ //# sourceMappingURL=package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,YAAY,2BAA2B,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PACKAGE_NAME = exports.PACKAGE_VERSION = void 0;
4
+ // Generated file from package.json. Issues importing JSON directly when publishing on commonjs/ESM - see https://github.com/microsoft/TypeScript/issues/51783
5
+ exports.PACKAGE_VERSION = "3.14.0";
6
+ exports.PACKAGE_NAME = "@huggingface/inference";
@@ -1 +1 @@
1
- {"version":3,"file":"InferenceClient.d.ts","sourceRoot":"","sources":["../../src/InferenceClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQ1C,KAAK,IAAI,GAAG,OAAO,KAAK,CAAC;AAEzB,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;gBAGxC,WAAW,SAAK,EAChB,cAAc,GAAE,OAAO,GAAG;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;KAChB;IAsBP;;;;OAIG;IACI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe;CAGrD;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI;CAAG;AAEhD;;;GAGG;AACH,qBAAa,WAAY,SAAQ,eAAe;CAAG;AACnD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;CAAG"}
1
+ {"version":3,"file":"InferenceClient.d.ts","sourceRoot":"","sources":["../../src/InferenceClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAO1C,KAAK,IAAI,GAAG,OAAO,KAAK,CAAC;AAEzB,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;gBAGxC,WAAW,SAAK,EAChB,cAAc,GAAE,OAAO,GAAG;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;KAChB;IAsBP;;;;OAIG;IACI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe;CAGrD;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI;CAAG;AAEhD;;;GAGG;AACH,qBAAa,WAAY,SAAQ,eAAe;CAAG;AACnD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;CAAG"}
@@ -1,7 +1,6 @@
1
1
  import * as tasks from "./tasks/index.js";
2
2
  import { omit } from "./utils/omit.js";
3
3
  import { typedEntries } from "./utils/typedEntries.js";
4
- /import\s+([^\s]+)\s+from\s+(['"])(\.{1,2}\/[^'"]+?)(?<!\.js)\2/g;
5
4
  export class InferenceClient {
6
5
  accessToken;
7
6
  defaultOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"makeRequestOptions.d.ts","sourceRoot":"","sources":["../../../src/lib/makeRequestOptions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAEtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAShE;;;GAGG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,WAAW,GAAG;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,EACD,cAAc,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,EACpD,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,oEAAoE;IACpE,I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C,CAmE7C;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAClD,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,EACpD,IAAI,EAAE,WAAW,GAAG;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,EACD,OAAO,EAAE,6BAA6B,GAAG,SAAS,EAClD,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,GACC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CA+EpC"}
@@ -1,7 +1,5 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore this works or not depending on commonjs/ESM - see https://github.com/microsoft/TypeScript/issues/51783
3
- import pkg from "../../package.json" with { type: "json" };
4
1
  import { HF_HEADER_X_BILL_TO, HF_HUB_URL } from "../config.js";
2
+ import { PACKAGE_NAME, PACKAGE_VERSION } from "../package.js";
5
3
  import { getInferenceProviderMapping } from "./getInferenceProviderMapping.js";
6
4
  import { isUrl } from "./isUrl.js";
7
5
  /**
@@ -103,7 +101,7 @@ export function makeRequestOptionsFromResolvedModel(resolvedModel, providerHelpe
103
101
  }
104
102
  // Add user-agent to headers
105
103
  // e.g. @huggingface/inference/3.1.3
106
- const ownUserAgent = `${pkg.name}/${pkg.version}`;
104
+ const ownUserAgent = `${PACKAGE_NAME}/${PACKAGE_VERSION}`;
107
105
  const userAgent = [ownUserAgent, typeof navigator !== "undefined" ? navigator.userAgent : undefined]
108
106
  .filter((x) => x !== undefined)
109
107
  .join(" ");
@@ -0,0 +1,3 @@
1
+ export declare const PACKAGE_VERSION = "3.14.0";
2
+ export declare const PACKAGE_NAME = "@huggingface/inference";
3
+ //# sourceMappingURL=package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,YAAY,2BAA2B,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Generated file from package.json. Issues importing JSON directly when publishing on commonjs/ESM - see https://github.com/microsoft/TypeScript/issues/51783
2
+ export const PACKAGE_VERSION = "3.14.0";
3
+ export const PACKAGE_NAME = "@huggingface/inference";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/inference",
3
- "version": "3.13.2-tshy",
3
+ "version": "3.14.0",
4
4
  "license": "MIT",
5
5
  "author": "Hugging Face and Tim Mikeladze <tim.mikeladze@gmail.com>",
6
6
  "description": "Typescript client for the Hugging Face Inference Providers and Inference Endpoints",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "type": "module",
42
42
  "dependencies": {
43
- "@huggingface/jinja": "^0.5.0",
44
- "@huggingface/tasks": "^0.19.8"
43
+ "@huggingface/tasks": "^0.19.8",
44
+ "@huggingface/jinja": "^0.5.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "18.13.0"
@@ -61,8 +61,7 @@
61
61
  }
62
62
  },
63
63
  "scripts": {
64
- "build": "pnpm run export-templates && tshy",
65
- "dts": "tsx scripts/generate-dts.ts && tsc --noEmit dist/index.d.ts",
64
+ "build": "pnpm run export-templates && pnpm run package-to-ts && tshy",
66
65
  "lint": "eslint --quiet --fix --ext .cjs,.ts .",
67
66
  "lint:check": "eslint --ext .cjs,.ts .",
68
67
  "format": "prettier --write .",
@@ -71,6 +70,7 @@
71
70
  "test:browser": "vitest run --browser.name=chrome --browser.headless --config vitest.config.mts",
72
71
  "check": "tsc",
73
72
  "dev": "pnpm run export-templates && tsup src/index.ts --format cjs,esm --watch",
74
- "export-templates": "tsx scripts/export-templates.ts"
73
+ "export-templates": "tsx scripts/export-templates.ts",
74
+ "package-to-ts": "tsx scripts/package-json-to-ts.ts"
75
75
  }
76
76
  }
@@ -3,7 +3,6 @@ import type { Options } from "./types.js";
3
3
  import { omit } from "./utils/omit.js";
4
4
  import { typedEntries } from "./utils/typedEntries.js";
5
5
 
6
- /import\s+([^\s]+)\s+from\s+(['"])(\.{1,2}\/[^'"]+?)(?<!\.js)\2/g;
7
6
  /* eslint-disable @typescript-eslint/no-empty-interface */
8
7
  /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
9
8
 
@@ -1,7 +1,5 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore this works or not depending on commonjs/ESM - see https://github.com/microsoft/TypeScript/issues/51783
3
- import pkg from "../../package.json" with { type: "json" };
4
1
  import { HF_HEADER_X_BILL_TO, HF_HUB_URL } from "../config.js";
2
+ import { PACKAGE_NAME, PACKAGE_VERSION } from "../package.js";
5
3
  import type { InferenceTask, Options, RequestArgs } from "../types.js";
6
4
  import type { InferenceProviderModelMapping } from "./getInferenceProviderMapping.js";
7
5
  import { getInferenceProviderMapping } from "./getInferenceProviderMapping.js";
@@ -160,7 +158,7 @@ export function makeRequestOptionsFromResolvedModel(
160
158
 
161
159
  // Add user-agent to headers
162
160
  // e.g. @huggingface/inference/3.1.3
163
- const ownUserAgent = `${pkg.name}/${pkg.version}`;
161
+ const ownUserAgent = `${PACKAGE_NAME}/${PACKAGE_VERSION}`;
164
162
  const userAgent = [ownUserAgent, typeof navigator !== "undefined" ? navigator.userAgent : undefined]
165
163
  .filter((x) => x !== undefined)
166
164
  .join(" ");
package/src/package.ts ADDED
@@ -0,0 +1,3 @@
1
+ // Generated file from package.json. Issues importing JSON directly when publishing on commonjs/ESM - see https://github.com/microsoft/TypeScript/issues/51783
2
+ export const PACKAGE_VERSION = "3.14.0";
3
+ export const PACKAGE_NAME = "@huggingface/inference";