@langchain/openai 0.6.9 → 0.6.11

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
+ "reasoningEffort",
276
277
  "service_tier",
277
278
  ];
278
279
  }
@@ -286,6 +287,7 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
286
287
  return {
287
288
  apiKey: "openai_api_key",
288
289
  modelName: "model",
290
+ reasoningEffort: "reasoning_effort",
289
291
  };
290
292
  }
291
293
  get lc_serializable_keys() {
@@ -324,6 +326,7 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
324
326
  "disableStreaming",
325
327
  "zdrEnabled",
326
328
  "reasoning",
329
+ "reasoningEffort",
327
330
  "promptCacheKey",
328
331
  "verbosity",
329
332
  ];
@@ -600,12 +603,18 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
600
603
  this.__includeRawResponse = fields?.__includeRawResponse;
601
604
  this.audio = fields?.audio;
602
605
  this.modalities = fields?.modalities;
603
- this.reasoning = fields?.reasoning;
606
+ this.reasoning =
607
+ fields?.reasoning ?? fields?.reasoningEffort
608
+ ? { effort: fields.reasoningEffort }
609
+ : undefined;
604
610
  this.maxTokens = fields?.maxCompletionTokens ?? fields?.maxTokens;
605
611
  this.disableStreaming = fields?.disableStreaming ?? this.disableStreaming;
606
612
  this.promptCacheKey = fields?.promptCacheKey ?? this.promptCacheKey;
607
613
  this.verbosity = fields?.verbosity ?? this.verbosity;
608
614
  this.streaming = fields?.streaming ?? false;
615
+ // disable streaming in BaseChatModel if explicitly disabled
616
+ if (this.streaming === false)
617
+ this.disableStreaming = true;
609
618
  if (this.disableStreaming)
610
619
  this.streaming = false;
611
620
  this.streamUsage = fields?.streamUsage ?? this.streamUsage;
@@ -1098,6 +1107,7 @@ class ChatOpenAIResponses extends BaseChatOpenAI {
1098
1107
  name: format.json_schema.name,
1099
1108
  strict: format.json_schema.strict,
1100
1109
  },
1110
+ verbosity: options?.verbosity,
1101
1111
  };
1102
1112
  }
1103
1113
  return undefined;
@@ -268,6 +268,7 @@ export class BaseChatOpenAI extends BaseChatModel {
268
268
  "response_format",
269
269
  "seed",
270
270
  "reasoning",
271
+ "reasoningEffort",
271
272
  "service_tier",
272
273
  ];
273
274
  }
@@ -281,6 +282,7 @@ export class BaseChatOpenAI extends BaseChatModel {
281
282
  return {
282
283
  apiKey: "openai_api_key",
283
284
  modelName: "model",
285
+ reasoningEffort: "reasoning_effort",
284
286
  };
285
287
  }
286
288
  get lc_serializable_keys() {
@@ -319,6 +321,7 @@ export class BaseChatOpenAI extends BaseChatModel {
319
321
  "disableStreaming",
320
322
  "zdrEnabled",
321
323
  "reasoning",
324
+ "reasoningEffort",
322
325
  "promptCacheKey",
323
326
  "verbosity",
324
327
  ];
@@ -595,12 +598,18 @@ export class BaseChatOpenAI extends BaseChatModel {
595
598
  this.__includeRawResponse = fields?.__includeRawResponse;
596
599
  this.audio = fields?.audio;
597
600
  this.modalities = fields?.modalities;
598
- this.reasoning = fields?.reasoning;
601
+ this.reasoning =
602
+ fields?.reasoning ?? fields?.reasoningEffort
603
+ ? { effort: fields.reasoningEffort }
604
+ : undefined;
599
605
  this.maxTokens = fields?.maxCompletionTokens ?? fields?.maxTokens;
600
606
  this.disableStreaming = fields?.disableStreaming ?? this.disableStreaming;
601
607
  this.promptCacheKey = fields?.promptCacheKey ?? this.promptCacheKey;
602
608
  this.verbosity = fields?.verbosity ?? this.verbosity;
603
609
  this.streaming = fields?.streaming ?? false;
610
+ // disable streaming in BaseChatModel if explicitly disabled
611
+ if (this.streaming === false)
612
+ this.disableStreaming = true;
604
613
  if (this.disableStreaming)
605
614
  this.streaming = false;
606
615
  this.streamUsage = fields?.streamUsage ?? this.streamUsage;
@@ -1092,6 +1101,7 @@ export class ChatOpenAIResponses extends BaseChatOpenAI {
1092
1101
  name: format.json_schema.name,
1093
1102
  strict: format.json_schema.strict,
1094
1103
  },
1104
+ verbosity: options?.verbosity,
1095
1105
  };
1096
1106
  }
1097
1107
  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
+ reasoningEffort?: 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.11",
4
4
  "description": "OpenAI integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {