Skip to content

Commit

Permalink
[fix] format & lint (#1113)
Browse files Browse the repository at this point in the history
woops
  • Loading branch information
SBrandeis authored Jan 17, 2025
1 parent 560585e commit 286f8b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/inference/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type { ProviderMapping } from "./providers/types"
export type { ProviderMapping } from "./providers/types";
export { HfInference, HfInferenceEndpoint } from "./HfInference";
export { InferenceOutputError } from "./lib/InferenceOutputError";
export { FAL_AI_SUPPORTED_MODEL_IDS } from "./providers/fal-ai";
Expand Down
27 changes: 14 additions & 13 deletions packages/inference/src/lib/makeRequestOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,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 @@ -134,9 +134,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 All @@ -156,7 +156,8 @@ function mapModel(params: {
if (!params.taskHint) {
throw new Error("taskHint must be specified when using a third-party provider");
}
const task: WidgetType = params.taskHint === "text-generation" && params.chatCompletion ? "conversational" : params.taskHint;
const task: WidgetType =
params.taskHint === "text-generation" && params.chatCompletion ? "conversational" : params.taskHint;
const model = (() => {
switch (params.provider) {
case "fal-ai":
Expand Down

0 comments on commit 286f8b2

Please sign in to comment.