From 04b88383c81cad76847b3d8fe8cbed384221e5cd Mon Sep 17 00:00:00 2001 From: Angelos Petropoulos Date: Wed, 11 Sep 2024 05:11:32 -0500 Subject: [PATCH 1/4] docs(azure): example for custom base URL (#1055) Co-authored-by: Angelos Petropoulos --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index c0e527d25..36064286d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -381,7 +381,7 @@ export class AzureOpenAI extends OpenAI { * @param {string | undefined} [opts.apiKey=process.env['AZURE_OPENAI_API_KEY'] ?? undefined] * @param {string | undefined} opts.deployment - A model deployment, if given, sets the base client URL to include `/deployments/{deployment}`. * @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null] - * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL']] - Sets the base URL for the API. + * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL']] - Sets the base URL for the API, e.g. `https://example-resource.azure.openai.com/openai/`. * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections. * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. From fc549fc033ee3dc5fbb678ea8969a2160336746e Mon Sep 17 00:00:00 2001 From: Scott Addie <10702007+scottaddie@users.noreply.github.com> Date: Wed, 11 Sep 2024 05:12:33 -0500 Subject: [PATCH 2/4] docs(azure): remove locale from docs link (#1054) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8415ed186..31a7776d6 100644 --- a/README.md +++ b/README.md @@ -363,7 +363,7 @@ Error codes are as followed: ## Microsoft Azure OpenAI -To use this library with [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview), use the `AzureOpenAI` +To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI` class instead of the `OpenAI` class. > [!IMPORTANT] From d9dee78c7052649131b3897243366a9b58d9616e Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 11 Sep 2024 11:14:17 +0100 Subject: [PATCH 3/4] feat(structured outputs): support accessing raw responses (#1058) --- src/resources/beta/chat/completions.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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)); } /** From 8958d9711b66e0cbacf816b7b4538217016beb0b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:14:38 +0000 Subject: [PATCH 4/4] release: 4.59.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ README.md | 2 +- package.json | 2 +- scripts/build-deno | 2 +- src/version.ts | 2 +- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c740afe14..99d650398 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.58.2" + ".": "4.59.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 468be63b2..a245938c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.59.0 (2024-09-11) + +Full Changelog: [v4.58.2...v4.59.0](https://github.com/openai/openai-node/compare/v4.58.2...v4.59.0) + +### Features + +* **structured outputs:** support accessing raw responses ([#1058](https://github.com/openai/openai-node/issues/1058)) ([af17697](https://github.com/openai/openai-node/commit/af176979894ee95a51e09abc239a8fd3a639dcde)) + + +### Documentation + +* **azure:** example for custom base URL ([#1055](https://github.com/openai/openai-node/issues/1055)) ([20defc8](https://github.com/openai/openai-node/commit/20defc80801e1f1f489a07bd1264be71c56c586f)) +* **azure:** remove locale from docs link ([#1054](https://github.com/openai/openai-node/issues/1054)) ([f9b7eac](https://github.com/openai/openai-node/commit/f9b7eac58020cff0e367a15b9a2ca4e7c95cbb89)) + ## 4.58.2 (2024-09-09) Full Changelog: [v4.58.1...v4.58.2](https://github.com/openai/openai-node/compare/v4.58.1...v4.58.2) diff --git a/README.md b/README.md index 31a7776d6..11e3216f1 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ You can import in Deno via: ```ts -import OpenAI from 'https://deno.land/x/openai@v4.58.2/mod.ts'; +import OpenAI from 'https://deno.land/x/openai@v4.59.0/mod.ts'; ``` diff --git a/package.json b/package.json index b284c38a6..c3147af52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.58.2", + "version": "4.59.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/build-deno b/scripts/build-deno index ef3867dc2..32ac4ce7f 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -16,7 +16,7 @@ This is a build produced from https://github.com/openai/openai-node – please g Usage: \`\`\`ts -import OpenAI from "https://deno.land/x/openai@v4.58.2/mod.ts"; +import OpenAI from "https://deno.land/x/openai@v4.59.0/mod.ts"; const client = new OpenAI(); \`\`\` diff --git a/src/version.ts b/src/version.ts index f650f76c3..22b9a14fc 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.58.2'; // x-release-please-version +export const VERSION = '4.59.0'; // x-release-please-version