| 65 | stream?: Stream |
| 66 | ): Promise<ModelRunOutput<Stream>>; |
| 67 | async run<Stream extends boolean = false>( |
| 68 | input?: any, |
| 69 | params?: Inference | Stream, |
| 70 | stream?: Stream |
| 71 | ) { |
| 72 | const postBody: RequestBody = { |
| 73 | params: |
| 74 | typeof params === "boolean" || params === undefined ? undefined : params |
| 75 | }; |
| 76 | |
| 77 | await this.#ready; |
| 78 | |
| 79 | if (params === true || stream === true) { |
| 80 | if (this.#isGeneratingMedia) { |
| 81 | postBody.json = false; |
| 82 | } else { |
| 83 | postBody.stream = true; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | postBody["input"] = input; |
| 88 | |
| 89 | return this.#client.request(this.id, "POST", postBody, this.#providerKey); |
| 90 | } |
| 91 | } |