Skip to content

Commit 1685163

Browse files
committed
fixes
1 parent 0bdd1f1 commit 1685163

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/inference/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export const HF_HUB_URL = import.meta.env.HUGGINGFACE_HUB_URL ?? "https://huggingface.co";
2-
export const HF_INFERENCE_API_URL = import.meta.env.HF_INFERENCE_API_URL ?? "https://api-inference.huggingface.co";
1+
export const HF_HUB_URL = "https://huggingface.co";
2+
export const HF_INFERENCE_API_URL = "https://api-inference.huggingface.co";

packages/inference/src/lib/makeRequestOptions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { InferenceProvider } from "../types";
77
import type { InferenceTask, Options, RequestArgs } from "../types";
88
import { isUrl } from "./isUrl";
99

10-
const HF_HUB_INFERENCE_PROXY_TEMPLATE = `{{HF_HUB_URL}}/inference-proxy/{{PROVIDER}}`;
10+
const HF_HUB_INFERENCE_PROXY_TEMPLATE = `{{HF_HUB_URL}}/api/inference-proxy/{{PROVIDER}}`;
1111

1212
/**
1313
* Lazy-loaded from huggingface.co/api/tasks when needed
@@ -34,7 +34,7 @@ export async function makeRequestOptions(
3434
const { accessToken, endpointUrl, provider: maybeProvider, model: maybeModel, ...otherArgs } = args;
3535
const provider = maybeProvider ?? "hf-inference";
3636

37-
const { forceTask, includeCredentials, taskHint, wait_for_model, use_cache, dont_load_model, chatCompletion } =
37+
const { forceTask, includeCredentials, taskHint, wait_for_model, use_cache, dont_load_model, chatCompletion, hfHubUrl } =
3838
options ?? {};
3939

4040
if (endpointUrl && provider !== "hf-inference") {
@@ -76,15 +76,15 @@ export async function makeRequestOptions(
7676
authMethod,
7777
chatCompletion: chatCompletion ?? false,
7878
forceTask,
79-
hfHubUrl: options?.hfHubUrl ?? HF_HUB_URL,
79+
hfHubUrl: hfHubUrl ?? HF_HUB_URL,
8080
model,
8181
provider: provider ?? "hf-inference",
8282
taskHint,
8383
});
8484

8585
const headers: Record<string, string> = {};
8686
if (accessToken) {
87-
headers["Authorization"] = provider === "fal-ai" ? `Key ${accessToken}` : `Bearer ${accessToken}`;
87+
headers["Authorization"] = provider === "fal-ai" && authMethod === "provider-key" ? `Key ${accessToken}` : `Bearer ${accessToken}`;
8888
}
8989

9090
const binary = "data" in args && !!args.data;

packages/inference/test/vcr.ts

Lines changed: 1 addition & 1 deletion
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/lib/getDefaultTask";
2+
import { HF_HUB_URL } from "../src/config";
33
import { isBackend } from "../src/utils/isBackend";
44
import { isFrontend } from "../src/utils/isFrontend";
55

0 commit comments

Comments
 (0)