langchain 0.0.142 → 0.0.143

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.
@@ -325,6 +325,7 @@ class ChatOpenAI extends base_js_1.BaseChatModel {
325
325
  if (!this.azureOpenAIApiVersion) {
326
326
  throw new Error("Azure OpenAI API version not found");
327
327
  }
328
+ this.openAIApiKey = this.openAIApiKey ?? "";
328
329
  }
329
330
  this.clientConfig = {
330
331
  apiKey: this.openAIApiKey,
@@ -322,6 +322,7 @@ export class ChatOpenAI extends BaseChatModel {
322
322
  if (!this.azureOpenAIApiVersion) {
323
323
  throw new Error("Azure OpenAI API version not found");
324
324
  }
325
+ this.openAIApiKey = this.openAIApiKey ?? "";
325
326
  }
326
327
  this.clientConfig = {
327
328
  apiKey: this.openAIApiKey,
@@ -82,7 +82,7 @@ class OpenAIEmbeddings extends base_js_1.Embeddings {
82
82
  writable: true,
83
83
  value: void 0
84
84
  });
85
- const apiKey = fieldsWithDefaults?.openAIApiKey ??
85
+ let apiKey = fieldsWithDefaults?.openAIApiKey ??
86
86
  (0, env_js_1.getEnvironmentVariable)("OPENAI_API_KEY");
87
87
  const azureApiKey = fieldsWithDefaults?.azureOpenAIApiKey ??
88
88
  (0, env_js_1.getEnvironmentVariable)("AZURE_OPENAI_API_KEY");
@@ -120,6 +120,7 @@ class OpenAIEmbeddings extends base_js_1.Embeddings {
120
120
  if (!this.azureOpenAIApiVersion) {
121
121
  throw new Error("Azure OpenAI API version not found");
122
122
  }
123
+ apiKey = apiKey ?? "";
123
124
  }
124
125
  this.clientConfig = {
125
126
  apiKey,
@@ -79,7 +79,7 @@ export class OpenAIEmbeddings extends Embeddings {
79
79
  writable: true,
80
80
  value: void 0
81
81
  });
82
- const apiKey = fieldsWithDefaults?.openAIApiKey ??
82
+ let apiKey = fieldsWithDefaults?.openAIApiKey ??
83
83
  getEnvironmentVariable("OPENAI_API_KEY");
84
84
  const azureApiKey = fieldsWithDefaults?.azureOpenAIApiKey ??
85
85
  getEnvironmentVariable("AZURE_OPENAI_API_KEY");
@@ -117,6 +117,7 @@ export class OpenAIEmbeddings extends Embeddings {
117
117
  if (!this.azureOpenAIApiVersion) {
118
118
  throw new Error("Azure OpenAI API version not found");
119
119
  }
120
+ apiKey = apiKey ?? "";
120
121
  }
121
122
  this.clientConfig = {
122
123
  apiKey,
@@ -258,6 +258,7 @@ class OpenAIChat extends base_js_1.LLM {
258
258
  if (!this.azureOpenAIApiVersion) {
259
259
  throw new Error("Azure OpenAI API version not found");
260
260
  }
261
+ this.openAIApiKey = this.openAIApiKey ?? "";
261
262
  }
262
263
  this.clientConfig = {
263
264
  apiKey: this.openAIApiKey,
@@ -255,6 +255,7 @@ export class OpenAIChat extends LLM {
255
255
  if (!this.azureOpenAIApiVersion) {
256
256
  throw new Error("Azure OpenAI API version not found");
257
257
  }
258
+ this.openAIApiKey = this.openAIApiKey ?? "";
258
259
  }
259
260
  this.clientConfig = {
260
261
  apiKey: this.openAIApiKey,
@@ -266,6 +266,7 @@ class OpenAI extends base_js_1.BaseLLM {
266
266
  if (!this.azureOpenAIApiVersion) {
267
267
  throw new Error("Azure OpenAI API version not found");
268
268
  }
269
+ this.openAIApiKey = this.openAIApiKey ?? "";
269
270
  }
270
271
  this.clientConfig = {
271
272
  apiKey: this.openAIApiKey,
@@ -263,6 +263,7 @@ export class OpenAI extends BaseLLM {
263
263
  if (!this.azureOpenAIApiVersion) {
264
264
  throw new Error("Azure OpenAI API version not found");
265
265
  }
266
+ this.openAIApiKey = this.openAIApiKey ?? "";
266
267
  }
267
268
  this.clientConfig = {
268
269
  apiKey: this.openAIApiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain",
3
- "version": "0.0.142",
3
+ "version": "0.0.143",
4
4
  "description": "Typescript bindings for langchain",
5
5
  "type": "module",
6
6
  "engines": {