Skip to content

Commit

Permalink
[inference] prepare for 3.1.4 release (#1152)
Browse files Browse the repository at this point in the history
  • Loading branch information
SBrandeis authored Jan 29, 2025
1 parent 608526b commit 7a2238f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions packages/inference/src/lib/makeRequestOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ export async function makeRequestOptions(
? "hf-token"
: "provider-key"
: includeCredentials === "include"
? "credentials-include"
: "none";
? "credentials-include"
: "none";

const url = endpointUrl
? chatCompletion
? endpointUrl + `/v1/chat/completions`
: endpointUrl
: makeUrl({
authMethod,
chatCompletion: chatCompletion ?? false,
forceTask,
model,
provider: provider ?? "hf-inference",
taskHint,
});
authMethod,
chatCompletion: chatCompletion ?? false,
forceTask,
model,
provider: provider ?? "hf-inference",
taskHint,
});

const headers: Record<string, string> = {};
if (accessToken) {
Expand Down Expand Up @@ -143,9 +143,9 @@ export async function makeRequestOptions(
body: binary
? args.data
: JSON.stringify({
...otherArgs,
...(chatCompletion || provider === "together" ? { model } : undefined),
}),
...otherArgs,
...(chatCompletion || provider === "together" ? { model } : undefined),
}),
...(credentials ? { credentials } : undefined),
signal: options?.signal,
};
Expand Down Expand Up @@ -244,7 +244,7 @@ function makeUrl(params: {
return baseUrl;
}
default: {
const baseUrl = HF_HUB_INFERENCE_PROXY_TEMPLATE.replaceAll("{{PROVIDER}}", "hf-inference")
const baseUrl = HF_HUB_INFERENCE_PROXY_TEMPLATE.replaceAll("{{PROVIDER}}", "hf-inference");
const url = params.forceTask
? `${baseUrl}/pipeline/${params.forceTask}/${params.model}`
: `${baseUrl}/models/${params.model}`;
Expand Down
2 changes: 1 addition & 1 deletion packages/inference/test/vcr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async function vcr(

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

const cacheCandidate = !url.startsWith(HF_HUB_URL) || url.startsWith("https://huggingface.co/api/inference-proxy/")
const cacheCandidate = !url.startsWith(HF_HUB_URL) || url.startsWith("https://huggingface.co/api/inference-proxy/");

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

0 comments on commit 7a2238f

Please sign in to comment.