Skip to content

Commit 1a63901

Browse files
authored
Do not make any extra API call when endpoint URL is directly specified (#1322)
Fix #1321 (cc @Kakulukian for viz) The fix is not perfect, a greater refactoring would need to take place (eg to remove all concept of `providerConfig` when `endpointUrl` is provided, use a separate default provider config maybe not relying on `model` being defined)
1 parent 89f8ab4 commit 1a63901

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/inference/src/lib/makeRequestOptions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ export async function makeRequestOptions(
3535
if (maybeModel && isUrl(maybeModel)) {
3636
throw new Error(`Model URLs are no longer supported. Use endpointUrl instead.`);
3737
}
38+
39+
if (args.endpointUrl) {
40+
// No need to have maybeModel, or to load default model for a task
41+
return makeRequestOptionsFromResolvedModel(maybeModel ?? args.endpointUrl, args, options);
42+
}
43+
3844
if (!maybeModel && !task) {
3945
throw new Error("No model provided, and no task has been specified.");
4046
}

0 commit comments

Comments
 (0)