opencode-home / node_modules /@huggingface /tasks /dist /commonjs /inference-providers.js
kenqtade's picture
Use ken-q org namespace for project Spaces
0865492
Raw
History Blame Contribute Delete
882 Bytes
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HF_HUB_INFERENCE_PROXY_TEMPLATE = void 0;
exports.openAIbaseUrl = openAIbaseUrl;
/// This list is for illustration purposes only.
/// in the `tasks` sub-package, we do not need actual strong typing of the inference providers.
const INFERENCE_PROVIDERS = [
"cerebras",
"cohere",
"deepinfra",
"fal-ai",
"fireworks-ai",
"hf-inference",
"ovhcloud",
"replicate",
"together",
];
exports.HF_HUB_INFERENCE_PROXY_TEMPLATE = `https://router.huggingface.co/{{PROVIDER}}`;
/**
* URL to set as baseUrl in the OpenAI SDK.
*
* TODO(Expose this from InferenceClient in the future?)
*/
function openAIbaseUrl(provider) {
const url = exports.HF_HUB_INFERENCE_PROXY_TEMPLATE.replace("{{PROVIDER}}", provider);
return provider === "hf-inference" ? `${url}/v1` : url;
}