New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/openai

Package Overview
Dependencies
Maintainers
2
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/openai - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

30

./dist/index.js

@@ -302,5 +302,4 @@ "use strict";

stream: true,
stream_options: {
include_usage: true
}
// only include stream_options when in strict compatibility mode:
stream_options: this.config.compatibility === "strict" ? { include_usage: true } : void 0
},

@@ -734,5 +733,4 @@ failedResponseHandler: openaiFailedResponseHandler,

stream: true,
stream_options: {
include_usage: true
}
// only include stream_options when in strict compatibility mode:
stream_options: this.config.compatibility === "strict" ? { include_usage: true } : void 0
},

@@ -871,3 +869,4 @@ failedResponseHandler: openaiFailedResponseHandler,

provider: "openai.chat",
...this.baseConfig
...this.baseConfig,
compatibility: "strict"
});

@@ -878,3 +877,4 @@ }

provider: "openai.completion",
...this.baseConfig
...this.baseConfig,
compatibility: "strict"
});

@@ -953,4 +953,5 @@ }

function createOpenAI(options = {}) {
var _a, _b;
var _a, _b, _c;
const baseURL = (_b = (0, import_provider_utils7.withoutTrailingSlash)((_a = options.baseURL) != null ? _a : options.baseUrl)) != null ? _b : "https://api.openai.com/v1";
const compatibility = (_c = options.compatibility) != null ? _c : "compatible";
const getHeaders = () => ({

@@ -969,3 +970,4 @@ Authorization: `Bearer ${(0, import_provider_utils7.loadApiKey)({

baseURL,
headers: getHeaders
headers: getHeaders,
compatibility
});

@@ -975,3 +977,4 @@ const createCompletionModel = (modelId, settings = {}) => new OpenAICompletionLanguageModel(modelId, settings, {

baseURL,
headers: getHeaders
headers: getHeaders,
compatibility
});

@@ -1002,3 +1005,6 @@ const createEmbeddingModel = (modelId, settings = {}) => new OpenAIEmbeddingModel(modelId, settings, {

}
var openai = createOpenAI();
var openai = createOpenAI({
compatibility: "strict"
// strict for OpenAI API
});
// Annotate the CommonJS export names for ESM import in node:

@@ -1005,0 +1011,0 @@ 0 && (module.exports = {

10

dist/index.d.ts

@@ -42,2 +42,3 @@ import { LanguageModelV1, EmbeddingModelV1 } from '@ai-sdk/provider';

baseURL: string;
compatibility: 'strict' | 'compatible';
headers: () => Record<string, string | undefined>;

@@ -105,2 +106,3 @@ };

baseURL: string;
compatibility: 'strict' | 'compatible';
headers: () => Record<string, string | undefined>;

@@ -201,2 +203,8 @@ };

headers?: Record<string, string>;
/**
OpenAI compatibility mode. Should be set to `strict` when using the OpenAI API,
and `compatible` when using 3rd party providers. In `compatible` mode, newer
information such as streamOptions are not being sent. Defaults to 'compatible'.
*/
compatibility?: 'strict' | 'compatible';
}

@@ -208,3 +216,3 @@ /**

/**
Default OpenAI provider instance.
Default OpenAI provider instance. It uses 'strict' compatibility mode.
*/

@@ -211,0 +219,0 @@ declare const openai: OpenAIProvider;

@@ -302,5 +302,4 @@ "use strict";

stream: true,
stream_options: {
include_usage: true
}
// only include stream_options when in strict compatibility mode:
stream_options: this.config.compatibility === "strict" ? { include_usage: true } : void 0
},

@@ -734,5 +733,4 @@ failedResponseHandler: openaiFailedResponseHandler,

stream: true,
stream_options: {
include_usage: true
}
// only include stream_options when in strict compatibility mode:
stream_options: this.config.compatibility === "strict" ? { include_usage: true } : void 0
},

@@ -871,3 +869,4 @@ failedResponseHandler: openaiFailedResponseHandler,

provider: "openai.chat",
...this.baseConfig
...this.baseConfig,
compatibility: "strict"
});

@@ -878,3 +877,4 @@ }

provider: "openai.completion",
...this.baseConfig
...this.baseConfig,
compatibility: "strict"
});

@@ -953,4 +953,5 @@ }

function createOpenAI(options = {}) {
var _a, _b;
var _a, _b, _c;
const baseURL = (_b = (0, import_provider_utils7.withoutTrailingSlash)((_a = options.baseURL) != null ? _a : options.baseUrl)) != null ? _b : "https://api.openai.com/v1";
const compatibility = (_c = options.compatibility) != null ? _c : "compatible";
const getHeaders = () => ({

@@ -969,3 +970,4 @@ Authorization: `Bearer ${(0, import_provider_utils7.loadApiKey)({

baseURL,
headers: getHeaders
headers: getHeaders,
compatibility
});

@@ -975,3 +977,4 @@ const createCompletionModel = (modelId, settings = {}) => new OpenAICompletionLanguageModel(modelId, settings, {

baseURL,
headers: getHeaders
headers: getHeaders,
compatibility
});

@@ -1002,3 +1005,6 @@ const createEmbeddingModel = (modelId, settings = {}) => new OpenAIEmbeddingModel(modelId, settings, {

}
var openai = createOpenAI();
var openai = createOpenAI({
compatibility: "strict"
// strict for OpenAI API
});
// Annotate the CommonJS export names for ESM import in node:

@@ -1005,0 +1011,0 @@ 0 && (module.exports = {

{
"name": "@ai-sdk/openai",
"version": "0.0.12",
"version": "0.0.13",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

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