@langchain/openai 0.6.8 → 0.6.9
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.
- package/dist/chat_models.cjs +13 -2
- package/dist/chat_models.d.ts +13 -1
- package/dist/chat_models.js +13 -2
- package/dist/types.d.ts +5 -2
- package/package.json +2 -2
package/dist/chat_models.cjs
CHANGED
|
@@ -324,8 +324,8 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
324
324
|
"disableStreaming",
|
|
325
325
|
"zdrEnabled",
|
|
326
326
|
"reasoning",
|
|
327
|
-
"verbosity",
|
|
328
327
|
"promptCacheKey",
|
|
328
|
+
"verbosity",
|
|
329
329
|
];
|
|
330
330
|
}
|
|
331
331
|
getLsParams(options) {
|
|
@@ -555,6 +555,15 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
555
555
|
writable: true,
|
|
556
556
|
value: void 0
|
|
557
557
|
});
|
|
558
|
+
/**
|
|
559
|
+
* The verbosity of the model's response.
|
|
560
|
+
*/
|
|
561
|
+
Object.defineProperty(this, "verbosity", {
|
|
562
|
+
enumerable: true,
|
|
563
|
+
configurable: true,
|
|
564
|
+
writable: true,
|
|
565
|
+
value: void 0
|
|
566
|
+
});
|
|
558
567
|
Object.defineProperty(this, "defaultOptions", {
|
|
559
568
|
enumerable: true,
|
|
560
569
|
configurable: true,
|
|
@@ -595,6 +604,7 @@ class BaseChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
595
604
|
this.maxTokens = fields?.maxCompletionTokens ?? fields?.maxTokens;
|
|
596
605
|
this.disableStreaming = fields?.disableStreaming ?? this.disableStreaming;
|
|
597
606
|
this.promptCacheKey = fields?.promptCacheKey ?? this.promptCacheKey;
|
|
607
|
+
this.verbosity = fields?.verbosity ?? this.verbosity;
|
|
598
608
|
this.streaming = fields?.streaming ?? false;
|
|
599
609
|
if (this.disableStreaming)
|
|
600
610
|
this.streaming = false;
|
|
@@ -1092,7 +1102,7 @@ class ChatOpenAIResponses extends BaseChatOpenAI {
|
|
|
1092
1102
|
}
|
|
1093
1103
|
return undefined;
|
|
1094
1104
|
}
|
|
1095
|
-
return { format };
|
|
1105
|
+
return { format, verbosity: options?.verbosity };
|
|
1096
1106
|
})(),
|
|
1097
1107
|
parallel_tool_calls: options?.parallel_tool_calls,
|
|
1098
1108
|
max_output_tokens: this.maxTokens === -1 ? undefined : this.maxTokens,
|
|
@@ -1750,6 +1760,7 @@ class ChatOpenAICompletions extends BaseChatOpenAI {
|
|
|
1750
1760
|
: {}),
|
|
1751
1761
|
...this.modelKwargs,
|
|
1752
1762
|
prompt_cache_key: options?.promptCacheKey ?? this.promptCacheKey,
|
|
1763
|
+
verbosity: options?.verbosity ?? this.verbosity,
|
|
1753
1764
|
};
|
|
1754
1765
|
if (options?.prediction !== undefined) {
|
|
1755
1766
|
params.prediction = options.prediction;
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { BaseChatModel, type LangSmithParams, type BaseChatModelParams } from "@
|
|
|
6
6
|
import { type BaseFunctionCallOptions, type BaseLanguageModelInput, type StructuredOutputMethodOptions } from "@langchain/core/language_models/base";
|
|
7
7
|
import { Runnable } from "@langchain/core/runnables";
|
|
8
8
|
import { InteropZodType } from "@langchain/core/utils/types";
|
|
9
|
-
import { type OpenAICallOptions, type OpenAIChatInput, type OpenAICoreRequestOptions, type ChatOpenAIResponseFormat, ChatOpenAIReasoningSummary, ResponseFormatConfiguration } from "./types.js";
|
|
9
|
+
import { type OpenAICallOptions, type OpenAIChatInput, type OpenAICoreRequestOptions, type ChatOpenAIResponseFormat, ChatOpenAIReasoningSummary, ResponseFormatConfiguration, OpenAIVerbosityParam } from "./types.js";
|
|
10
10
|
import { OpenAIToolChoice } from "./utils/openai.js";
|
|
11
11
|
import { ChatOpenAIToolType, ResponsesTool, ResponsesToolChoice } from "./utils/tools.js";
|
|
12
12
|
interface OpenAILLMOutput {
|
|
@@ -115,6 +115,10 @@ export interface BaseChatOpenAICallOptions extends OpenAICallOptions, BaseFuncti
|
|
|
115
115
|
* [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
|
116
116
|
*/
|
|
117
117
|
promptCacheKey?: string;
|
|
118
|
+
/**
|
|
119
|
+
* The verbosity of the model's response.
|
|
120
|
+
*/
|
|
121
|
+
verbosity?: OpenAIVerbosityParam;
|
|
118
122
|
}
|
|
119
123
|
export interface BaseChatOpenAIFields extends Partial<OpenAIChatInput>, BaseChatModelParams {
|
|
120
124
|
/**
|
|
@@ -179,6 +183,10 @@ export declare abstract class BaseChatOpenAI<CallOptions extends BaseChatOpenAIC
|
|
|
179
183
|
* [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
|
180
184
|
*/
|
|
181
185
|
promptCacheKey: string;
|
|
186
|
+
/**
|
|
187
|
+
* The verbosity of the model's response.
|
|
188
|
+
*/
|
|
189
|
+
verbosity?: OpenAIVerbosityParam;
|
|
182
190
|
protected defaultOptions: CallOptions;
|
|
183
191
|
_llmType(): string;
|
|
184
192
|
static lc_name(): string;
|
|
@@ -268,6 +276,10 @@ export interface ChatOpenAIResponsesCallOptions extends BaseChatOpenAICallOption
|
|
|
268
276
|
* conversations.
|
|
269
277
|
*/
|
|
270
278
|
previous_response_id?: OpenAIClient.Responses.ResponseCreateParams["previous_response_id"];
|
|
279
|
+
/**
|
|
280
|
+
* The verbosity of the model's response.
|
|
281
|
+
*/
|
|
282
|
+
verbosity?: OpenAIVerbosityParam;
|
|
271
283
|
}
|
|
272
284
|
type ChatResponsesInvocationParams = Omit<OpenAIClient.Responses.ResponseCreateParams, "input">;
|
|
273
285
|
/**
|
package/dist/chat_models.js
CHANGED
|
@@ -319,8 +319,8 @@ export class BaseChatOpenAI extends BaseChatModel {
|
|
|
319
319
|
"disableStreaming",
|
|
320
320
|
"zdrEnabled",
|
|
321
321
|
"reasoning",
|
|
322
|
-
"verbosity",
|
|
323
322
|
"promptCacheKey",
|
|
323
|
+
"verbosity",
|
|
324
324
|
];
|
|
325
325
|
}
|
|
326
326
|
getLsParams(options) {
|
|
@@ -550,6 +550,15 @@ export class BaseChatOpenAI extends BaseChatModel {
|
|
|
550
550
|
writable: true,
|
|
551
551
|
value: void 0
|
|
552
552
|
});
|
|
553
|
+
/**
|
|
554
|
+
* The verbosity of the model's response.
|
|
555
|
+
*/
|
|
556
|
+
Object.defineProperty(this, "verbosity", {
|
|
557
|
+
enumerable: true,
|
|
558
|
+
configurable: true,
|
|
559
|
+
writable: true,
|
|
560
|
+
value: void 0
|
|
561
|
+
});
|
|
553
562
|
Object.defineProperty(this, "defaultOptions", {
|
|
554
563
|
enumerable: true,
|
|
555
564
|
configurable: true,
|
|
@@ -590,6 +599,7 @@ export class BaseChatOpenAI extends BaseChatModel {
|
|
|
590
599
|
this.maxTokens = fields?.maxCompletionTokens ?? fields?.maxTokens;
|
|
591
600
|
this.disableStreaming = fields?.disableStreaming ?? this.disableStreaming;
|
|
592
601
|
this.promptCacheKey = fields?.promptCacheKey ?? this.promptCacheKey;
|
|
602
|
+
this.verbosity = fields?.verbosity ?? this.verbosity;
|
|
593
603
|
this.streaming = fields?.streaming ?? false;
|
|
594
604
|
if (this.disableStreaming)
|
|
595
605
|
this.streaming = false;
|
|
@@ -1086,7 +1096,7 @@ export class ChatOpenAIResponses extends BaseChatOpenAI {
|
|
|
1086
1096
|
}
|
|
1087
1097
|
return undefined;
|
|
1088
1098
|
}
|
|
1089
|
-
return { format };
|
|
1099
|
+
return { format, verbosity: options?.verbosity };
|
|
1090
1100
|
})(),
|
|
1091
1101
|
parallel_tool_calls: options?.parallel_tool_calls,
|
|
1092
1102
|
max_output_tokens: this.maxTokens === -1 ? undefined : this.maxTokens,
|
|
@@ -1743,6 +1753,7 @@ export class ChatOpenAICompletions extends BaseChatOpenAI {
|
|
|
1743
1753
|
: {}),
|
|
1744
1754
|
...this.modelKwargs,
|
|
1745
1755
|
prompt_cache_key: options?.promptCacheKey ?? this.promptCacheKey,
|
|
1756
|
+
verbosity: options?.verbosity ?? this.verbosity,
|
|
1746
1757
|
};
|
|
1747
1758
|
if (options?.prediction !== undefined) {
|
|
1748
1759
|
params.prediction = options.prediction;
|
package/dist/types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type { TiktokenModel };
|
|
|
8
8
|
* @see https://platform.openai.com/docs/models
|
|
9
9
|
*/
|
|
10
10
|
export type OpenAIChatModelId = OpenAIClient.ChatModel | (string & NonNullable<unknown>);
|
|
11
|
+
export type OpenAIVerbosityParam = "low" | "medium" | "high" | null;
|
|
11
12
|
export declare interface OpenAIBaseInput {
|
|
12
13
|
/** Sampling temperature to use */
|
|
13
14
|
temperature: number;
|
|
@@ -76,8 +77,10 @@ export declare interface OpenAIBaseInput {
|
|
|
76
77
|
* `OPENAI_API_KEY` environment variable.
|
|
77
78
|
*/
|
|
78
79
|
apiKey?: string;
|
|
79
|
-
/**
|
|
80
|
-
|
|
80
|
+
/**
|
|
81
|
+
* The verbosity of the model's response.
|
|
82
|
+
*/
|
|
83
|
+
verbosity?: OpenAIVerbosityParam;
|
|
81
84
|
}
|
|
82
85
|
export type OpenAICoreRequestOptions = OpenAIClient.RequestOptions;
|
|
83
86
|
export interface OpenAICallOptions extends BaseLanguageModelCallOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/openai",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "OpenAI integrations for LangChain.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"js-tiktoken": "^1.0.12",
|
|
39
|
-
"openai": "
|
|
39
|
+
"openai": "5.12.2",
|
|
40
40
|
"zod": "^3.25.32"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|