New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@huggingface/inference

Package Overview
Dependencies
Maintainers
4
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huggingface/inference - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

dist/src/providers/fireworks-ai.d.ts

35

dist/index.js

@@ -60,2 +60,5 @@ var __defProp = Object.defineProperty;

// src/providers/fireworks-ai.ts
var FIREWORKS_AI_API_BASE_URL = "https://api.fireworks.ai/inference";
// src/lib/isUrl.ts

@@ -68,3 +71,3 @@ function isUrl(modelOrUrl) {

var name = "@huggingface/inference";
var version = "3.2.0";
var version = "3.3.0";

@@ -75,4 +78,12 @@ // src/providers/consts.ts

* "HF model ID" => "Model ID on Inference Provider's side"
*
* Example:
* "Qwen/Qwen2.5-Coder-32B-Instruct": "Qwen2.5-Coder-32B-Instruct",
*/
// "Qwen/Qwen2.5-Coder-32B-Instruct": "Qwen2.5-Coder-32B-Instruct",
"fal-ai": {},
"fireworks-ai": {},
"hf-inference": {},
replicate: {},
sambanova: {},
together: {}
};

@@ -90,4 +101,4 @@

const task = options.taskHint === "text-generation" && options.chatCompletion ? "conversational" : options.taskHint;
if (HARDCODED_MODEL_ID_MAPPING[params.model]) {
return HARDCODED_MODEL_ID_MAPPING[params.model];
if (HARDCODED_MODEL_ID_MAPPING[params.provider]?.[params.model]) {
return HARDCODED_MODEL_ID_MAPPING[params.provider][params.model];
}

@@ -243,2 +254,9 @@ let inferenceProviderMapping;

}
case "fireworks-ai": {
const baseUrl = shouldProxy ? HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", params.provider) : FIREWORKS_AI_API_BASE_URL;
if (params.taskHint === "text-generation" && params.chatCompletion) {
return `${baseUrl}/v1/chat/completions`;
}
return baseUrl;
}
default: {

@@ -1222,3 +1240,10 @@ const baseUrl = HF_HUB_INFERENCE_PROXY_TEMPLATE.replaceAll("{{PROVIDER}}", "hf-inference");

// src/types.ts
var INFERENCE_PROVIDERS = ["fal-ai", "replicate", "sambanova", "together", "hf-inference"];
var INFERENCE_PROVIDERS = [
"fal-ai",
"fireworks-ai",
"hf-inference",
"replicate",
"sambanova",
"together"
];
export {

@@ -1225,0 +1250,0 @@ HfInference,

7

dist/src/providers/consts.d.ts

@@ -1,2 +0,3 @@

import type { ModelId } from "../types";
import type { InferenceProvider } from "../types";
import { type ModelId } from "../types";
type ProviderId = string;

@@ -7,5 +8,7 @@ /**

* you can add it to the following dictionary, for dev purposes.
*
* We also inject into this dictionary from tests.
*/
export declare const HARDCODED_MODEL_ID_MAPPING: Record<ModelId, ProviderId>;
export declare const HARDCODED_MODEL_ID_MAPPING: Record<InferenceProvider, Record<ModelId, ProviderId>>;
export {};
//# sourceMappingURL=consts.d.ts.map

@@ -41,3 +41,3 @@ import type { ChatCompletionInput, PipelineType } from "@huggingface/tasks";

export type InferenceTask = Exclude<PipelineType, "other">;
export declare const INFERENCE_PROVIDERS: readonly ["fal-ai", "replicate", "sambanova", "together", "hf-inference"];
export declare const INFERENCE_PROVIDERS: readonly ["fal-ai", "fireworks-ai", "hf-inference", "replicate", "sambanova", "together"];
export type InferenceProvider = (typeof INFERENCE_PROVIDERS)[number];

@@ -44,0 +44,0 @@ export interface BaseArgs {

{
"name": "@huggingface/inference",
"version": "3.2.0",
"version": "3.3.0",
"packageManager": "pnpm@8.10.5",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -49,3 +49,8 @@ # 🤗 Hugging Face Inference

Currently, we support the following providers: [Fal.ai](https://fal.ai), [Replicate](https://replicate.com), [Together](https://together.xyz) and [Sambanova](https://sambanova.ai).
Currently, we support the following providers:
- [Fal.ai](https://fal.ai)
- [Fireworks AI](https://fireworks.ai)
- [Replicate](https://replicate.com)
- [Sambanova](https://sambanova.ai)
- [Together](https://together.xyz)

@@ -68,6 +73,7 @@ To send requests to a third-party provider, you have to pass the `provider` parameter to the inference function. Make sure your request is authenticated with an access token.

Only a subset of models are supported when requesting third-party providers. You can check the list of supported models per pipeline tasks here:
- [Fal.ai supported models](./src/providers/fal-ai.ts)
- [Replicate supported models](./src/providers/replicate.ts)
- [Sambanova supported models](./src/providers/sambanova.ts)
- [Together supported models](./src/providers/together.ts)
- [Fal.ai supported models](https://huggingface.co/api/partners/fal-ai/models)
- [Fireworks AI supported models](https://huggingface.co/api/partners/fireworks-ai/models)
- [Replicate supported models](https://huggingface.co/api/partners/replicate/models)
- [Sambanova supported models](https://huggingface.co/api/partners/sambanova/models)
- [Together supported models](https://huggingface.co/api/partners/together/models)
- [HF Inference API (serverless)](https://huggingface.co/models?inference=warm&sort=trending)

@@ -74,0 +80,0 @@

@@ -33,4 +33,4 @@ import type { WidgetType } from "@huggingface/tasks";

// A dict called HARDCODED_MODEL_ID_MAPPING takes precedence in all cases (useful for dev purposes)
if (HARDCODED_MODEL_ID_MAPPING[params.model]) {
return HARDCODED_MODEL_ID_MAPPING[params.model];
if (HARDCODED_MODEL_ID_MAPPING[params.provider]?.[params.model]) {
return HARDCODED_MODEL_ID_MAPPING[params.provider][params.model];
}

@@ -37,0 +37,0 @@

@@ -6,2 +6,3 @@ import { HF_HUB_URL, HF_ROUTER_URL } from "../config";

import { TOGETHER_API_BASE_URL } from "../providers/together";
import { FIREWORKS_AI_API_BASE_URL } from "../providers/fireworks-ai";
import type { InferenceProvider } from "../types";

@@ -212,2 +213,11 @@ import type { InferenceTask, Options, RequestArgs } from "../types";

}
case "fireworks-ai": {
const baseUrl = shouldProxy
? HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", params.provider)
: FIREWORKS_AI_API_BASE_URL;
if (params.taskHint === "text-generation" && params.chatCompletion) {
return `${baseUrl}/v1/chat/completions`;
}
return baseUrl;
}
default: {

@@ -214,0 +224,0 @@ const baseUrl = HF_HUB_INFERENCE_PROXY_TEMPLATE.replaceAll("{{PROVIDER}}", "hf-inference");

@@ -1,5 +0,5 @@

import type { ModelId } from "../types";
import type { InferenceProvider } from "../types";
import { type ModelId } from "../types";
type ProviderId = string;
/**

@@ -9,8 +9,18 @@ * If you want to try to run inference for a new model locally before it's registered on huggingface.co

* you can add it to the following dictionary, for dev purposes.
*
* We also inject into this dictionary from tests.
*/
export const HARDCODED_MODEL_ID_MAPPING: Record<ModelId, ProviderId> = {
export const HARDCODED_MODEL_ID_MAPPING: Record<InferenceProvider, Record<ModelId, ProviderId>> = {
/**
* "HF model ID" => "Model ID on Inference Provider's side"
*
* Example:
* "Qwen/Qwen2.5-Coder-32B-Instruct": "Qwen2.5-Coder-32B-Instruct",
*/
// "Qwen/Qwen2.5-Coder-32B-Instruct": "Qwen2.5-Coder-32B-Instruct",
"fal-ai": {},
"fireworks-ai": {},
"hf-inference": {},
replicate: {},
sambanova: {},
together: {},
};

@@ -47,3 +47,10 @@ import type { ChatCompletionInput, PipelineType } from "@huggingface/tasks";

export const INFERENCE_PROVIDERS = ["fal-ai", "replicate", "sambanova", "together", "hf-inference"] as const;
export const INFERENCE_PROVIDERS = [
"fal-ai",
"fireworks-ai",
"hf-inference",
"replicate",
"sambanova",
"together",
] as const;
export type InferenceProvider = (typeof INFERENCE_PROVIDERS)[number];

@@ -50,0 +57,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc