Skip to content

Commit 499b8f2

Browse files
committed
Switch path to router.huggingface.co
1 parent cea35c9 commit 499b8f2

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ const { generated_text } = await gpt2.textGeneration({inputs: 'The answer to the
183183

184184
// Chat Completion
185185
const llamaEndpoint = inference.endpoint(
186-
"https://api-inference.huggingface.co/models/meta-llama/Llama-3.1-8B-Instruct"
186+
"https://router.huggingface.co/together/models/meta-llama/Llama-3.1-8B-Instruct"
187187
);
188188
const out = await llamaEndpoint.chatCompletion({
189189
model: "meta-llama/Llama-3.1-8B-Instruct",

packages/inference/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ for await (const output of hf.textGenerationStream({
117117

118118
### Text Generation (Chat Completion API Compatible)
119119

120-
Using the `chatCompletion` method, you can generate text with models compatible with the OpenAI Chat Completion API. All models served by [TGI](https://api-inference.huggingface.co/framework/text-generation-inference) on Hugging Face support Messages API.
120+
Using the `chatCompletion` method, you can generate text with models compatible with the OpenAI Chat Completion API. All models served by [TGI](https://huggingface.co/docs/text-generation-inference/) on Hugging Face support Messages API.
121121

122122
[Demo](https://huggingface.co/spaces/huggingfacejs/streaming-chat-completion)
123123

@@ -611,7 +611,7 @@ const { generated_text } = await gpt2.textGeneration({inputs: 'The answer to the
611611

612612
// Chat Completion Example
613613
const ep = hf.endpoint(
614-
"https://api-inference.huggingface.co/models/meta-llama/Llama-3.1-8B-Instruct"
614+
"https://router.huggingface.co/together/models/meta-llama/Llama-3.1-8B-Instruct"
615615
);
616616
const stream = ep.chatCompletionStream({
617617
model: "tgi",

packages/inference/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const HF_HUB_URL = "https://huggingface.co";
2+
export const HF_ROUTER_URL = "https://router.huggingface.co";

packages/inference/src/lib/makeRequestOptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HF_HUB_URL } from "../config";
1+
import { HF_HUB_URL, HF_ROUTER_URL } from "../config";
22
import { FAL_AI_API_BASE_URL } from "../providers/fal-ai";
33
import { REPLICATE_API_BASE_URL } from "../providers/replicate";
44
import { SAMBANOVA_API_BASE_URL } from "../providers/sambanova";
@@ -9,7 +9,7 @@ import { isUrl } from "./isUrl";
99
import { version as packageVersion, name as packageName } from "../../package.json";
1010
import { getProviderModelId } from "./getProviderModelId";
1111

12-
const HF_HUB_INFERENCE_PROXY_TEMPLATE = `${HF_HUB_URL}/api/inference-proxy/{{PROVIDER}}`;
12+
const HF_HUB_INFERENCE_PROXY_TEMPLATE = `${HF_ROUTER_URL}/{{PROVIDER}}`;
1313

1414
/**
1515
* Lazy-loaded from huggingface.co/api/tasks when needed

packages/inference/test/vcr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { omit } from "../src/utils/omit";
2-
import { HF_HUB_URL } from "../src/config";
2+
import { HF_HUB_URL, HF_ROUTER_URL } from "../src/config";
33
import { isBackend } from "../src/utils/isBackend";
44
import { isFrontend } from "../src/utils/isFrontend";
55

@@ -117,7 +117,7 @@ async function vcr(
117117

118118
const { default: tapes } = await import(TAPES_FILE);
119119

120-
const cacheCandidate = !url.startsWith(HF_HUB_URL) || url.startsWith(`${HF_HUB_URL}/api/inference-proxy/`);
120+
const cacheCandidate = !url.startsWith(HF_HUB_URL) || url.startsWith(HF_ROUTER_URL);
121121

122122
if (VCR_MODE === MODE.PLAYBACK && cacheCandidate) {
123123
if (!tapes[hash]) {

0 commit comments

Comments
 (0)