langchain 0.0.63 → 0.0.65

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.
Files changed (163) hide show
  1. package/dist/agents/agent.cjs +3 -4
  2. package/dist/agents/agent.js +3 -4
  3. package/dist/agents/chat_convo/prompt.cjs +1 -1
  4. package/dist/agents/chat_convo/prompt.d.ts +1 -1
  5. package/dist/agents/chat_convo/prompt.js +1 -1
  6. package/dist/agents/initialize.cjs +1 -1
  7. package/dist/agents/initialize.d.ts +1 -1
  8. package/dist/agents/initialize.js +1 -1
  9. package/dist/agents/types.cjs +2 -2
  10. package/dist/agents/types.d.ts +2 -1
  11. package/dist/agents/types.js +1 -1
  12. package/dist/base_language/index.d.ts +4 -1
  13. package/dist/callbacks/manager.cjs +5 -1
  14. package/dist/callbacks/manager.js +5 -1
  15. package/dist/chains/analyze_documents_chain.cjs +3 -3
  16. package/dist/chains/analyze_documents_chain.d.ts +2 -1
  17. package/dist/chains/analyze_documents_chain.js +3 -3
  18. package/dist/chains/base.cjs +30 -11
  19. package/dist/chains/base.d.ts +7 -3
  20. package/dist/chains/base.js +30 -11
  21. package/dist/chains/chat_vector_db_chain.cjs +4 -4
  22. package/dist/chains/chat_vector_db_chain.d.ts +9 -15
  23. package/dist/chains/chat_vector_db_chain.js +4 -4
  24. package/dist/chains/combine_docs_chain.cjs +11 -11
  25. package/dist/chains/combine_docs_chain.d.ts +6 -5
  26. package/dist/chains/combine_docs_chain.js +11 -11
  27. package/dist/chains/conversational_retrieval_chain.cjs +4 -4
  28. package/dist/chains/conversational_retrieval_chain.d.ts +2 -1
  29. package/dist/chains/conversational_retrieval_chain.js +4 -4
  30. package/dist/chains/index.cjs +4 -3
  31. package/dist/chains/index.d.ts +2 -2
  32. package/dist/chains/index.js +1 -1
  33. package/dist/chains/llm_chain.cjs +4 -4
  34. package/dist/chains/llm_chain.d.ts +3 -2
  35. package/dist/chains/llm_chain.js +4 -4
  36. package/dist/chains/retrieval_qa.cjs +3 -3
  37. package/dist/chains/retrieval_qa.d.ts +2 -1
  38. package/dist/chains/retrieval_qa.js +3 -3
  39. package/dist/chains/sequential_chain.cjs +262 -0
  40. package/dist/chains/{simple_sequential_chain.d.ts → sequential_chain.d.ts} +31 -2
  41. package/dist/chains/sequential_chain.js +257 -0
  42. package/dist/chains/serde.d.ts +7 -1
  43. package/dist/chains/sql_db/sql_db_chain.cjs +7 -5
  44. package/dist/chains/sql_db/sql_db_chain.d.ts +2 -1
  45. package/dist/chains/sql_db/sql_db_chain.js +7 -5
  46. package/dist/chains/vector_db_qa.cjs +3 -3
  47. package/dist/chains/vector_db_qa.d.ts +2 -1
  48. package/dist/chains/vector_db_qa.js +3 -3
  49. package/dist/chat_models/base.d.ts +10 -8
  50. package/dist/chat_models/openai.cjs +9 -5
  51. package/dist/chat_models/openai.d.ts +14 -5
  52. package/dist/chat_models/openai.js +10 -6
  53. package/dist/document_loaders/fs/unstructured.cjs +48 -1
  54. package/dist/document_loaders/fs/unstructured.d.ts +9 -1
  55. package/dist/document_loaders/fs/unstructured.js +46 -0
  56. package/dist/embeddings/tensorflow.cjs +67 -0
  57. package/dist/embeddings/tensorflow.d.ts +12 -0
  58. package/dist/embeddings/tensorflow.js +40 -0
  59. package/dist/experimental/autogpt/output_parser.cjs +2 -2
  60. package/dist/experimental/autogpt/output_parser.d.ts +1 -1
  61. package/dist/experimental/autogpt/output_parser.js +1 -1
  62. package/dist/experimental/babyagi/agent.cjs +194 -0
  63. package/dist/experimental/babyagi/agent.d.ts +47 -0
  64. package/dist/experimental/babyagi/agent.js +190 -0
  65. package/dist/experimental/babyagi/index.cjs +11 -0
  66. package/dist/experimental/babyagi/index.d.ts +4 -0
  67. package/dist/experimental/babyagi/index.js +4 -0
  68. package/dist/experimental/babyagi/task_creation.cjs +29 -0
  69. package/dist/experimental/babyagi/task_creation.d.ts +5 -0
  70. package/dist/experimental/babyagi/task_creation.js +25 -0
  71. package/dist/experimental/babyagi/task_execution.cjs +20 -0
  72. package/dist/experimental/babyagi/task_execution.d.ts +5 -0
  73. package/dist/experimental/babyagi/task_execution.js +16 -0
  74. package/dist/experimental/babyagi/task_prioritization.cjs +23 -0
  75. package/dist/experimental/babyagi/task_prioritization.d.ts +5 -0
  76. package/dist/experimental/babyagi/task_prioritization.js +19 -0
  77. package/dist/llms/base.cjs +0 -9
  78. package/dist/llms/base.d.ts +11 -12
  79. package/dist/llms/base.js +0 -9
  80. package/dist/llms/openai-chat.cjs +9 -5
  81. package/dist/llms/openai-chat.d.ts +16 -7
  82. package/dist/llms/openai-chat.js +9 -5
  83. package/dist/llms/openai.cjs +9 -5
  84. package/dist/llms/openai.d.ts +15 -12
  85. package/dist/llms/openai.js +10 -6
  86. package/dist/memory/base.d.ts +1 -0
  87. package/dist/memory/buffer_memory.cjs +3 -0
  88. package/dist/memory/buffer_memory.d.ts +1 -0
  89. package/dist/memory/buffer_memory.js +3 -0
  90. package/dist/memory/buffer_window_memory.cjs +5 -0
  91. package/dist/memory/buffer_window_memory.d.ts +1 -0
  92. package/dist/memory/buffer_window_memory.js +5 -0
  93. package/dist/memory/motorhead_memory.cjs +3 -0
  94. package/dist/memory/motorhead_memory.d.ts +1 -0
  95. package/dist/memory/motorhead_memory.js +3 -0
  96. package/dist/memory/summary.cjs +3 -0
  97. package/dist/memory/summary.d.ts +1 -0
  98. package/dist/memory/summary.js +3 -0
  99. package/dist/output_parsers/combining.cjs +4 -4
  100. package/dist/output_parsers/combining.d.ts +3 -2
  101. package/dist/output_parsers/combining.js +3 -3
  102. package/dist/output_parsers/fix.cjs +6 -6
  103. package/dist/output_parsers/fix.d.ts +3 -2
  104. package/dist/output_parsers/fix.js +4 -4
  105. package/dist/output_parsers/list.cjs +3 -3
  106. package/dist/output_parsers/list.d.ts +1 -1
  107. package/dist/output_parsers/list.js +1 -1
  108. package/dist/output_parsers/regex.cjs +3 -3
  109. package/dist/output_parsers/regex.d.ts +1 -1
  110. package/dist/output_parsers/regex.js +1 -1
  111. package/dist/output_parsers/structured.cjs +10 -4
  112. package/dist/output_parsers/structured.d.ts +1 -1
  113. package/dist/output_parsers/structured.js +9 -3
  114. package/dist/prompts/base.d.ts +2 -1
  115. package/dist/prompts/chat.cjs +16 -2
  116. package/dist/prompts/chat.d.ts +2 -2
  117. package/dist/prompts/chat.js +16 -2
  118. package/dist/retrievers/supabase.cjs +2 -2
  119. package/dist/retrievers/supabase.js +2 -2
  120. package/dist/schema/index.cjs +1 -21
  121. package/dist/schema/index.d.ts +0 -30
  122. package/dist/schema/index.js +0 -18
  123. package/dist/schema/output_parser.cjs +23 -0
  124. package/dist/schema/output_parser.d.ts +32 -0
  125. package/dist/schema/output_parser.js +18 -0
  126. package/dist/tools/base.cjs +4 -4
  127. package/dist/tools/base.d.ts +4 -7
  128. package/dist/tools/base.js +4 -4
  129. package/dist/tools/fs.cjs +4 -4
  130. package/dist/tools/fs.d.ts +2 -2
  131. package/dist/tools/fs.js +4 -4
  132. package/dist/tools/serpapi.cjs +17 -10
  133. package/dist/tools/serpapi.d.ts +4 -1
  134. package/dist/tools/serpapi.js +17 -10
  135. package/dist/tools/webbrowser.cjs +5 -5
  136. package/dist/tools/webbrowser.d.ts +6 -6
  137. package/dist/tools/webbrowser.js +5 -5
  138. package/dist/util/async_caller.cjs +9 -0
  139. package/dist/util/async_caller.js +9 -0
  140. package/dist/util/axios-fetch-adapter.cjs +6 -0
  141. package/dist/util/axios-fetch-adapter.js +6 -0
  142. package/dist/util/axios-types.d.ts +3 -1
  143. package/dist/util/flatten.cjs +21 -0
  144. package/dist/util/flatten.d.ts +1 -0
  145. package/dist/util/flatten.js +17 -0
  146. package/dist/util/set.cjs +41 -0
  147. package/dist/util/set.d.ts +15 -0
  148. package/dist/util/set.js +35 -0
  149. package/dist/vectorstores/pinecone.cjs +4 -0
  150. package/dist/vectorstores/pinecone.js +4 -0
  151. package/dist/vectorstores/supabase.cjs +1 -1
  152. package/dist/vectorstores/supabase.js +1 -1
  153. package/dist/vectorstores/weaviate.cjs +15 -9
  154. package/dist/vectorstores/weaviate.js +15 -9
  155. package/embeddings/tensorflow.cjs +1 -0
  156. package/embeddings/tensorflow.d.ts +1 -0
  157. package/embeddings/tensorflow.js +1 -0
  158. package/experimental/babyagi.cjs +1 -0
  159. package/experimental/babyagi.d.ts +1 -0
  160. package/experimental/babyagi.js +1 -0
  161. package/package.json +36 -5
  162. package/dist/chains/simple_sequential_chain.cjs +0 -124
  163. package/dist/chains/simple_sequential_chain.js +0 -120
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
4
4
  "description": "Typescript bindings for langchain",
5
5
  "type": "module",
6
6
  "engines": {
@@ -52,6 +52,9 @@
52
52
  "embeddings/cohere.cjs",
53
53
  "embeddings/cohere.js",
54
54
  "embeddings/cohere.d.ts",
55
+ "embeddings/tensorflow.cjs",
56
+ "embeddings/tensorflow.js",
57
+ "embeddings/tensorflow.d.ts",
55
58
  "llms.cjs",
56
59
  "llms.js",
57
60
  "llms.d.ts",
@@ -253,6 +256,9 @@
253
256
  "experimental/autogpt.cjs",
254
257
  "experimental/autogpt.js",
255
258
  "experimental/autogpt.d.ts",
259
+ "experimental/babyagi.cjs",
260
+ "experimental/babyagi.js",
261
+ "experimental/babyagi.d.ts",
256
262
  "index.cjs",
257
263
  "index.js",
258
264
  "index.d.ts"
@@ -275,7 +281,7 @@
275
281
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts",
276
282
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
277
283
  "test:integration": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 50000",
278
- "test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 50000 -- ",
284
+ "test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 50000",
279
285
  "format": "prettier --write \"src\"",
280
286
  "format:check": "prettier --check \"src\""
281
287
  },
@@ -289,8 +295,12 @@
289
295
  "@huggingface/inference": "^1.5.1",
290
296
  "@jest/globals": "^29.5.0",
291
297
  "@opensearch-project/opensearch": "^2.2.0",
292
- "@pinecone-database/pinecone": "^0.0.12",
298
+ "@pinecone-database/pinecone": "^0.0.14",
293
299
  "@supabase/supabase-js": "^2.10.0",
300
+ "@tensorflow-models/universal-sentence-encoder": "^1.3.3",
301
+ "@tensorflow/tfjs-backend-cpu": "^4.4.0",
302
+ "@tensorflow/tfjs-converter": "^4.4.0",
303
+ "@tensorflow/tfjs-core": "^4.4.0",
294
304
  "@tsconfig/recommended": "^1.0.2",
295
305
  "@types/d3-dsv": "^2",
296
306
  "@types/flat": "^5.0.2",
@@ -321,7 +331,6 @@
321
331
  "mammoth": "^1.5.1",
322
332
  "mongodb": "^5.2.0",
323
333
  "pdf-parse": "1.1.1",
324
- "pdfjs-dist": "^3.4.120",
325
334
  "playwright": "^1.32.1",
326
335
  "prettier": "^2.8.3",
327
336
  "puppeteer": "^19.7.2",
@@ -344,8 +353,11 @@
344
353
  "@opensearch-project/opensearch": "*",
345
354
  "@pinecone-database/pinecone": "*",
346
355
  "@supabase/supabase-js": "^2.10.0",
356
+ "@tensorflow-models/universal-sentence-encoder": "*",
357
+ "@tensorflow/tfjs-converter": "*",
358
+ "@tensorflow/tfjs-core": "*",
347
359
  "@zilliz/milvus2-sdk-node": "^2.2.0",
348
- "axios": "^0.26.0",
360
+ "axios": "*",
349
361
  "cheerio": "^1.0.0-rc.12",
350
362
  "chromadb": "^1.4.0",
351
363
  "cohere-ai": "^5.0.2",
@@ -386,6 +398,15 @@
386
398
  "@supabase/supabase-js": {
387
399
  "optional": true
388
400
  },
401
+ "@tensorflow-models/universal-sentence-encoder": {
402
+ "optional": true
403
+ },
404
+ "@tensorflow/tfjs-converter": {
405
+ "optional": true
406
+ },
407
+ "@tensorflow/tfjs-core": {
408
+ "optional": true
409
+ },
389
410
  "@zilliz/milvus2-sdk-node": {
390
411
  "optional": true
391
412
  },
@@ -557,6 +578,11 @@
557
578
  "import": "./embeddings/cohere.js",
558
579
  "require": "./embeddings/cohere.cjs"
559
580
  },
581
+ "./embeddings/tensorflow": {
582
+ "types": "./embeddings/tensorflow.d.ts",
583
+ "import": "./embeddings/tensorflow.js",
584
+ "require": "./embeddings/tensorflow.cjs"
585
+ },
560
586
  "./llms": {
561
587
  "node": {
562
588
  "types": "./llms.d.ts",
@@ -902,6 +928,11 @@
902
928
  "import": "./experimental/autogpt.js",
903
929
  "require": "./experimental/autogpt.cjs"
904
930
  },
931
+ "./experimental/babyagi": {
932
+ "types": "./experimental/babyagi.d.ts",
933
+ "import": "./experimental/babyagi.js",
934
+ "require": "./experimental/babyagi.cjs"
935
+ },
905
936
  "./package.json": "./package.json"
906
937
  }
907
938
  }
@@ -1,124 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SimpleSequentialChain = void 0;
4
- const base_js_1 = require("./base.cjs");
5
- /**
6
- * Simple chain where a single string output of one chain is fed directly into the next.
7
- * @augments BaseChain
8
- * @augments SimpleSequentialChainInput
9
- *
10
- * @example
11
- * ```ts
12
- * import { SimpleSequentialChain, LLMChain } from "langchain/chains";
13
- * import { OpenAI } from "langchain/llms/openai";
14
- * import { PromptTemplate } from "langchain/prompts";
15
- *
16
- * // This is an LLMChain to write a synopsis given a title of a play.
17
- * const llm = new OpenAI({ temperature: 0 });
18
- * const template = `You are a playwright. Given the title of play, it is your job to write a synopsis for that title.
19
- *
20
- * Title: {title}
21
- * Playwright: This is a synopsis for the above play:`
22
- * const promptTemplate = new PromptTemplate({ template, inputVariables: ["title"] });
23
- * const synopsisChain = new LLMChain({ llm, prompt: promptTemplate });
24
- *
25
- *
26
- * // This is an LLMChain to write a review of a play given a synopsis.
27
- * const reviewLLM = new OpenAI({ temperature: 0 })
28
- * const reviewTemplate = `You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.
29
- *
30
- * Play Synopsis:
31
- * {synopsis}
32
- * Review from a New York Times play critic of the above play:`
33
- * const reviewPromptTempalte = new PromptTemplate({ template: reviewTemplate, inputVariables: ["synopsis"] });
34
- * const reviewChain = new LLMChain({ llm: reviewLLM, prompt: reviewPromptTempalte });
35
- *
36
- * const overallChain = new SimpleSequentialChain({chains: [synopsisChain, reviewChain], verbose:true})
37
- * const review = await overallChain.run("Tragedy at sunset on the beach")
38
- * // the variable review contains resulting play review.
39
- * ```
40
- */
41
- class SimpleSequentialChain extends base_js_1.BaseChain {
42
- get inputKeys() {
43
- return [this.inputKey];
44
- }
45
- get outputKeys() {
46
- return [this.outputKey];
47
- }
48
- constructor(fields) {
49
- super(fields.memory, fields.verbose, fields.callbacks ?? fields.callbackManager);
50
- Object.defineProperty(this, "chains", {
51
- enumerable: true,
52
- configurable: true,
53
- writable: true,
54
- value: void 0
55
- });
56
- Object.defineProperty(this, "inputKey", {
57
- enumerable: true,
58
- configurable: true,
59
- writable: true,
60
- value: "input"
61
- });
62
- Object.defineProperty(this, "outputKey", {
63
- enumerable: true,
64
- configurable: true,
65
- writable: true,
66
- value: "output"
67
- });
68
- Object.defineProperty(this, "trimOutputs", {
69
- enumerable: true,
70
- configurable: true,
71
- writable: true,
72
- value: void 0
73
- });
74
- this.chains = fields.chains;
75
- this.trimOutputs = fields.trimOutputs ?? false;
76
- this._validateChains();
77
- }
78
- /** @ignore */
79
- _validateChains() {
80
- for (const chain of this.chains) {
81
- if (chain.inputKeys.length !== 1) {
82
- throw new Error(`Chains used in SimpleSequentialChain should all have one input, got ${chain.inputKeys.length} for ${chain._chainType()}.`);
83
- }
84
- if (chain.outputKeys.length !== 1) {
85
- throw new Error(`Chains used in SimpleSequentialChain should all have one output, got ${chain.outputKeys.length} for ${chain._chainType()}.`);
86
- }
87
- }
88
- }
89
- /** @ignore */
90
- async _call(values, runManager) {
91
- let input = values[this.inputKey];
92
- for (const chain of this.chains) {
93
- input = await chain.run(input);
94
- if (this.trimOutputs) {
95
- input = input.trim();
96
- }
97
- await runManager?.handleText(input);
98
- }
99
- return { [this.outputKey]: input };
100
- }
101
- _chainType() {
102
- return "simple_sequential_chain";
103
- }
104
- static async deserialize(data) {
105
- const chains = [];
106
- const serializedChains = data.chains;
107
- for (const serializedChain of serializedChains) {
108
- const deserializedChain = await base_js_1.BaseChain.deserialize(serializedChain);
109
- chains.push(deserializedChain);
110
- }
111
- return new SimpleSequentialChain({ chains });
112
- }
113
- serialize() {
114
- const chains = [];
115
- for (const chain of this.chains) {
116
- chains.push(chain.serialize());
117
- }
118
- return {
119
- _type: this._chainType(),
120
- chains,
121
- };
122
- }
123
- }
124
- exports.SimpleSequentialChain = SimpleSequentialChain;
@@ -1,120 +0,0 @@
1
- import { BaseChain } from "./base.js";
2
- /**
3
- * Simple chain where a single string output of one chain is fed directly into the next.
4
- * @augments BaseChain
5
- * @augments SimpleSequentialChainInput
6
- *
7
- * @example
8
- * ```ts
9
- * import { SimpleSequentialChain, LLMChain } from "langchain/chains";
10
- * import { OpenAI } from "langchain/llms/openai";
11
- * import { PromptTemplate } from "langchain/prompts";
12
- *
13
- * // This is an LLMChain to write a synopsis given a title of a play.
14
- * const llm = new OpenAI({ temperature: 0 });
15
- * const template = `You are a playwright. Given the title of play, it is your job to write a synopsis for that title.
16
- *
17
- * Title: {title}
18
- * Playwright: This is a synopsis for the above play:`
19
- * const promptTemplate = new PromptTemplate({ template, inputVariables: ["title"] });
20
- * const synopsisChain = new LLMChain({ llm, prompt: promptTemplate });
21
- *
22
- *
23
- * // This is an LLMChain to write a review of a play given a synopsis.
24
- * const reviewLLM = new OpenAI({ temperature: 0 })
25
- * const reviewTemplate = `You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.
26
- *
27
- * Play Synopsis:
28
- * {synopsis}
29
- * Review from a New York Times play critic of the above play:`
30
- * const reviewPromptTempalte = new PromptTemplate({ template: reviewTemplate, inputVariables: ["synopsis"] });
31
- * const reviewChain = new LLMChain({ llm: reviewLLM, prompt: reviewPromptTempalte });
32
- *
33
- * const overallChain = new SimpleSequentialChain({chains: [synopsisChain, reviewChain], verbose:true})
34
- * const review = await overallChain.run("Tragedy at sunset on the beach")
35
- * // the variable review contains resulting play review.
36
- * ```
37
- */
38
- export class SimpleSequentialChain extends BaseChain {
39
- get inputKeys() {
40
- return [this.inputKey];
41
- }
42
- get outputKeys() {
43
- return [this.outputKey];
44
- }
45
- constructor(fields) {
46
- super(fields.memory, fields.verbose, fields.callbacks ?? fields.callbackManager);
47
- Object.defineProperty(this, "chains", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: void 0
52
- });
53
- Object.defineProperty(this, "inputKey", {
54
- enumerable: true,
55
- configurable: true,
56
- writable: true,
57
- value: "input"
58
- });
59
- Object.defineProperty(this, "outputKey", {
60
- enumerable: true,
61
- configurable: true,
62
- writable: true,
63
- value: "output"
64
- });
65
- Object.defineProperty(this, "trimOutputs", {
66
- enumerable: true,
67
- configurable: true,
68
- writable: true,
69
- value: void 0
70
- });
71
- this.chains = fields.chains;
72
- this.trimOutputs = fields.trimOutputs ?? false;
73
- this._validateChains();
74
- }
75
- /** @ignore */
76
- _validateChains() {
77
- for (const chain of this.chains) {
78
- if (chain.inputKeys.length !== 1) {
79
- throw new Error(`Chains used in SimpleSequentialChain should all have one input, got ${chain.inputKeys.length} for ${chain._chainType()}.`);
80
- }
81
- if (chain.outputKeys.length !== 1) {
82
- throw new Error(`Chains used in SimpleSequentialChain should all have one output, got ${chain.outputKeys.length} for ${chain._chainType()}.`);
83
- }
84
- }
85
- }
86
- /** @ignore */
87
- async _call(values, runManager) {
88
- let input = values[this.inputKey];
89
- for (const chain of this.chains) {
90
- input = await chain.run(input);
91
- if (this.trimOutputs) {
92
- input = input.trim();
93
- }
94
- await runManager?.handleText(input);
95
- }
96
- return { [this.outputKey]: input };
97
- }
98
- _chainType() {
99
- return "simple_sequential_chain";
100
- }
101
- static async deserialize(data) {
102
- const chains = [];
103
- const serializedChains = data.chains;
104
- for (const serializedChain of serializedChains) {
105
- const deserializedChain = await BaseChain.deserialize(serializedChain);
106
- chains.push(deserializedChain);
107
- }
108
- return new SimpleSequentialChain({ chains });
109
- }
110
- serialize() {
111
- const chains = [];
112
- for (const chain of this.chains) {
113
- chains.push(chain.serialize());
114
- }
115
- return {
116
- _type: this._chainType(),
117
- chains,
118
- };
119
- }
120
- }