(client, params, options)
| 82440 | runner._run(() => runner._fromReadableStream(stream4)); |
| 82441 | return runner; |
| 82442 | } |
| 82443 | static createChatCompletion(client, params, options) { |
| 82444 | const runner = new _ChatCompletionStream(params); |
| 82445 | runner._run(() => runner._runChatCompletion(client, { ...params, stream: true }, { ...options, headers: { ...options?.headers, "X-Stainless-Helper-Method": "stream" } })); |
| 82446 | return runner; |
| 82447 | } |
| 82448 | async _createChatCompletion(client, params, options) { |
| 82449 | super._createChatCompletion; |
| 82450 | const signal = options?.signal; |
| 82451 | if (signal) { |
| 82452 | if (signal.aborted) |
| 82453 | this.controller.abort(); |
| 82454 | signal.addEventListener("abort", () => this.controller.abort()); |
| 82455 | } |
| 82456 | __classPrivateFieldGet11(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_beginRequest).call(this); |
| 82457 | const stream4 = await client.chat.completions.create({ ...params, stream: true }, { ...options, signal: this.controller.signal }); |
| 82458 | this._connected(); |
| 82459 | for await (const chunk of stream4) { |
| 82460 | __classPrivateFieldGet11(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_addChunk).call(this, chunk); |
| 82461 | } |
| 82462 | if (stream4.controller.signal?.aborted) { |
| 82463 | throw new APIUserAbortError3(); |
nothing calls this directly
no test coverage detected