@langchain/openai 0.2.0 → 0.2.1

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.
@@ -465,8 +465,6 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
465
465
  this.stop = fields?.stopSequences ?? fields?.stop;
466
466
  this.stopSequences = this?.stop;
467
467
  this.user = fields?.user;
468
- this.streaming = fields?.streaming ?? false;
469
- this.streamUsage = fields?.streamUsage ?? this.streamUsage;
470
468
  if (this.azureOpenAIApiKey || this.azureADTokenProvider) {
471
469
  if (!this.azureOpenAIApiInstanceName && !this.azureOpenAIBasePath) {
472
470
  throw new Error("Azure OpenAI API instance name not found");
@@ -478,7 +476,11 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
478
476
  throw new Error("Azure OpenAI API version not found");
479
477
  }
480
478
  this.apiKey = this.apiKey ?? "";
479
+ // Streaming usage is not supported by Azure deployments, so default to false
480
+ this.streamUsage = false;
481
481
  }
482
+ this.streaming = fields?.streaming ?? false;
483
+ this.streamUsage = fields?.streamUsage ?? this.streamUsage;
482
484
  this.clientConfig = {
483
485
  apiKey: this.apiKey,
484
486
  organization: this.organization,
@@ -461,8 +461,6 @@ export class ChatOpenAI extends BaseChatModel {
461
461
  this.stop = fields?.stopSequences ?? fields?.stop;
462
462
  this.stopSequences = this?.stop;
463
463
  this.user = fields?.user;
464
- this.streaming = fields?.streaming ?? false;
465
- this.streamUsage = fields?.streamUsage ?? this.streamUsage;
466
464
  if (this.azureOpenAIApiKey || this.azureADTokenProvider) {
467
465
  if (!this.azureOpenAIApiInstanceName && !this.azureOpenAIBasePath) {
468
466
  throw new Error("Azure OpenAI API instance name not found");
@@ -474,7 +472,11 @@ export class ChatOpenAI extends BaseChatModel {
474
472
  throw new Error("Azure OpenAI API version not found");
475
473
  }
476
474
  this.apiKey = this.apiKey ?? "";
475
+ // Streaming usage is not supported by Azure deployments, so default to false
476
+ this.streamUsage = false;
477
477
  }
478
+ this.streaming = fields?.streaming ?? false;
479
+ this.streamUsage = fields?.streamUsage ?? this.streamUsage;
478
480
  this.clientConfig = {
479
481
  apiKey: this.apiKey,
480
482
  organization: this.organization,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/openai",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "OpenAI integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {