@langchain/openai 0.3.17 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,9 +5,10 @@ import { chunkArray } from "@langchain/core/utils/chunk_array";
5
5
  import { getEndpoint } from "./utils/azure.js";
6
6
  import { wrapOpenAIClientError } from "./utils/openai.js";
7
7
  /**
8
- * Class for generating embeddings using the OpenAI API. Extends the
9
- * Embeddings class and implements OpenAIEmbeddingsParams and
10
- * AzureOpenAIInput.
8
+ * Class for generating embeddings using the OpenAI API.
9
+ *
10
+ * To use with Azure, import the `AzureOpenAIEmbeddings` class.
11
+ *
11
12
  * @example
12
13
  * ```typescript
13
14
  * // Embed a query using OpenAIEmbeddings to generate embeddings for a given text
@@ -20,20 +21,21 @@ import { wrapOpenAIClientError } from "./utils/openai.js";
20
21
  * ```
21
22
  */
22
23
  export class OpenAIEmbeddings extends Embeddings {
23
- constructor(fields, configuration) {
24
+ constructor(fields) {
24
25
  const fieldsWithDefaults = { maxConcurrency: 2, ...fields };
25
26
  super(fieldsWithDefaults);
26
- Object.defineProperty(this, "modelName", {
27
+ Object.defineProperty(this, "model", {
27
28
  enumerable: true,
28
29
  configurable: true,
29
30
  writable: true,
30
31
  value: "text-embedding-ada-002"
31
32
  });
32
- Object.defineProperty(this, "model", {
33
+ /** @deprecated Use "model" instead */
34
+ Object.defineProperty(this, "modelName", {
33
35
  enumerable: true,
34
36
  configurable: true,
35
37
  writable: true,
36
- value: "text-embedding-ada-002"
38
+ value: void 0
37
39
  });
38
40
  Object.defineProperty(this, "batchSize", {
39
41
  enumerable: true,
@@ -64,42 +66,6 @@ export class OpenAIEmbeddings extends Embeddings {
64
66
  writable: true,
65
67
  value: void 0
66
68
  });
67
- Object.defineProperty(this, "azureOpenAIApiVersion", {
68
- enumerable: true,
69
- configurable: true,
70
- writable: true,
71
- value: void 0
72
- });
73
- Object.defineProperty(this, "azureOpenAIApiKey", {
74
- enumerable: true,
75
- configurable: true,
76
- writable: true,
77
- value: void 0
78
- });
79
- Object.defineProperty(this, "azureADTokenProvider", {
80
- enumerable: true,
81
- configurable: true,
82
- writable: true,
83
- value: void 0
84
- });
85
- Object.defineProperty(this, "azureOpenAIApiInstanceName", {
86
- enumerable: true,
87
- configurable: true,
88
- writable: true,
89
- value: void 0
90
- });
91
- Object.defineProperty(this, "azureOpenAIApiDeploymentName", {
92
- enumerable: true,
93
- configurable: true,
94
- writable: true,
95
- value: void 0
96
- });
97
- Object.defineProperty(this, "azureOpenAIBasePath", {
98
- enumerable: true,
99
- configurable: true,
100
- writable: true,
101
- value: void 0
102
- });
103
69
  Object.defineProperty(this, "organization", {
104
70
  enumerable: true,
105
71
  configurable: true,
@@ -118,62 +84,24 @@ export class OpenAIEmbeddings extends Embeddings {
118
84
  writable: true,
119
85
  value: void 0
120
86
  });
121
- let apiKey = fieldsWithDefaults?.apiKey ??
87
+ const apiKey = fieldsWithDefaults?.apiKey ??
122
88
  fieldsWithDefaults?.openAIApiKey ??
123
89
  getEnvironmentVariable("OPENAI_API_KEY");
124
- const azureApiKey = fieldsWithDefaults?.azureOpenAIApiKey ??
125
- getEnvironmentVariable("AZURE_OPENAI_API_KEY");
126
- this.azureADTokenProvider = fields?.azureADTokenProvider ?? undefined;
127
- if (!azureApiKey && !apiKey && !this.azureADTokenProvider) {
128
- throw new Error("OpenAI or Azure OpenAI API key or Token Provider not found");
129
- }
130
- const azureApiInstanceName = fieldsWithDefaults?.azureOpenAIApiInstanceName ??
131
- getEnvironmentVariable("AZURE_OPENAI_API_INSTANCE_NAME");
132
- const azureApiDeploymentName = (fieldsWithDefaults?.azureOpenAIApiEmbeddingsDeploymentName ||
133
- fieldsWithDefaults?.azureOpenAIApiDeploymentName) ??
134
- (getEnvironmentVariable("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME") ||
135
- getEnvironmentVariable("AZURE_OPENAI_API_DEPLOYMENT_NAME"));
136
- const azureApiVersion = fieldsWithDefaults?.azureOpenAIApiVersion ??
137
- getEnvironmentVariable("AZURE_OPENAI_API_VERSION");
138
- this.azureOpenAIBasePath =
139
- fieldsWithDefaults?.azureOpenAIBasePath ??
140
- getEnvironmentVariable("AZURE_OPENAI_BASE_PATH");
141
90
  this.organization =
142
91
  fieldsWithDefaults?.configuration?.organization ??
143
92
  getEnvironmentVariable("OPENAI_ORGANIZATION");
144
- this.modelName =
93
+ this.model =
145
94
  fieldsWithDefaults?.model ?? fieldsWithDefaults?.modelName ?? this.model;
146
- this.model = this.modelName;
147
- this.batchSize =
148
- fieldsWithDefaults?.batchSize ?? (azureApiKey ? 1 : this.batchSize);
95
+ this.modelName = this.model;
96
+ this.batchSize = fieldsWithDefaults?.batchSize ?? this.batchSize;
149
97
  this.stripNewLines =
150
98
  fieldsWithDefaults?.stripNewLines ?? this.stripNewLines;
151
99
  this.timeout = fieldsWithDefaults?.timeout;
152
100
  this.dimensions = fieldsWithDefaults?.dimensions;
153
- this.azureOpenAIApiVersion = azureApiVersion;
154
- this.azureOpenAIApiKey = azureApiKey;
155
- this.azureOpenAIApiInstanceName = azureApiInstanceName;
156
- this.azureOpenAIApiDeploymentName = azureApiDeploymentName;
157
- if (this.azureOpenAIApiKey || this.azureADTokenProvider) {
158
- if (!this.azureOpenAIApiInstanceName && !this.azureOpenAIBasePath) {
159
- throw new Error("Azure OpenAI API instance name not found");
160
- }
161
- if (!this.azureOpenAIApiDeploymentName) {
162
- throw new Error("Azure OpenAI API deployment name not found");
163
- }
164
- if (!this.azureOpenAIApiVersion) {
165
- throw new Error("Azure OpenAI API version not found");
166
- }
167
- apiKey = apiKey ?? "";
168
- }
169
101
  this.clientConfig = {
170
102
  apiKey,
171
103
  organization: this.organization,
172
- baseURL: configuration?.basePath,
173
104
  dangerouslyAllowBrowser: true,
174
- defaultHeaders: configuration?.baseOptions?.headers,
175
- defaultQuery: configuration?.baseOptions?.params,
176
- ...configuration,
177
105
  ...fields?.configuration,
178
106
  };
179
107
  }
@@ -234,10 +162,6 @@ export class OpenAIEmbeddings extends Embeddings {
234
162
  async embeddingWithRetry(request) {
235
163
  if (!this.client) {
236
164
  const openAIEndpointConfig = {
237
- azureOpenAIApiDeploymentName: this.azureOpenAIApiDeploymentName,
238
- azureOpenAIApiInstanceName: this.azureOpenAIApiInstanceName,
239
- azureOpenAIApiKey: this.azureOpenAIApiKey,
240
- azureOpenAIBasePath: this.azureOpenAIBasePath,
241
165
  baseURL: this.clientConfig.baseURL,
242
166
  };
243
167
  const endpoint = getEndpoint(openAIEndpointConfig);
@@ -253,16 +177,6 @@ export class OpenAIEmbeddings extends Embeddings {
253
177
  this.client = new OpenAIClient(params);
254
178
  }
255
179
  const requestOptions = {};
256
- if (this.azureOpenAIApiKey) {
257
- requestOptions.headers = {
258
- "api-key": this.azureOpenAIApiKey,
259
- ...requestOptions.headers,
260
- };
261
- requestOptions.query = {
262
- "api-version": this.azureOpenAIApiVersion,
263
- ...requestOptions.query,
264
- };
265
- }
266
180
  return this.caller.call(async () => {
267
181
  try {
268
182
  const res = await this.client.embeddings.create(request, requestOptions);
package/dist/llms.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OpenAI = exports.OpenAIChat = void 0;
3
+ exports.OpenAI = void 0;
4
4
  const openai_1 = require("openai");
5
5
  const base_1 = require("@langchain/core/language_models/base");
6
6
  const outputs_1 = require("@langchain/core/outputs");
@@ -8,8 +8,6 @@ const env_1 = require("@langchain/core/utils/env");
8
8
  const llms_1 = require("@langchain/core/language_models/llms");
9
9
  const chunk_array_1 = require("@langchain/core/utils/chunk_array");
10
10
  const azure_js_1 = require("./utils/azure.cjs");
11
- const legacy_js_1 = require("./legacy.cjs");
12
- Object.defineProperty(exports, "OpenAIChat", { enumerable: true, get: function () { return legacy_js_1.OpenAIChat; } });
13
11
  const openai_js_1 = require("./utils/openai.cjs");
14
12
  /**
15
13
  * Wrapper around OpenAI large language models.
@@ -17,11 +15,7 @@ const openai_js_1 = require("./utils/openai.cjs");
17
15
  * To use you should have the `openai` package installed, with the
18
16
  * `OPENAI_API_KEY` environment variable set.
19
17
  *
20
- * To use with Azure you should have the `openai` package installed, with the
21
- * `AZURE_OPENAI_API_KEY`,
22
- * `AZURE_OPENAI_API_INSTANCE_NAME`,
23
- * `AZURE_OPENAI_API_DEPLOYMENT_NAME`
24
- * and `AZURE_OPENAI_API_VERSION` environment variable set.
18
+ * To use with Azure, import the `AzureOpenAI` class.
25
19
  *
26
20
  * @remarks
27
21
  * Any parameters that are valid to be passed to {@link
@@ -54,7 +48,6 @@ class OpenAI extends llms_1.BaseLLM {
54
48
  return {
55
49
  openAIApiKey: "OPENAI_API_KEY",
56
50
  apiKey: "OPENAI_API_KEY",
57
- azureOpenAIApiKey: "AZURE_OPENAI_API_KEY",
58
51
  organization: "OPENAI_ORGANIZATION",
59
52
  };
60
53
  }
@@ -63,30 +56,9 @@ class OpenAI extends llms_1.BaseLLM {
63
56
  modelName: "model",
64
57
  openAIApiKey: "openai_api_key",
65
58
  apiKey: "openai_api_key",
66
- azureOpenAIApiVersion: "azure_openai_api_version",
67
- azureOpenAIApiKey: "azure_openai_api_key",
68
- azureOpenAIApiInstanceName: "azure_openai_api_instance_name",
69
- azureOpenAIApiDeploymentName: "azure_openai_api_deployment_name",
70
59
  };
71
60
  }
72
- constructor(fields,
73
- /** @deprecated */
74
- configuration) {
75
- let model = fields?.model ?? fields?.modelName;
76
- if ((model?.startsWith("gpt-3.5-turbo") || model?.startsWith("gpt-4")) &&
77
- !model?.includes("-instruct")) {
78
- console.warn([
79
- `Your chosen OpenAI model, "${model}", is a chat model and not a text-in/text-out LLM.`,
80
- `Passing it into the "OpenAI" class is deprecated and only permitted for backwards-compatibility. You may experience odd behavior.`,
81
- `Please use the "ChatOpenAI" class instead.`,
82
- "",
83
- `See this page for more information:`,
84
- "|",
85
- `└> https://js.langchain.com/docs/integrations/chat/openai`,
86
- ].join("\n"));
87
- // eslint-disable-next-line no-constructor-return
88
- return new legacy_js_1.OpenAIChat(fields, configuration);
89
- }
61
+ constructor(fields) {
90
62
  super(fields ?? {});
91
63
  Object.defineProperty(this, "lc_serializable", {
92
64
  enumerable: true,
@@ -98,31 +70,31 @@ class OpenAI extends llms_1.BaseLLM {
98
70
  enumerable: true,
99
71
  configurable: true,
100
72
  writable: true,
101
- value: 0.7
73
+ value: void 0
102
74
  });
103
75
  Object.defineProperty(this, "maxTokens", {
104
76
  enumerable: true,
105
77
  configurable: true,
106
78
  writable: true,
107
- value: 256
79
+ value: void 0
108
80
  });
109
81
  Object.defineProperty(this, "topP", {
110
82
  enumerable: true,
111
83
  configurable: true,
112
84
  writable: true,
113
- value: 1
85
+ value: void 0
114
86
  });
115
87
  Object.defineProperty(this, "frequencyPenalty", {
116
88
  enumerable: true,
117
89
  configurable: true,
118
90
  writable: true,
119
- value: 0
91
+ value: void 0
120
92
  });
121
93
  Object.defineProperty(this, "presencePenalty", {
122
94
  enumerable: true,
123
95
  configurable: true,
124
96
  writable: true,
125
- value: 0
97
+ value: void 0
126
98
  });
127
99
  Object.defineProperty(this, "n", {
128
100
  enumerable: true,
@@ -142,17 +114,18 @@ class OpenAI extends llms_1.BaseLLM {
142
114
  writable: true,
143
115
  value: void 0
144
116
  });
145
- Object.defineProperty(this, "modelName", {
117
+ Object.defineProperty(this, "model", {
146
118
  enumerable: true,
147
119
  configurable: true,
148
120
  writable: true,
149
121
  value: "gpt-3.5-turbo-instruct"
150
122
  });
151
- Object.defineProperty(this, "model", {
123
+ /** @deprecated Use "model" instead */
124
+ Object.defineProperty(this, "modelName", {
152
125
  enumerable: true,
153
126
  configurable: true,
154
127
  writable: true,
155
- value: "gpt-3.5-turbo-instruct"
128
+ value: void 0
156
129
  });
157
130
  Object.defineProperty(this, "modelKwargs", {
158
131
  enumerable: true,
@@ -208,42 +181,6 @@ class OpenAI extends llms_1.BaseLLM {
208
181
  writable: true,
209
182
  value: void 0
210
183
  });
211
- Object.defineProperty(this, "azureOpenAIApiVersion", {
212
- enumerable: true,
213
- configurable: true,
214
- writable: true,
215
- value: void 0
216
- });
217
- Object.defineProperty(this, "azureOpenAIApiKey", {
218
- enumerable: true,
219
- configurable: true,
220
- writable: true,
221
- value: void 0
222
- });
223
- Object.defineProperty(this, "azureADTokenProvider", {
224
- enumerable: true,
225
- configurable: true,
226
- writable: true,
227
- value: void 0
228
- });
229
- Object.defineProperty(this, "azureOpenAIApiInstanceName", {
230
- enumerable: true,
231
- configurable: true,
232
- writable: true,
233
- value: void 0
234
- });
235
- Object.defineProperty(this, "azureOpenAIApiDeploymentName", {
236
- enumerable: true,
237
- configurable: true,
238
- writable: true,
239
- value: void 0
240
- });
241
- Object.defineProperty(this, "azureOpenAIBasePath", {
242
- enumerable: true,
243
- configurable: true,
244
- writable: true,
245
- value: void 0
246
- });
247
184
  Object.defineProperty(this, "organization", {
248
185
  enumerable: true,
249
186
  configurable: true,
@@ -262,38 +199,30 @@ class OpenAI extends llms_1.BaseLLM {
262
199
  writable: true,
263
200
  value: void 0
264
201
  });
265
- model = model ?? this.model;
266
202
  this.openAIApiKey =
267
203
  fields?.apiKey ??
268
204
  fields?.openAIApiKey ??
269
205
  (0, env_1.getEnvironmentVariable)("OPENAI_API_KEY");
270
206
  this.apiKey = this.openAIApiKey;
271
- this.azureOpenAIApiKey =
272
- fields?.azureOpenAIApiKey ??
273
- (0, env_1.getEnvironmentVariable)("AZURE_OPENAI_API_KEY");
274
- this.azureADTokenProvider = fields?.azureADTokenProvider ?? undefined;
275
- if (!this.azureOpenAIApiKey && !this.apiKey && !this.azureADTokenProvider) {
276
- throw new Error("OpenAI or Azure OpenAI API key or Token Provider not found");
277
- }
278
- this.azureOpenAIApiInstanceName =
279
- fields?.azureOpenAIApiInstanceName ??
280
- (0, env_1.getEnvironmentVariable)("AZURE_OPENAI_API_INSTANCE_NAME");
281
- this.azureOpenAIApiDeploymentName =
282
- (fields?.azureOpenAIApiCompletionsDeploymentName ||
283
- fields?.azureOpenAIApiDeploymentName) ??
284
- ((0, env_1.getEnvironmentVariable)("AZURE_OPENAI_API_COMPLETIONS_DEPLOYMENT_NAME") ||
285
- (0, env_1.getEnvironmentVariable)("AZURE_OPENAI_API_DEPLOYMENT_NAME"));
286
- this.azureOpenAIApiVersion =
287
- fields?.azureOpenAIApiVersion ??
288
- (0, env_1.getEnvironmentVariable)("AZURE_OPENAI_API_VERSION");
289
- this.azureOpenAIBasePath =
290
- fields?.azureOpenAIBasePath ??
291
- (0, env_1.getEnvironmentVariable)("AZURE_OPENAI_BASE_PATH");
292
207
  this.organization =
293
208
  fields?.configuration?.organization ??
294
209
  (0, env_1.getEnvironmentVariable)("OPENAI_ORGANIZATION");
295
- this.modelName = model;
296
- this.model = model;
210
+ this.model = fields?.model ?? fields?.modelName ?? this.model;
211
+ if ((this.model?.startsWith("gpt-3.5-turbo") ||
212
+ this.model?.startsWith("gpt-4") ||
213
+ this.model?.startsWith("o1")) &&
214
+ !this.model?.includes("-instruct")) {
215
+ throw new Error([
216
+ `Your chosen OpenAI model, "${this.model}", is a chat model and not a text-in/text-out LLM.`,
217
+ `Passing it into the "OpenAI" class is no longer supported.`,
218
+ `Please use the "ChatOpenAI" class instead.`,
219
+ "",
220
+ `See this page for more information:`,
221
+ "|",
222
+ `└> https://js.langchain.com/docs/integrations/chat/openai`,
223
+ ].join("\n"));
224
+ }
225
+ this.modelName = this.model;
297
226
  this.modelKwargs = fields?.modelKwargs ?? {};
298
227
  this.batchSize = fields?.batchSize ?? this.batchSize;
299
228
  this.timeout = fields?.timeout;
@@ -312,28 +241,10 @@ class OpenAI extends llms_1.BaseLLM {
312
241
  if (this.streaming && this.bestOf && this.bestOf > 1) {
313
242
  throw new Error("Cannot stream results when bestOf > 1");
314
243
  }
315
- if (this.azureOpenAIApiKey || this.azureADTokenProvider) {
316
- if (!this.azureOpenAIApiInstanceName && !this.azureOpenAIBasePath) {
317
- throw new Error("Azure OpenAI API instance name not found");
318
- }
319
- if (!this.azureOpenAIApiDeploymentName) {
320
- throw new Error("Azure OpenAI API deployment name not found");
321
- }
322
- if (!this.azureOpenAIApiVersion) {
323
- throw new Error("Azure OpenAI API version not found");
324
- }
325
- this.apiKey = this.apiKey ?? "";
326
- }
327
244
  this.clientConfig = {
328
245
  apiKey: this.apiKey,
329
246
  organization: this.organization,
330
- baseURL: configuration?.basePath ?? fields?.configuration?.basePath,
331
247
  dangerouslyAllowBrowser: true,
332
- defaultHeaders: configuration?.baseOptions?.headers ??
333
- fields?.configuration?.baseOptions?.headers,
334
- defaultQuery: configuration?.baseOptions?.params ??
335
- fields?.configuration?.baseOptions?.params,
336
- ...configuration,
337
248
  ...fields?.configuration,
338
249
  };
339
250
  }
@@ -532,10 +443,6 @@ class OpenAI extends llms_1.BaseLLM {
532
443
  _getClientOptions(options) {
533
444
  if (!this.client) {
534
445
  const openAIEndpointConfig = {
535
- azureOpenAIApiDeploymentName: this.azureOpenAIApiDeploymentName,
536
- azureOpenAIApiInstanceName: this.azureOpenAIApiInstanceName,
537
- azureOpenAIApiKey: this.azureOpenAIApiKey,
538
- azureOpenAIBasePath: this.azureOpenAIBasePath,
539
446
  baseURL: this.clientConfig.baseURL,
540
447
  };
541
448
  const endpoint = (0, azure_js_1.getEndpoint)(openAIEndpointConfig);
@@ -554,16 +461,6 @@ class OpenAI extends llms_1.BaseLLM {
554
461
  ...this.clientConfig,
555
462
  ...options,
556
463
  };
557
- if (this.azureOpenAIApiKey) {
558
- requestOptions.headers = {
559
- "api-key": this.azureOpenAIApiKey,
560
- ...requestOptions.headers,
561
- };
562
- requestOptions.query = {
563
- "api-version": this.azureOpenAIApiVersion,
564
- ...requestOptions.query,
565
- };
566
- }
567
464
  return requestOptions;
568
465
  }
569
466
  _llmType() {
package/dist/llms.d.ts CHANGED
@@ -2,21 +2,15 @@ import { type ClientOptions, OpenAI as OpenAIClient } from "openai";
2
2
  import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
3
3
  import { GenerationChunk, type LLMResult } from "@langchain/core/outputs";
4
4
  import { BaseLLM, type BaseLLMParams } from "@langchain/core/language_models/llms";
5
- import type { AzureOpenAIInput, OpenAICallOptions, OpenAICoreRequestOptions, OpenAIInput, LegacyOpenAIInput } from "./types.js";
6
- import { OpenAIChat, OpenAIChatCallOptions } from "./legacy.js";
7
- export type { AzureOpenAIInput, OpenAICallOptions, OpenAIInput, OpenAIChatCallOptions, };
8
- export { OpenAIChat };
5
+ import type { OpenAICallOptions, OpenAICoreRequestOptions, OpenAIInput } from "./types.js";
6
+ export type { OpenAICallOptions, OpenAIInput };
9
7
  /**
10
8
  * Wrapper around OpenAI large language models.
11
9
  *
12
10
  * To use you should have the `openai` package installed, with the
13
11
  * `OPENAI_API_KEY` environment variable set.
14
12
  *
15
- * To use with Azure you should have the `openai` package installed, with the
16
- * `AZURE_OPENAI_API_KEY`,
17
- * `AZURE_OPENAI_API_INSTANCE_NAME`,
18
- * `AZURE_OPENAI_API_DEPLOYMENT_NAME`
19
- * and `AZURE_OPENAI_API_VERSION` environment variable set.
13
+ * To use with Azure, import the `AzureOpenAI` class.
20
14
  *
21
15
  * @remarks
22
16
  * Any parameters that are valid to be passed to {@link
@@ -38,7 +32,7 @@ export { OpenAIChat };
38
32
  * console.log({ res });
39
33
  * ```
40
34
  */
41
- export declare class OpenAI<CallOptions extends OpenAICallOptions = OpenAICallOptions> extends BaseLLM<CallOptions> implements OpenAIInput, AzureOpenAIInput {
35
+ export declare class OpenAI<CallOptions extends OpenAICallOptions = OpenAICallOptions> extends BaseLLM<CallOptions> implements Partial<OpenAIInput> {
42
36
  static lc_name(): string;
43
37
  get callKeys(): string[];
44
38
  lc_serializable: boolean;
@@ -46,16 +40,17 @@ export declare class OpenAI<CallOptions extends OpenAICallOptions = OpenAICallOp
46
40
  [key: string]: string;
47
41
  } | undefined;
48
42
  get lc_aliases(): Record<string, string>;
49
- temperature: number;
50
- maxTokens: number;
51
- topP: number;
52
- frequencyPenalty: number;
53
- presencePenalty: number;
43
+ temperature?: number;
44
+ maxTokens?: number;
45
+ topP?: number;
46
+ frequencyPenalty?: number;
47
+ presencePenalty?: number;
54
48
  n: number;
55
49
  bestOf?: number;
56
50
  logitBias?: Record<string, number>;
57
- modelName: string;
58
51
  model: string;
52
+ /** @deprecated Use "model" instead */
53
+ modelName: string;
59
54
  modelKwargs?: OpenAIInput["modelKwargs"];
60
55
  batchSize: number;
61
56
  timeout?: number;
@@ -65,20 +60,12 @@ export declare class OpenAI<CallOptions extends OpenAICallOptions = OpenAICallOp
65
60
  streaming: boolean;
66
61
  openAIApiKey?: string;
67
62
  apiKey?: string;
68
- azureOpenAIApiVersion?: string;
69
- azureOpenAIApiKey?: string;
70
- azureADTokenProvider?: () => Promise<string>;
71
- azureOpenAIApiInstanceName?: string;
72
- azureOpenAIApiDeploymentName?: string;
73
- azureOpenAIBasePath?: string;
74
63
  organization?: string;
75
64
  protected client: OpenAIClient;
76
65
  protected clientConfig: ClientOptions;
77
- constructor(fields?: Partial<OpenAIInput> & Partial<AzureOpenAIInput> & BaseLLMParams & {
78
- configuration?: ClientOptions & LegacyOpenAIInput;
79
- },
80
- /** @deprecated */
81
- configuration?: ClientOptions & LegacyOpenAIInput);
66
+ constructor(fields?: Partial<OpenAIInput> & BaseLLMParams & {
67
+ configuration?: ClientOptions;
68
+ });
82
69
  /**
83
70
  * Get the parameters used to invoke the model
84
71
  */