MCPcopy Create free account
hub / github.com/Bytez-com/docs / constructor

Method constructor

sdk/javascript/src/model.ts:10–30  ·  view source on GitHub ↗
(
    modelId: string,
    bytez: Bytez,
    client: Client,
    providerKey?: string
  )

Source from the content-addressed store, hash-verified

8
9export default class Model {
10 constructor(
11 modelId: string,
12 bytez: Bytez,
13 client: Client,
14 providerKey?: string
15 ) {
16 this.#client = client;
17 this.id = modelId;
18 this.#providerKey = providerKey;
19 this.#ready = bytez.list.models({ modelId }).then((response: Response) => {
20 const mediaGenerators = [
21 "text-to-audio",
22 "text-to-image",
23 "text-to-video",
24 "text-to-speech"
25 ];
26
27 this.details = response?.output?.[0] ?? {};
28 this.#isGeneratingMedia = mediaGenerators.includes(this.details.task);
29 });
30 }
31 #client: Client;
32 #ready: Promise<void>;
33 #isGeneratingMedia = false;

Callers

nothing calls this directly

Calls 1

modelsMethod · 0.80

Tested by

no test coverage detected