@langchain/openai 0.6.9 → 0.6.10

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.
@@ -273,6 +273,7 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
273
273
  "response_format",
274
274
  "seed",
275
275
  "reasoning",
276
+ "reasoning_effort",
276
277
  "service_tier",
277
278
  ];
278
279
  }
@@ -324,6 +325,7 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
324
325
  "disableStreaming",
325
326
  "zdrEnabled",
326
327
  "reasoning",
328
+ "reasoning_effort",
327
329
  "promptCacheKey",
328
330
  "verbosity",
329
331
  ];
@@ -600,12 +602,18 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
600
602
  this.__includeRawResponse = fields?.__includeRawResponse;
601
603
  this.audio = fields?.audio;
602
604
  this.modalities = fields?.modalities;
603
- this.reasoning = fields?.reasoning;
605
+ this.reasoning =
606
+ fields?.reasoning ?? fields?.reasoning_effort
607
+ ? { effort: fields.reasoning_effort }
608
+ : undefined;
604
609
  this.maxTokens = fields?.maxCompletionTokens ?? fields?.maxTokens;
605
610
  this.disableStreaming = fields?.disableStreaming ?? this.disableStreaming;
606
611
  this.promptCacheKey = fields?.promptCacheKey ?? this.promptCacheKey;
607
612
  this.verbosity = fields?.verbosity ?? this.verbosity;
608
613
  this.streaming = fields?.streaming ?? false;
614
+ // disable streaming in BaseChatModel if explicitly disabled
615
+ if (this.streaming === false)
616
+ this.disableStreaming = true;
609
617
  if (this.disableStreaming)
610
618
  this.streaming = false;
611
619
  this.streamUsage = fields?.streamUsage ?? this.streamUsage;
@@ -1098,6 +1106,7 @@ class ChatOpenAIResponses extends BaseChatOpenAI {
1098
1106
  name: format.json_schema.name,
1099
1107
  strict: format.json_schema.strict,
1100
1108
  },
1109
+ verbosity: options?.verbosity,
1101
1110
  };
1102
1111
  }
1103
1112
  return undefined;
@@ -268,6 +268,7 @@ export class BaseChatOpenAI extends BaseChatModel {
268
268
  "response_format",
269
269
  "seed",
270
270
  "reasoning",
271
+ "reasoning_effort",
271
272
  "service_tier",
272
273
  ];
273
274
  }
@@ -319,6 +320,7 @@ export class BaseChatOpenAI extends BaseChatModel {
319
320
  "disableStreaming",
320
321
  "zdrEnabled",
321
322
  "reasoning",
323
+ "reasoning_effort",
322
324
  "promptCacheKey",
323
325
  "verbosity",
324
326
  ];
@@ -595,12 +597,18 @@ export class BaseChatOpenAI extends BaseChatModel {
595
597
  this.__includeRawResponse = fields?.__includeRawResponse;
596
598
  this.audio = fields?.audio;
597
599
  this.modalities = fields?.modalities;
598
- this.reasoning = fields?.reasoning;
600
+ this.reasoning =
601
+ fields?.reasoning ?? fields?.reasoning_effort
602
+ ? { effort: fields.reasoning_effort }
603
+ : undefined;
599
604
  this.maxTokens = fields?.maxCompletionTokens ?? fields?.maxTokens;
600
605
  this.disableStreaming = fields?.disableStreaming ?? this.disableStreaming;
601
606
  this.promptCacheKey = fields?.promptCacheKey ?? this.promptCacheKey;
602
607
  this.verbosity = fields?.verbosity ?? this.verbosity;
603
608
  this.streaming = fields?.streaming ?? false;
609
+ // disable streaming in BaseChatModel if explicitly disabled
610
+ if (this.streaming === false)
611
+ this.disableStreaming = true;
604
612
  if (this.disableStreaming)
605
613
  this.streaming = false;
606
614
  this.streamUsage = fields?.streamUsage ?? this.streamUsage;
@@ -1092,6 +1100,7 @@ export class ChatOpenAIResponses extends BaseChatOpenAI {
1092
1100
  name: format.json_schema.name,
1093
1101
  strict: format.json_schema.strict,
1094
1102
  },
1103
+ verbosity: options?.verbosity,
1095
1104
  };
1096
1105
  }
1097
1106
  return undefined;
package/dist/types.d.ts CHANGED
@@ -147,6 +147,15 @@ export interface OpenAIChatInput extends OpenAIBaseInput {
147
147
  * API. This option is ignored when not using a reasoning model.
148
148
  */
149
149
  reasoning?: OpenAIClient.Reasoning;
150
+ /**
151
+ * Constrains effort on reasoning for
152
+ * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Reducing reasoning
153
+ * effort can result in faster responses and fewer tokens used on reasoning in a
154
+ * response.
155
+ *
156
+ * @deprecated Use `reasoning` instead.
157
+ */
158
+ reasoning_effort?: OpenAIClient.ReasoningEffort;
150
159
  /**
151
160
  * Should be set to `true` in tenancies with Zero Data Retention
152
161
  * @see https://platform.openai.com/docs/guides/your-data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/openai",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "OpenAI integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {