langchain 0.3.23 → 0.3.25
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/agents/react/output_parser.cjs +1 -1
- package/dist/agents/react/output_parser.js +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.ts +1 -1
- package/dist/agents/xml/output_parser.cjs +6 -4
- package/dist/agents/xml/output_parser.js +6 -4
- package/dist/chat_models/universal.cjs +18 -8
- package/dist/chat_models/universal.d.ts +10 -5
- package/dist/chat_models/universal.js +16 -7
- package/dist/hub/base.cjs +1 -1
- package/dist/hub/base.js +1 -1
- package/dist/hub/node.cjs +1 -1
- package/dist/hub/node.js +1 -1
- package/dist/tools/retriever.d.ts +1 -1
- package/dist/util/openapi.cjs +4 -4
- package/dist/util/openapi.js +4 -4
- package/package.json +1 -1
- package/dist/experimental/chrome_ai/app/dist/bundle.cjs +0 -1250
- package/dist/experimental/chrome_ai/app/dist/bundle.d.ts +0 -1
- package/dist/experimental/chrome_ai/app/dist/bundle.js +0 -1249
- package/schema/document.cjs +0 -1
- package/schema/document.d.cts +0 -1
- package/schema/document.d.ts +0 -1
- package/schema/document.js +0 -1
|
@@ -79,7 +79,7 @@ class ReActSingleInputOutputParser extends types_js_1.AgentActionOutputParser {
|
|
|
79
79
|
}
|
|
80
80
|
const action = actionMatch[1];
|
|
81
81
|
const actionInput = actionMatch[2];
|
|
82
|
-
const toolInput = actionInput.trim().replace(
|
|
82
|
+
const toolInput = actionInput.trim().replace(/^"|"$/g, "");
|
|
83
83
|
return {
|
|
84
84
|
tool: action,
|
|
85
85
|
toolInput,
|
|
@@ -76,7 +76,7 @@ export class ReActSingleInputOutputParser extends AgentActionOutputParser {
|
|
|
76
76
|
}
|
|
77
77
|
const action = actionMatch[1];
|
|
78
78
|
const actionInput = actionMatch[2];
|
|
79
|
-
const toolInput = actionInput.trim().replace(
|
|
79
|
+
const toolInput = actionInput.trim().replace(/^"|"$/g, "");
|
|
80
80
|
return {
|
|
81
81
|
tool: action,
|
|
82
82
|
toolInput,
|
|
@@ -45,13 +45,15 @@ class XMLAgentOutputParser extends types_js_1.AgentActionOutputParser {
|
|
|
45
45
|
*/
|
|
46
46
|
async parse(text) {
|
|
47
47
|
if (text.includes("</tool>")) {
|
|
48
|
-
const
|
|
49
|
-
const _tool =
|
|
50
|
-
const
|
|
48
|
+
const _toolMatch = text.match(/<tool>([^<]*)<\/tool>/);
|
|
49
|
+
const _tool = _toolMatch ? _toolMatch[1] : "";
|
|
50
|
+
const _toolInputMatch = text.match(/<tool_input>([^<]*?)(?:<\/tool_input>|$)/);
|
|
51
|
+
const _toolInput = _toolInputMatch ? _toolInputMatch[1] : "";
|
|
51
52
|
return { tool: _tool, toolInput: _toolInput, log: text };
|
|
52
53
|
}
|
|
53
54
|
else if (text.includes("<final_answer>")) {
|
|
54
|
-
const
|
|
55
|
+
const answerMatch = text.match(/<final_answer>([^<]*?)(?:<\/final_answer>|$)/);
|
|
56
|
+
const answer = answerMatch ? answerMatch[1] : "";
|
|
55
57
|
return { returnValues: { output: answer }, log: text };
|
|
56
58
|
}
|
|
57
59
|
else {
|
|
@@ -42,13 +42,15 @@ export class XMLAgentOutputParser extends AgentActionOutputParser {
|
|
|
42
42
|
*/
|
|
43
43
|
async parse(text) {
|
|
44
44
|
if (text.includes("</tool>")) {
|
|
45
|
-
const
|
|
46
|
-
const _tool =
|
|
47
|
-
const
|
|
45
|
+
const _toolMatch = text.match(/<tool>([^<]*)<\/tool>/);
|
|
46
|
+
const _tool = _toolMatch ? _toolMatch[1] : "";
|
|
47
|
+
const _toolInputMatch = text.match(/<tool_input>([^<]*?)(?:<\/tool_input>|$)/);
|
|
48
|
+
const _toolInput = _toolInputMatch ? _toolInputMatch[1] : "";
|
|
48
49
|
return { tool: _tool, toolInput: _toolInput, log: text };
|
|
49
50
|
}
|
|
50
51
|
else if (text.includes("<final_answer>")) {
|
|
51
|
-
const
|
|
52
|
+
const answerMatch = text.match(/<final_answer>([^<]*?)(?:<\/final_answer>|$)/);
|
|
53
|
+
const answer = answerMatch ? answerMatch[1] : "";
|
|
52
54
|
return { returnValues: { output: answer }, log: text };
|
|
53
55
|
}
|
|
54
56
|
else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initChatModel = exports._inferModelProvider = void 0;
|
|
3
|
+
exports.initChatModel = exports.ConfigurableModel = exports._inferModelProvider = void 0;
|
|
4
4
|
const chat_models_1 = require("@langchain/core/language_models/chat_models");
|
|
5
5
|
const runnables_1 = require("@langchain/core/runnables");
|
|
6
6
|
const stream_1 = require("@langchain/core/utils/stream");
|
|
@@ -90,6 +90,8 @@ params = {}) {
|
|
|
90
90
|
return new ChatXAI({ model, ...passedParams });
|
|
91
91
|
}
|
|
92
92
|
case "fireworks": {
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
94
|
+
// @ts-ignore - Can not install as a proper dependency due to circular dependency
|
|
93
95
|
const { ChatFireworks } = await import(
|
|
94
96
|
// We can not 'expect-error' because if you explicitly build `@langchain/community`
|
|
95
97
|
// this import will be able to be resolved, thus there will be no error. However
|
|
@@ -100,6 +102,8 @@ params = {}) {
|
|
|
100
102
|
return new ChatFireworks({ model, ...passedParams });
|
|
101
103
|
}
|
|
102
104
|
case "together": {
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
106
|
+
// @ts-ignore - Can not install as a proper dependency due to circular dependency
|
|
103
107
|
const { ChatTogetherAI } = await import(
|
|
104
108
|
// We can not 'expect-error' because if you explicitly build `@langchain/community`
|
|
105
109
|
// this import will be able to be resolved, thus there will be no error. However
|
|
@@ -166,7 +170,12 @@ function _inferModelProvider(modelName) {
|
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
172
|
exports._inferModelProvider = _inferModelProvider;
|
|
169
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Internal class used to create chat models.
|
|
175
|
+
*
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
class ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
170
179
|
_llmType() {
|
|
171
180
|
return "chat_model";
|
|
172
181
|
}
|
|
@@ -221,7 +230,7 @@ class _ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
221
230
|
writable: true,
|
|
222
231
|
value: (schema, ...args) => {
|
|
223
232
|
this._queuedMethodOperations.withStructuredOutput = [schema, ...args];
|
|
224
|
-
return new
|
|
233
|
+
return new ConfigurableModel({
|
|
225
234
|
defaultConfig: this._defaultConfig,
|
|
226
235
|
configurableFields: this._configurableFields,
|
|
227
236
|
configPrefix: this._configPrefix,
|
|
@@ -275,7 +284,7 @@ class _ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
275
284
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
276
285
|
params) {
|
|
277
286
|
this._queuedMethodOperations.bindTools = [tools, params];
|
|
278
|
-
return new
|
|
287
|
+
return new ConfigurableModel({
|
|
279
288
|
defaultConfig: this._defaultConfig,
|
|
280
289
|
configurableFields: this._configurableFields,
|
|
281
290
|
configPrefix: this._configPrefix,
|
|
@@ -312,7 +321,7 @@ class _ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
312
321
|
const remainingConfig = Object.fromEntries(Object.entries(mergedConfig).filter(([k]) => k !== "configurable"));
|
|
313
322
|
remainingConfig.configurable = Object.fromEntries(Object.entries(mergedConfig.configurable || {}).filter(([k]) => this._configPrefix &&
|
|
314
323
|
!Object.keys(modelParams).includes(this._removePrefix(k, this._configPrefix))));
|
|
315
|
-
const newConfigurableModel = new
|
|
324
|
+
const newConfigurableModel = new ConfigurableModel({
|
|
316
325
|
defaultConfig: { ...this._defaultConfig, ...modelParams },
|
|
317
326
|
configurableFields: Array.isArray(this._configurableFields)
|
|
318
327
|
? [...this._configurableFields]
|
|
@@ -377,6 +386,7 @@ class _ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
377
386
|
return stream_1.IterableReadableStream.fromAsyncGenerator(wrappedGenerator());
|
|
378
387
|
}
|
|
379
388
|
}
|
|
389
|
+
exports.ConfigurableModel = ConfigurableModel;
|
|
380
390
|
// ################################# FOR CONTRIBUTORS #################################
|
|
381
391
|
//
|
|
382
392
|
// If adding support for a new provider, please append the provider
|
|
@@ -416,7 +426,7 @@ class _ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
416
426
|
* - string[]: Specified fields are configurable.
|
|
417
427
|
* @param {string} [fields.configPrefix] - Prefix for configurable fields at runtime.
|
|
418
428
|
* @param {Record<string, any>} [fields.params] - Additional keyword args to pass to the ChatModel constructor.
|
|
419
|
-
* @returns {Promise<
|
|
429
|
+
* @returns {Promise<ConfigurableModel<RunInput, CallOptions>>} A class which extends BaseChatModel.
|
|
420
430
|
* @throws {Error} If modelProvider cannot be inferred or isn't supported.
|
|
421
431
|
* @throws {Error} If the model provider integration package is not installed.
|
|
422
432
|
*
|
|
@@ -617,7 +627,7 @@ fields) {
|
|
|
617
627
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
618
628
|
const paramsCopy = { ...params };
|
|
619
629
|
if (configurableFieldsCopy === undefined) {
|
|
620
|
-
return new
|
|
630
|
+
return new ConfigurableModel({
|
|
621
631
|
defaultConfig: {
|
|
622
632
|
...paramsCopy,
|
|
623
633
|
model,
|
|
@@ -633,7 +643,7 @@ fields) {
|
|
|
633
643
|
if (modelProvider) {
|
|
634
644
|
paramsCopy.modelProvider = modelProvider;
|
|
635
645
|
}
|
|
636
|
-
return new
|
|
646
|
+
return new ConfigurableModel({
|
|
637
647
|
defaultConfig: paramsCopy,
|
|
638
648
|
configPrefix,
|
|
639
649
|
configurableFields: configurableFieldsCopy,
|
|
@@ -42,7 +42,12 @@ interface ConfigurableModelFields extends BaseChatModelParams {
|
|
|
42
42
|
*/
|
|
43
43
|
queuedMethodOperations?: Record<string, any>;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Internal class used to create chat models.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> {
|
|
46
51
|
_llmType(): string;
|
|
47
52
|
lc_namespace: string[];
|
|
48
53
|
_defaultConfig?: Record<string, any>;
|
|
@@ -62,7 +67,7 @@ declare class _ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseL
|
|
|
62
67
|
constructor(fields: ConfigurableModelFields);
|
|
63
68
|
_model(config?: RunnableConfig): Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk>>;
|
|
64
69
|
_generate(messages: BaseMessage[], options?: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
65
|
-
bindTools(tools: BindToolsInput[], params?: Record<string, any>):
|
|
70
|
+
bindTools(tools: BindToolsInput[], params?: Record<string, any>): ConfigurableModel<RunInput, CallOptions>;
|
|
66
71
|
withStructuredOutput: BaseChatModel["withStructuredOutput"];
|
|
67
72
|
_modelParams(config?: RunnableConfig): Record<string, any>;
|
|
68
73
|
_removePrefix(str: string, prefix: string): string;
|
|
@@ -101,15 +106,15 @@ export declare function initChatModel<RunInput extends BaseLanguageModelInput =
|
|
|
101
106
|
modelProvider?: string;
|
|
102
107
|
configurableFields?: never;
|
|
103
108
|
configPrefix?: string;
|
|
104
|
-
}): Promise<
|
|
109
|
+
}): Promise<ConfigurableModel<RunInput, CallOptions>>;
|
|
105
110
|
export declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: never, options?: Partial<Record<string, any>> & {
|
|
106
111
|
modelProvider?: string;
|
|
107
112
|
configurableFields?: never;
|
|
108
113
|
configPrefix?: string;
|
|
109
|
-
}): Promise<
|
|
114
|
+
}): Promise<ConfigurableModel<RunInput, CallOptions>>;
|
|
110
115
|
export declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model?: string, options?: Partial<Record<string, any>> & {
|
|
111
116
|
modelProvider?: string;
|
|
112
117
|
configurableFields?: ConfigurableFields;
|
|
113
118
|
configPrefix?: string;
|
|
114
|
-
}): Promise<
|
|
119
|
+
}): Promise<ConfigurableModel<RunInput, CallOptions>>;
|
|
115
120
|
export {};
|
|
@@ -87,6 +87,8 @@ params = {}) {
|
|
|
87
87
|
return new ChatXAI({ model, ...passedParams });
|
|
88
88
|
}
|
|
89
89
|
case "fireworks": {
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
91
|
+
// @ts-ignore - Can not install as a proper dependency due to circular dependency
|
|
90
92
|
const { ChatFireworks } = await import(
|
|
91
93
|
// We can not 'expect-error' because if you explicitly build `@langchain/community`
|
|
92
94
|
// this import will be able to be resolved, thus there will be no error. However
|
|
@@ -97,6 +99,8 @@ params = {}) {
|
|
|
97
99
|
return new ChatFireworks({ model, ...passedParams });
|
|
98
100
|
}
|
|
99
101
|
case "together": {
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
103
|
+
// @ts-ignore - Can not install as a proper dependency due to circular dependency
|
|
100
104
|
const { ChatTogetherAI } = await import(
|
|
101
105
|
// We can not 'expect-error' because if you explicitly build `@langchain/community`
|
|
102
106
|
// this import will be able to be resolved, thus there will be no error. However
|
|
@@ -162,7 +166,12 @@ export function _inferModelProvider(modelName) {
|
|
|
162
166
|
return undefined;
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Internal class used to create chat models.
|
|
171
|
+
*
|
|
172
|
+
* @internal
|
|
173
|
+
*/
|
|
174
|
+
export class ConfigurableModel extends BaseChatModel {
|
|
166
175
|
_llmType() {
|
|
167
176
|
return "chat_model";
|
|
168
177
|
}
|
|
@@ -217,7 +226,7 @@ class _ConfigurableModel extends BaseChatModel {
|
|
|
217
226
|
writable: true,
|
|
218
227
|
value: (schema, ...args) => {
|
|
219
228
|
this._queuedMethodOperations.withStructuredOutput = [schema, ...args];
|
|
220
|
-
return new
|
|
229
|
+
return new ConfigurableModel({
|
|
221
230
|
defaultConfig: this._defaultConfig,
|
|
222
231
|
configurableFields: this._configurableFields,
|
|
223
232
|
configPrefix: this._configPrefix,
|
|
@@ -271,7 +280,7 @@ class _ConfigurableModel extends BaseChatModel {
|
|
|
271
280
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
272
281
|
params) {
|
|
273
282
|
this._queuedMethodOperations.bindTools = [tools, params];
|
|
274
|
-
return new
|
|
283
|
+
return new ConfigurableModel({
|
|
275
284
|
defaultConfig: this._defaultConfig,
|
|
276
285
|
configurableFields: this._configurableFields,
|
|
277
286
|
configPrefix: this._configPrefix,
|
|
@@ -308,7 +317,7 @@ class _ConfigurableModel extends BaseChatModel {
|
|
|
308
317
|
const remainingConfig = Object.fromEntries(Object.entries(mergedConfig).filter(([k]) => k !== "configurable"));
|
|
309
318
|
remainingConfig.configurable = Object.fromEntries(Object.entries(mergedConfig.configurable || {}).filter(([k]) => this._configPrefix &&
|
|
310
319
|
!Object.keys(modelParams).includes(this._removePrefix(k, this._configPrefix))));
|
|
311
|
-
const newConfigurableModel = new
|
|
320
|
+
const newConfigurableModel = new ConfigurableModel({
|
|
312
321
|
defaultConfig: { ...this._defaultConfig, ...modelParams },
|
|
313
322
|
configurableFields: Array.isArray(this._configurableFields)
|
|
314
323
|
? [...this._configurableFields]
|
|
@@ -412,7 +421,7 @@ class _ConfigurableModel extends BaseChatModel {
|
|
|
412
421
|
* - string[]: Specified fields are configurable.
|
|
413
422
|
* @param {string} [fields.configPrefix] - Prefix for configurable fields at runtime.
|
|
414
423
|
* @param {Record<string, any>} [fields.params] - Additional keyword args to pass to the ChatModel constructor.
|
|
415
|
-
* @returns {Promise<
|
|
424
|
+
* @returns {Promise<ConfigurableModel<RunInput, CallOptions>>} A class which extends BaseChatModel.
|
|
416
425
|
* @throws {Error} If modelProvider cannot be inferred or isn't supported.
|
|
417
426
|
* @throws {Error} If the model provider integration package is not installed.
|
|
418
427
|
*
|
|
@@ -613,7 +622,7 @@ fields) {
|
|
|
613
622
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
614
623
|
const paramsCopy = { ...params };
|
|
615
624
|
if (configurableFieldsCopy === undefined) {
|
|
616
|
-
return new
|
|
625
|
+
return new ConfigurableModel({
|
|
617
626
|
defaultConfig: {
|
|
618
627
|
...paramsCopy,
|
|
619
628
|
model,
|
|
@@ -629,7 +638,7 @@ fields) {
|
|
|
629
638
|
if (modelProvider) {
|
|
630
639
|
paramsCopy.modelProvider = modelProvider;
|
|
631
640
|
}
|
|
632
|
-
return new
|
|
641
|
+
return new ConfigurableModel({
|
|
633
642
|
defaultConfig: paramsCopy,
|
|
634
643
|
configPrefix,
|
|
635
644
|
configurableFields: configurableFieldsCopy,
|
package/dist/hub/base.cjs
CHANGED
|
@@ -83,7 +83,7 @@ modelClass) {
|
|
|
83
83
|
else if (modelLcName === "ChatAzureOpenAI") {
|
|
84
84
|
importMapKey = "chat_models__openai";
|
|
85
85
|
}
|
|
86
|
-
else if (modelLcName === "
|
|
86
|
+
else if (modelLcName === "ChatVertexAI") {
|
|
87
87
|
importMapKey = "chat_models__vertexai";
|
|
88
88
|
}
|
|
89
89
|
else if (modelLcName === "ChatGoogleGenerativeAI") {
|
package/dist/hub/base.js
CHANGED
|
@@ -78,7 +78,7 @@ modelClass) {
|
|
|
78
78
|
else if (modelLcName === "ChatAzureOpenAI") {
|
|
79
79
|
importMapKey = "chat_models__openai";
|
|
80
80
|
}
|
|
81
|
-
else if (modelLcName === "
|
|
81
|
+
else if (modelLcName === "ChatVertexAI") {
|
|
82
82
|
importMapKey = "chat_models__vertexai";
|
|
83
83
|
}
|
|
84
84
|
else if (modelLcName === "ChatGoogleGenerativeAI") {
|
package/dist/hub/node.cjs
CHANGED
|
@@ -29,7 +29,7 @@ async function pull(ownerRepoCommit, options) {
|
|
|
29
29
|
else if (modelName === "ChatAzureOpenAI") {
|
|
30
30
|
modelClass = (await import("@langchain/openai")).AzureChatOpenAI;
|
|
31
31
|
}
|
|
32
|
-
else if (modelName === "
|
|
32
|
+
else if (modelName === "ChatVertexAI") {
|
|
33
33
|
modelClass = (await import("@langchain/google-vertexai")).ChatVertexAI;
|
|
34
34
|
}
|
|
35
35
|
else if (modelName === "ChatGoogleGenerativeAI") {
|
package/dist/hub/node.js
CHANGED
|
@@ -27,7 +27,7 @@ export async function pull(ownerRepoCommit, options) {
|
|
|
27
27
|
else if (modelName === "ChatAzureOpenAI") {
|
|
28
28
|
modelClass = (await import("@langchain/openai")).AzureChatOpenAI;
|
|
29
29
|
}
|
|
30
|
-
else if (modelName === "
|
|
30
|
+
else if (modelName === "ChatVertexAI") {
|
|
31
31
|
modelClass = (await import("@langchain/google-vertexai")).ChatVertexAI;
|
|
32
32
|
}
|
|
33
33
|
else if (modelName === "ChatGoogleGenerativeAI") {
|
package/dist/util/openapi.cjs
CHANGED
|
@@ -177,13 +177,13 @@ class OpenAPISpec {
|
|
|
177
177
|
static getCleanedOperationId(operation, path, method) {
|
|
178
178
|
let { operationId } = operation;
|
|
179
179
|
if (operationId === undefined) {
|
|
180
|
-
const updatedPath = path.replaceAll(/[^a-zA-Z0-9]
|
|
180
|
+
const updatedPath = path.replaceAll(/[^a-zA-Z0-9]/g, "_");
|
|
181
181
|
operationId = `${updatedPath.startsWith("/") ? updatedPath.slice(1) : updatedPath}_${method}`;
|
|
182
182
|
}
|
|
183
183
|
return operationId
|
|
184
|
-
.replaceAll(
|
|
185
|
-
.replaceAll(
|
|
186
|
-
.replaceAll(
|
|
184
|
+
.replaceAll(/-/g, "_")
|
|
185
|
+
.replaceAll(/\./g, "_")
|
|
186
|
+
.replaceAll(/\//g, "_");
|
|
187
187
|
}
|
|
188
188
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
189
189
|
static alertUnsupportedSpec(document) {
|
package/dist/util/openapi.js
CHANGED
|
@@ -151,13 +151,13 @@ export class OpenAPISpec {
|
|
|
151
151
|
static getCleanedOperationId(operation, path, method) {
|
|
152
152
|
let { operationId } = operation;
|
|
153
153
|
if (operationId === undefined) {
|
|
154
|
-
const updatedPath = path.replaceAll(/[^a-zA-Z0-9]
|
|
154
|
+
const updatedPath = path.replaceAll(/[^a-zA-Z0-9]/g, "_");
|
|
155
155
|
operationId = `${updatedPath.startsWith("/") ? updatedPath.slice(1) : updatedPath}_${method}`;
|
|
156
156
|
}
|
|
157
157
|
return operationId
|
|
158
|
-
.replaceAll(
|
|
159
|
-
.replaceAll(
|
|
160
|
-
.replaceAll(
|
|
158
|
+
.replaceAll(/-/g, "_")
|
|
159
|
+
.replaceAll(/\./g, "_")
|
|
160
|
+
.replaceAll(/\//g, "_");
|
|
161
161
|
}
|
|
162
162
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
163
163
|
static alertUnsupportedSpec(document) {
|