Socket
Socket
Sign inDemoInstall

openai

Package Overview
Dependencies
Maintainers
5
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openai - npm Package Compare versions

Comparing version 4.41.0 to 4.41.1

8

CHANGELOG.md
# Changelog
## 4.41.1 (2024-05-06)
Full Changelog: [v4.41.0...v4.41.1](https://github.com/openai/openai-node/compare/v4.41.0...v4.41.1)
### Bug Fixes
* **azure:** update build script ([#825](https://github.com/openai/openai-node/issues/825)) ([8afc6e7](https://github.com/openai/openai-node/commit/8afc6e7b49507b3be0228e93913d51b4c3211add))
## 4.41.0 (2024-05-05)

@@ -4,0 +12,0 @@

3

index.d.ts

@@ -231,3 +231,3 @@ import * as Core from "./core.js";

*/
azureADTokenProvider?: (() => string) | undefined;
azureADTokenProvider?: (() => Promise<string>) | undefined;
}

@@ -263,4 +263,5 @@ /** API Client for interfacing with the Azure OpenAI API. */

protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
protected prepareOptions(opts: Core.FinalRequestOptions<unknown>): Promise<void>;
}
export default OpenAI;
//# sourceMappingURL=index.d.ts.map

@@ -219,5 +219,5 @@ "use strict";

}
_getAzureADToken() {
async _getAzureADToken() {
if (typeof this._azureADTokenProvider === 'function') {
const token = this._azureADTokenProvider();
const token = await this._azureADTokenProvider();
if (!token || typeof token !== 'string') {

@@ -231,13 +231,20 @@ throw new Errors.OpenAIError(`Expected 'azureADTokenProvider' argument to return a string but it returned ${token}`);

authHeaders(opts) {
return {};
}
async prepareOptions(opts) {
if (opts.headers?.['Authorization'] || opts.headers?.['api-key']) {
return {};
return super.prepareOptions(opts);
}
const token = this._getAzureADToken();
const token = await this._getAzureADToken();
opts.headers ?? (opts.headers = {});
if (token) {
return { Authorization: `Bearer ${token}` };
opts.headers['Authorization'] = `Bearer ${token}`;
}
if (this.apiKey !== API_KEY_SENTINEL) {
return { 'api-key': this.apiKey };
else if (this.apiKey !== API_KEY_SENTINEL) {
opts.headers['api-key'] = this.apiKey;
}
throw new Errors.OpenAIError('Unable to handle auth');
else {
throw new Errors.OpenAIError('Unable to handle auth');
}
return super.prepareOptions(opts);
}

@@ -258,3 +265,4 @@ }

exports = module.exports = OpenAI;
module.exports.AzureOpenAI = AzureOpenAI;
exports.default = OpenAI;
//# sourceMappingURL=index.js.map
{
"name": "openai",
"version": "4.41.0",
"version": "4.41.1",
"description": "The official TypeScript library for the OpenAI API",

@@ -5,0 +5,0 @@ "author": "OpenAI <support@openai.com>",

@@ -22,3 +22,3 @@ # OpenAI Node API Library

```ts
import OpenAI from 'https://deno.land/x/openai@v4.41.0/mod.ts';
import OpenAI from 'https://deno.land/x/openai@v4.41.1/mod.ts';
```

@@ -25,0 +25,0 @@

@@ -342,3 +342,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

*/
azureADTokenProvider?: (() => string) | undefined;
azureADTokenProvider?: (() => Promise<string>) | undefined;
}

@@ -348,3 +348,3 @@

export class AzureOpenAI extends OpenAI {
private _azureADTokenProvider: (() => string) | undefined;
private _azureADTokenProvider: (() => Promise<string>) | undefined;
apiVersion: string = '';

@@ -456,5 +456,5 @@ /**

private _getAzureADToken(): string | undefined {
private async _getAzureADToken(): Promise<string | undefined> {
if (typeof this._azureADTokenProvider === 'function') {
const token = this._azureADTokenProvider();
const token = await this._azureADTokenProvider();
if (!token || typeof token !== 'string') {

@@ -471,13 +471,19 @@ throw new Errors.OpenAIError(

protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
return {};
}
protected override async prepareOptions(opts: Core.FinalRequestOptions<unknown>): Promise<void> {
if (opts.headers?.['Authorization'] || opts.headers?.['api-key']) {
return {};
return super.prepareOptions(opts);
}
const token = this._getAzureADToken();
const token = await this._getAzureADToken();
opts.headers ??= {};
if (token) {
return { Authorization: `Bearer ${token}` };
opts.headers['Authorization'] = `Bearer ${token}`;
} else if (this.apiKey !== API_KEY_SENTINEL) {
opts.headers['api-key'] = this.apiKey;
} else {
throw new Errors.OpenAIError('Unable to handle auth');
}
if (this.apiKey !== API_KEY_SENTINEL) {
return { 'api-key': this.apiKey };
}
throw new Errors.OpenAIError('Unable to handle auth');
return super.prepareOptions(opts);
}

@@ -484,0 +490,0 @@ }

@@ -1,1 +0,1 @@

export const VERSION = '4.41.0'; // x-release-please-version
export const VERSION = '4.41.1'; // x-release-please-version

@@ -1,2 +0,2 @@

export declare const VERSION = "4.41.0";
export declare const VERSION = "4.41.1";
//# sourceMappingURL=version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
exports.VERSION = '4.41.0'; // x-release-please-version
exports.VERSION = '4.41.1'; // x-release-please-version
//# sourceMappingURL=version.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc