@langchain/openai 0.5.15 → 0.5.16
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 +22 -0
- package/dist/chat_models.d.ts +10 -0
- package/dist/chat_models.js +22 -0
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/chat_models.cjs
CHANGED
|
@@ -490,6 +490,7 @@ function _convertOpenAIResponsesMessageToBaseMessage(response) {
|
|
|
490
490
|
object: response.object,
|
|
491
491
|
status: response.status,
|
|
492
492
|
user: response.user,
|
|
493
|
+
service_tier: response.service_tier,
|
|
493
494
|
// for compatibility with chat completion calls.
|
|
494
495
|
model_name: response.model,
|
|
495
496
|
};
|
|
@@ -1304,6 +1305,7 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
1304
1305
|
"response_format",
|
|
1305
1306
|
"seed",
|
|
1306
1307
|
"reasoning_effort",
|
|
1308
|
+
"service_tier",
|
|
1307
1309
|
];
|
|
1308
1310
|
}
|
|
1309
1311
|
get lc_secrets() {
|
|
@@ -1581,6 +1583,16 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
1581
1583
|
writable: true,
|
|
1582
1584
|
value: void 0
|
|
1583
1585
|
});
|
|
1586
|
+
/**
|
|
1587
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex" or "priority".
|
|
1588
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
1589
|
+
*/
|
|
1590
|
+
Object.defineProperty(this, "service_tier", {
|
|
1591
|
+
enumerable: true,
|
|
1592
|
+
configurable: true,
|
|
1593
|
+
writable: true,
|
|
1594
|
+
value: void 0
|
|
1595
|
+
});
|
|
1584
1596
|
this.openAIApiKey =
|
|
1585
1597
|
fields?.apiKey ??
|
|
1586
1598
|
fields?.openAIApiKey ??
|
|
@@ -1634,6 +1646,9 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
1634
1646
|
if (fields?.supportsStrictToolCalling !== undefined) {
|
|
1635
1647
|
this.supportsStrictToolCalling = fields.supportsStrictToolCalling;
|
|
1636
1648
|
}
|
|
1649
|
+
if (fields?.service_tier !== undefined) {
|
|
1650
|
+
this.service_tier = fields.service_tier;
|
|
1651
|
+
}
|
|
1637
1652
|
this.zdrEnabled = fields?.zdrEnabled ?? false;
|
|
1638
1653
|
}
|
|
1639
1654
|
getLsParams(options) {
|
|
@@ -1815,6 +1830,12 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
1815
1830
|
if (options?.prediction !== undefined) {
|
|
1816
1831
|
params.prediction = options.prediction;
|
|
1817
1832
|
}
|
|
1833
|
+
if (this.service_tier !== undefined) {
|
|
1834
|
+
params.service_tier = this.service_tier;
|
|
1835
|
+
}
|
|
1836
|
+
if (options?.service_tier !== undefined) {
|
|
1837
|
+
params.service_tier = options.service_tier;
|
|
1838
|
+
}
|
|
1818
1839
|
const reasoning = this.getReasoningParams(options);
|
|
1819
1840
|
if (reasoning !== undefined && reasoning.effort !== undefined) {
|
|
1820
1841
|
params.reasoning_effort = reasoning.effort;
|
|
@@ -2025,6 +2046,7 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
2025
2046
|
// to avoid concatenation issues
|
|
2026
2047
|
generationInfo.system_fingerprint = data.system_fingerprint;
|
|
2027
2048
|
generationInfo.model_name = data.model;
|
|
2049
|
+
generationInfo.service_tier = data.service_tier;
|
|
2028
2050
|
}
|
|
2029
2051
|
if (this.logprobs) {
|
|
2030
2052
|
generationInfo.logprobs = choice.logprobs;
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -158,6 +158,11 @@ export interface ChatOpenAICallOptions extends OpenAICallOptions, BaseFunctionCa
|
|
|
158
158
|
* If set, the Responses API will be used to fulfill the request.
|
|
159
159
|
*/
|
|
160
160
|
previous_response_id?: ResponsesCreateParams["previous_response_id"];
|
|
161
|
+
/**
|
|
162
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex"
|
|
163
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
164
|
+
*/
|
|
165
|
+
service_tier?: ResponsesCreateParams["service_tier"];
|
|
161
166
|
}
|
|
162
167
|
export interface ChatOpenAIFields extends Partial<OpenAIChatInput>, BaseChatModelParams {
|
|
163
168
|
configuration?: ClientOptions;
|
|
@@ -771,6 +776,11 @@ export declare class ChatOpenAI<CallOptions extends ChatOpenAICallOptions = Chat
|
|
|
771
776
|
* @default false
|
|
772
777
|
*/
|
|
773
778
|
zdrEnabled?: boolean | undefined;
|
|
779
|
+
/**
|
|
780
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex" or "priority".
|
|
781
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
782
|
+
*/
|
|
783
|
+
service_tier?: ResponsesCreateParams["service_tier"];
|
|
774
784
|
constructor(fields?: ChatOpenAIFields);
|
|
775
785
|
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
|
|
776
786
|
bindTools(tools: ChatOpenAIToolType[], kwargs?: Partial<CallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, CallOptions>;
|
package/dist/chat_models.js
CHANGED
|
@@ -452,6 +452,7 @@ function _convertOpenAIResponsesMessageToBaseMessage(response) {
|
|
|
452
452
|
object: response.object,
|
|
453
453
|
status: response.status,
|
|
454
454
|
user: response.user,
|
|
455
|
+
service_tier: response.service_tier,
|
|
455
456
|
// for compatibility with chat completion calls.
|
|
456
457
|
model_name: response.model,
|
|
457
458
|
};
|
|
@@ -1266,6 +1267,7 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1266
1267
|
"response_format",
|
|
1267
1268
|
"seed",
|
|
1268
1269
|
"reasoning_effort",
|
|
1270
|
+
"service_tier",
|
|
1269
1271
|
];
|
|
1270
1272
|
}
|
|
1271
1273
|
get lc_secrets() {
|
|
@@ -1543,6 +1545,16 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1543
1545
|
writable: true,
|
|
1544
1546
|
value: void 0
|
|
1545
1547
|
});
|
|
1548
|
+
/**
|
|
1549
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex" or "priority".
|
|
1550
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
1551
|
+
*/
|
|
1552
|
+
Object.defineProperty(this, "service_tier", {
|
|
1553
|
+
enumerable: true,
|
|
1554
|
+
configurable: true,
|
|
1555
|
+
writable: true,
|
|
1556
|
+
value: void 0
|
|
1557
|
+
});
|
|
1546
1558
|
this.openAIApiKey =
|
|
1547
1559
|
fields?.apiKey ??
|
|
1548
1560
|
fields?.openAIApiKey ??
|
|
@@ -1596,6 +1608,9 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1596
1608
|
if (fields?.supportsStrictToolCalling !== undefined) {
|
|
1597
1609
|
this.supportsStrictToolCalling = fields.supportsStrictToolCalling;
|
|
1598
1610
|
}
|
|
1611
|
+
if (fields?.service_tier !== undefined) {
|
|
1612
|
+
this.service_tier = fields.service_tier;
|
|
1613
|
+
}
|
|
1599
1614
|
this.zdrEnabled = fields?.zdrEnabled ?? false;
|
|
1600
1615
|
}
|
|
1601
1616
|
getLsParams(options) {
|
|
@@ -1777,6 +1792,12 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1777
1792
|
if (options?.prediction !== undefined) {
|
|
1778
1793
|
params.prediction = options.prediction;
|
|
1779
1794
|
}
|
|
1795
|
+
if (this.service_tier !== undefined) {
|
|
1796
|
+
params.service_tier = this.service_tier;
|
|
1797
|
+
}
|
|
1798
|
+
if (options?.service_tier !== undefined) {
|
|
1799
|
+
params.service_tier = options.service_tier;
|
|
1800
|
+
}
|
|
1780
1801
|
const reasoning = this.getReasoningParams(options);
|
|
1781
1802
|
if (reasoning !== undefined && reasoning.effort !== undefined) {
|
|
1782
1803
|
params.reasoning_effort = reasoning.effort;
|
|
@@ -1987,6 +2008,7 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1987
2008
|
// to avoid concatenation issues
|
|
1988
2009
|
generationInfo.system_fingerprint = data.system_fingerprint;
|
|
1989
2010
|
generationInfo.model_name = data.model;
|
|
2011
|
+
generationInfo.service_tier = data.service_tier;
|
|
1990
2012
|
}
|
|
1991
2013
|
if (this.logprobs) {
|
|
1992
2014
|
generationInfo.logprobs = choice.logprobs;
|
package/dist/types.d.ts
CHANGED
|
@@ -156,6 +156,11 @@ export interface OpenAIChatInput extends OpenAIBaseInput {
|
|
|
156
156
|
* @default false
|
|
157
157
|
*/
|
|
158
158
|
zdrEnabled?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex" or "priority".
|
|
161
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
162
|
+
*/
|
|
163
|
+
service_tier?: OpenAIClient.Responses.ResponseCreateParams["service_tier"];
|
|
159
164
|
}
|
|
160
165
|
export declare interface AzureOpenAIInput {
|
|
161
166
|
/**
|