Skip to content

Commit bcc01c0

Browse files
committed
rename to nscale
1 parent 815250c commit bcc01c0

File tree

6 files changed

+18
-19
lines changed

6 files changed

+18
-19
lines changed

packages/inference/src/lib/getProviderHelper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as HFInference from "../providers/hf-inference";
88
import * as Hyperbolic from "../providers/hyperbolic";
99
import * as Nebius from "../providers/nebius";
1010
import * as Novita from "../providers/novita";
11-
import * as Nscale from "../providers/nscale-cloud";
11+
import * as Nscale from "../providers/nscale";
1212
import * as OpenAI from "../providers/openai";
1313
import type {
1414
AudioClassificationTaskHelper,
@@ -110,9 +110,9 @@ export const PROVIDERS: Record<InferenceProvider, Partial<Record<InferenceTask,
110110
conversational: new Novita.NovitaConversationalTask(),
111111
"text-generation": new Novita.NovitaTextGenerationTask(),
112112
},
113-
"nscale-cloud": {
114-
"text-to-image": new Nscale.NscaleCloudTextToImageTask(),
115-
conversational: new Nscale.NscaleCloudConversationalTask(),
113+
nscale: {
114+
"text-to-image": new Nscale.NscaleTextToImageTask(),
115+
conversational: new Nscale.NscaleConversationalTask(),
116116
},
117117
openai: {
118118
conversational: new OpenAI.OpenAIConversationalTask(),

packages/inference/src/providers/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const HARDCODED_MODEL_ID_MAPPING: Record<InferenceProvider, Record<ModelI
2525
hyperbolic: {},
2626
nebius: {},
2727
novita: {},
28-
"nscale-cloud": {},
28+
nscale: {},
2929
openai: {},
3030
replicate: {},
3131
sambanova: {},

packages/inference/src/providers/nscale-cloud.ts renamed to packages/inference/src/providers/nscale.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import type { BodyParams, UrlParams } from "../types";
1919
import { omit } from "../utils/omit";
2020
import {
2121
BaseConversationalTask,
22-
BaseTextGenerationTask,
2322
TaskProviderHelper,
2423
type TextToImageTaskHelper,
2524
} from "./providerHelper";
@@ -32,15 +31,15 @@ interface NscaleCloudBase64ImageGeneration {
3231
}>;
3332
}
3433

35-
export class NscaleCloudConversationalTask extends BaseConversationalTask {
34+
export class NscaleConversationalTask extends BaseConversationalTask {
3635
constructor() {
37-
super("nscale-cloud", NSCALE_API_BASE_URL);
36+
super("nscale", NSCALE_API_BASE_URL);
3837
}
3938
}
4039

41-
export class NscaleCloudTextToImageTask extends TaskProviderHelper implements TextToImageTaskHelper {
40+
export class NscaleTextToImageTask extends TaskProviderHelper implements TextToImageTaskHelper {
4241
constructor() {
43-
super("nscale-cloud", NSCALE_API_BASE_URL);
42+
super("nscale", NSCALE_API_BASE_URL);
4443
}
4544

4645
preparePayload(params: BodyParams): Record<string, unknown> {

packages/inference/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const INFERENCE_PROVIDERS = [
4646
"hyperbolic",
4747
"nebius",
4848
"novita",
49-
"nscale-cloud",
49+
"nscale",
5050
"openai",
5151
"replicate",
5252
"sambanova",

packages/inference/test/InferenceClient.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,17 +1395,17 @@ describe.concurrent("InferenceClient", () => {
13951395
describe.concurrent(
13961396
"Nscale",
13971397
() => {
1398-
const client = new InferenceClient(env.HF_NSCALE_CLOUD_KEY ?? "dummy");
1398+
const client = new InferenceClient(env.HF_NSCALE_KEY ?? "dummy");
13991399

1400-
HARDCODED_MODEL_ID_MAPPING["nscale-cloud"] = {
1400+
HARDCODED_MODEL_ID_MAPPING["nscale"] = {
14011401
"meta-llama/Llama-3.1-8B-Instruct": "meta-llama/Llama-3.1-8B-Instruct",
14021402
"black-forest-labs/FLUX.1-schnell": "black-forest-labs/FLUX.1-schnell",
14031403
};
14041404

14051405
it("chatCompletion", async () => {
14061406
const res = await client.chatCompletion({
14071407
model: "meta-llama/Llama-3.1-8B-Instruct",
1408-
provider: "nscale-cloud",
1408+
provider: "nscale",
14091409
messages: [{ role: "user", content: "Complete this sentence with words, one plus one is equal " }],
14101410
});
14111411
if (res.choices && res.choices.length > 0) {
@@ -1416,7 +1416,7 @@ describe.concurrent("InferenceClient", () => {
14161416
it("chatCompletion stream", async () => {
14171417
const stream = client.chatCompletionStream({
14181418
model: "meta-llama/Llama-3.1-8B-Instruct",
1419-
provider: "nscale-cloud",
1419+
provider: "nscale",
14201420
messages: [{ role: "user", content: "Say 'this is a test'" }],
14211421
stream: true,
14221422
}) as AsyncGenerator<ChatCompletionStreamOutput>;
@@ -1435,7 +1435,7 @@ describe.concurrent("InferenceClient", () => {
14351435
it("textToImage", async () => {
14361436
const res = await client.textToImage({
14371437
model: "black-forest-labs/FLUX.1-schnell",
1438-
provider: "nscale-cloud",
1438+
provider: "nscale",
14391439
inputs: "An astronaut riding a horse",
14401440
});
14411441
expect(res).toBeInstanceOf(Blob);

packages/inference/test/tapes.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7517,7 +7517,7 @@
75177517
"body": "{\"messages\":[{\"role\":\"user\",\"content\":\"Complete this sentence with words, one plus one is equal \"}],\"model\":\"meta-llama/Llama-3.1-8B-Instruct\"}"
75187518
},
75197519
"response": {
7520-
"body": "{\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"...to two.\",\"role\":\"assistant\"},\"stop_reason\":null}],\"created\":1744200972,\"id\":\"chatcmpl-f1828f05-36ce-4b3c-acc3-1b74a04ac337\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion\",\"prompt_logprobs\":null,\"usage\":{\"completion_tokens\":5,\"prompt_tokens\":46,\"total_tokens\":51}}",
7520+
"body": "{\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"...two.\",\"role\":\"assistant\"},\"stop_reason\":null}],\"created\":1744209065,\"id\":\"chatcmpl-87c8f1bf-e43e-4c47-8e50-df95274c59ac\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion\",\"prompt_logprobs\":null,\"usage\":{\"completion_tokens\":4,\"prompt_tokens\":46,\"total_tokens\":50}}",
75217521
"status": 200,
75227522
"statusText": "OK",
75237523
"headers": {
@@ -7537,7 +7537,7 @@
75377537
"body": "{\"messages\":[{\"role\":\"user\",\"content\":\"Say 'this is a test'\"}],\"stream\":true,\"model\":\"meta-llama/Llama-3.1-8B-Instruct\"}"
75387538
},
75397539
"response": {
7540-
"body": "data: {\"choices\":[{\"delta\":{\"content\":\"\",\"role\":\"assistant\"},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744200972,\"id\":\"chatcmpl-63f5a879-7f4a-44d4-a81d-771c4b1318cc\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"This\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744200972,\"id\":\"chatcmpl-63f5a879-7f4a-44d4-a81d-771c4b1318cc\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\" is\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744200972,\"id\":\"chatcmpl-63f5a879-7f4a-44d4-a81d-771c4b1318cc\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\" a\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744200972,\"id\":\"chatcmpl-63f5a879-7f4a-44d4-a81d-771c4b1318cc\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\" test\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744200972,\"id\":\"chatcmpl-63f5a879-7f4a-44d4-a81d-771c4b1318cc\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\".\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744200972,\"id\":\"chatcmpl-63f5a879-7f4a-44d4-a81d-771c4b1318cc\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"\",\"role\":null},\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null}],\"created\":1744200972,\"id\":\"chatcmpl-63f5a879-7f4a-44d4-a81d-771c4b1318cc\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[],\"created\":1744200972,\"id\":\"chatcmpl-63f5a879-7f4a-44d4-a81d-771c4b1318cc\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":{\"completion_tokens\":6,\"prompt_tokens\":42,\"total_tokens\":48}}\n\n",
7540+
"body": "data: {\"choices\":[{\"delta\":{\"content\":\"\",\"role\":\"assistant\"},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744209065,\"id\":\"chatcmpl-c11aba1c-cb34-415a-bfa7-21d90f27c5de\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"This\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744209065,\"id\":\"chatcmpl-c11aba1c-cb34-415a-bfa7-21d90f27c5de\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\" is\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744209065,\"id\":\"chatcmpl-c11aba1c-cb34-415a-bfa7-21d90f27c5de\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\" a\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744209065,\"id\":\"chatcmpl-c11aba1c-cb34-415a-bfa7-21d90f27c5de\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\" test\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744209065,\"id\":\"chatcmpl-c11aba1c-cb34-415a-bfa7-21d90f27c5de\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\".\",\"role\":null},\"finish_reason\":null,\"index\":0,\"logprobs\":null}],\"created\":1744209065,\"id\":\"chatcmpl-c11aba1c-cb34-415a-bfa7-21d90f27c5de\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"\",\"role\":null},\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null}],\"created\":1744209065,\"id\":\"chatcmpl-c11aba1c-cb34-415a-bfa7-21d90f27c5de\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":null}\n\ndata: {\"choices\":[],\"created\":1744209065,\"id\":\"chatcmpl-c11aba1c-cb34-415a-bfa7-21d90f27c5de\",\"model\":\"meta-llama/Llama-3.1-8B-Instruct\",\"object\":\"chat.completion.chunk\",\"usage\":{\"completion_tokens\":6,\"prompt_tokens\":42,\"total_tokens\":48}}\n\n",
75417541
"status": 201,
75427542
"statusText": "Created",
75437543
"headers": {
@@ -7559,7 +7559,7 @@
75597559
"body": "{\"response_format\":\"b64_json\",\"prompt\":\"An astronaut riding a horse\",\"model\":\"black-forest-labs/FLUX.1-schnell\"}"
75607560
},
75617561
"response": {
7562-
"body": "{\"created\":1744200974,\"data\":[{\"b64_json\":\"iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAAG/XRFWHRwcm9tcHQAeyI1IjogeyJpbnB1dHMiOiB7IndpZHRoIjogNTEyLCAiaGVpZ2h0IjogNTEyLCAiYmF0Y2hfc2l6ZSI6IDF9LCAiY2xhc3NfdHlwZSI6ICJFbXB0eUxhdGVudEltYWdlIiwgIl9tZXRhIjogeyJ0aXRsZSI6ICJFbXB0eSBMYXRlbnQgSW1hZ2UifX0sICI2IjogeyJpbnB1dHMiOiB7InRleHQiOiAicGhvdG9yZWFsaXN0aWMsIHJlYWxpc20sIG5hdHVyYWwgcGljdHVyZSwgQW4gYXN0cm9uYXV0IHJpZGluZyBhIGhvcnNlIiwgImNsaXAiOiBbIjExIiwgMF19LCAiY2xhc3NfdHlwZSI6ICJDTElQVGV4dEVuY29kZSIsICJfbWV0YSI6IHsidGl0bGUiOiAiQ0xJUCBUZXh0IEVuY29kZSAoUHJvbXB0KSJ9fSwgIjgiOiB7ImlucHV0cyI6IHsic2FtcGxlcyI6IFsiMTMiLCAwXSwgInZhZSI6IFsiMTAiLCAwXX0sICJjbGFzc190eXBlIjogIlZBRURlY29kZSIsICJfbWV0YSI6IHsidGl0bGUiOiAiVkFFIERlY29kZSJ9fSwgIjkiOiB7ImlucHV0cyI6IHsiZmlsZW5hbWVfcHJlZml4IjogIkNvbWZ5VUkiLCAiaW1hZ2VzIjogWyI4IiwgMF19LCAiY2xhc3NfdHlwZSI6ICJTYXZlSW1hZ2UiLCAiX21ldGEiOiB7InRpdGxlIj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MCI6IHsiaW5wdXRzIjogeyJ2YWVfbmFtZSI6ICJhZS5zYWZldGVuc29ycyJ9LCAiY2xhc3NfdHlwZSI6ICJWQUVMb2FkZXIiLCAiX21ldGEiOiB7InRpdGxlIjogIkxvYWQgVkFFIn19LCAi\"}]}",
75637563
"status": 200,
75647564
"statusText": "OK",
75657565
"headers": {

0 commit comments

Comments
 (0)