diff --git a/src/resources/beta/chat/completions.ts b/src/resources/beta/chat/completions.ts index 96c4118bf..113de4026 100644 --- a/src/resources/beta/chat/completions.ts +++ b/src/resources/beta/chat/completions.ts @@ -59,21 +59,21 @@ export interface ParsedChatCompletion extends ChatCompletion { export type ChatCompletionParseParams = ChatCompletionCreateParamsNonStreaming; export class Completions extends APIResource { - async parse>( + parse>( body: Params, options?: Core.RequestOptions, - ): Promise> { + ): Core.APIPromise> { validateInputTools(body.tools); - const completion = await this._client.chat.completions.create(body, { - ...options, - headers: { - ...options?.headers, - 'X-Stainless-Helper-Method': 'beta.chat.completions.parse', - }, - }); - - return parseChatCompletion(completion, body); + return this._client.chat.completions + .create(body, { + ...options, + headers: { + ...options?.headers, + 'X-Stainless-Helper-Method': 'beta.chat.completions.parse', + }, + }) + ._thenUnwrap((completion) => parseChatCompletion(completion, body)); } /**