langchain 0.0.196 → 0.0.197-rc.1

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 (225) hide show
  1. package/LICENSE +21 -0
  2. package/dist/agents/executor.cjs +351 -1
  3. package/dist/agents/executor.d.ts +61 -3
  4. package/dist/agents/executor.js +350 -1
  5. package/dist/agents/openai/index.cjs +6 -2
  6. package/dist/agents/openai/index.js +6 -2
  7. package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts +1 -1
  8. package/dist/base_language/count_tokens.cjs +4 -4
  9. package/dist/base_language/count_tokens.d.ts +1 -1
  10. package/dist/base_language/count_tokens.js +1 -1
  11. package/dist/base_language/index.cjs +3 -3
  12. package/dist/base_language/index.d.ts +1 -1
  13. package/dist/base_language/index.js +1 -1
  14. package/dist/cache/base.cjs +1 -1
  15. package/dist/cache/base.d.ts +1 -1
  16. package/dist/cache/base.js +1 -1
  17. package/dist/cache/index.cjs +2 -2
  18. package/dist/cache/index.d.ts +1 -1
  19. package/dist/cache/index.js +1 -1
  20. package/dist/callbacks/base.cjs +1 -1
  21. package/dist/callbacks/base.d.ts +1 -1
  22. package/dist/callbacks/base.js +1 -1
  23. package/dist/callbacks/handlers/console.cjs +1 -1
  24. package/dist/callbacks/handlers/console.d.ts +1 -1
  25. package/dist/callbacks/handlers/console.js +1 -1
  26. package/dist/callbacks/handlers/initialize.cjs +1 -1
  27. package/dist/callbacks/handlers/initialize.d.ts +1 -1
  28. package/dist/callbacks/handlers/initialize.js +1 -1
  29. package/dist/callbacks/handlers/log_stream.cjs +1 -1
  30. package/dist/callbacks/handlers/log_stream.d.ts +1 -1
  31. package/dist/callbacks/handlers/log_stream.js +1 -1
  32. package/dist/callbacks/handlers/run_collector.cjs +1 -1
  33. package/dist/callbacks/handlers/run_collector.d.ts +1 -1
  34. package/dist/callbacks/handlers/run_collector.js +1 -1
  35. package/dist/callbacks/handlers/tracer.cjs +1 -1
  36. package/dist/callbacks/handlers/tracer.d.ts +1 -1
  37. package/dist/callbacks/handlers/tracer.js +1 -1
  38. package/dist/callbacks/handlers/tracer_langchain.cjs +1 -1
  39. package/dist/callbacks/handlers/tracer_langchain.d.ts +1 -1
  40. package/dist/callbacks/handlers/tracer_langchain.js +1 -1
  41. package/dist/callbacks/handlers/tracer_langchain_v1.cjs +1 -1
  42. package/dist/callbacks/handlers/tracer_langchain_v1.d.ts +1 -1
  43. package/dist/callbacks/handlers/tracer_langchain_v1.js +1 -1
  44. package/dist/callbacks/manager.cjs +1 -1
  45. package/dist/callbacks/manager.d.ts +1 -1
  46. package/dist/callbacks/manager.js +1 -1
  47. package/dist/callbacks/promises.cjs +1 -1
  48. package/dist/callbacks/promises.d.ts +1 -1
  49. package/dist/callbacks/promises.js +1 -1
  50. package/dist/chains/base.cjs +16 -0
  51. package/dist/chains/base.d.ts +2 -0
  52. package/dist/chains/base.js +16 -0
  53. package/dist/chains/openai_functions/structured_output.cjs +1 -1
  54. package/dist/chains/openai_functions/structured_output.d.ts +1 -1
  55. package/dist/chains/openai_functions/structured_output.js +1 -1
  56. package/dist/chains/openai_moderation.cjs +2 -2
  57. package/dist/chains/openai_moderation.d.ts +1 -1
  58. package/dist/chains/openai_moderation.js +1 -1
  59. package/dist/chat_models/anthropic.cjs +15 -348
  60. package/dist/chat_models/anthropic.d.ts +1 -156
  61. package/dist/chat_models/anthropic.js +1 -346
  62. package/dist/chat_models/base.cjs +1 -1
  63. package/dist/chat_models/base.d.ts +1 -1
  64. package/dist/chat_models/base.js +1 -1
  65. package/dist/chat_models/bedrock/web.cjs +21 -1
  66. package/dist/chat_models/bedrock/web.d.ts +1 -1
  67. package/dist/chat_models/bedrock/web.js +21 -1
  68. package/dist/chat_models/fireworks.d.ts +2 -2
  69. package/dist/chat_models/iflytek_xinghuo/common.d.ts +1 -1
  70. package/dist/chat_models/minimax.d.ts +2 -2
  71. package/dist/chat_models/openai.cjs +4 -698
  72. package/dist/chat_models/openai.d.ts +4 -137
  73. package/dist/chat_models/openai.js +2 -695
  74. package/dist/document.cjs +2 -2
  75. package/dist/document.d.ts +1 -1
  76. package/dist/document.js +1 -1
  77. package/dist/document_loaders/fs/openai_whisper_audio.cjs +2 -2
  78. package/dist/document_loaders/fs/openai_whisper_audio.d.ts +1 -1
  79. package/dist/document_loaders/fs/openai_whisper_audio.js +1 -1
  80. package/dist/document_loaders/web/azure_blob_storage_file.d.ts +1 -1
  81. package/dist/document_loaders/web/github.cjs +105 -0
  82. package/dist/document_loaders/web/github.d.ts +26 -0
  83. package/dist/document_loaders/web/github.js +105 -0
  84. package/dist/document_loaders/web/s3.d.ts +1 -1
  85. package/dist/embeddings/base.cjs +1 -1
  86. package/dist/embeddings/base.d.ts +1 -1
  87. package/dist/embeddings/base.js +1 -1
  88. package/dist/embeddings/cache_backed.cjs +1 -1
  89. package/dist/embeddings/cache_backed.js +1 -1
  90. package/dist/embeddings/openai.cjs +2 -240
  91. package/dist/embeddings/openai.d.ts +1 -82
  92. package/dist/embeddings/openai.js +1 -239
  93. package/dist/experimental/openai_assistant/index.cjs +3 -3
  94. package/dist/experimental/openai_assistant/index.d.ts +1 -1
  95. package/dist/experimental/openai_assistant/index.js +1 -1
  96. package/dist/experimental/openai_assistant/schema.d.ts +1 -1
  97. package/dist/experimental/openai_files/index.cjs +2 -2
  98. package/dist/experimental/openai_files/index.d.ts +1 -1
  99. package/dist/experimental/openai_files/index.js +1 -1
  100. package/dist/experimental/plan_and_execute/prompt.d.ts +1 -1
  101. package/dist/llms/base.cjs +1 -1
  102. package/dist/llms/base.d.ts +1 -1
  103. package/dist/llms/base.js +1 -1
  104. package/dist/llms/bedrock/web.cjs +21 -1
  105. package/dist/llms/bedrock/web.d.ts +1 -1
  106. package/dist/llms/bedrock/web.js +21 -1
  107. package/dist/llms/fireworks.d.ts +2 -2
  108. package/dist/llms/openai-chat.cjs +3 -445
  109. package/dist/llms/openai-chat.d.ts +4 -123
  110. package/dist/llms/openai-chat.js +2 -443
  111. package/dist/llms/openai.cjs +6 -530
  112. package/dist/llms/openai.d.ts +4 -123
  113. package/dist/llms/openai.js +2 -525
  114. package/dist/load/index.cjs +4 -2
  115. package/dist/load/index.d.ts +2 -2
  116. package/dist/load/index.js +4 -2
  117. package/dist/load/serializable.cjs +1 -1
  118. package/dist/load/serializable.d.ts +1 -1
  119. package/dist/load/serializable.js +1 -1
  120. package/dist/memory/base.cjs +2 -2
  121. package/dist/memory/base.d.ts +2 -2
  122. package/dist/memory/base.js +2 -2
  123. package/dist/output_parsers/list.cjs +4 -122
  124. package/dist/output_parsers/list.d.ts +1 -57
  125. package/dist/output_parsers/list.js +1 -119
  126. package/dist/output_parsers/openai_functions.cjs +1 -1
  127. package/dist/output_parsers/openai_functions.d.ts +1 -1
  128. package/dist/output_parsers/openai_functions.js +1 -1
  129. package/dist/output_parsers/structured.d.ts +1 -1
  130. package/dist/prompts/base.cjs +8 -8
  131. package/dist/prompts/base.d.ts +3 -3
  132. package/dist/prompts/base.js +3 -3
  133. package/dist/prompts/chat.cjs +13 -15
  134. package/dist/prompts/chat.d.ts +2 -1
  135. package/dist/prompts/chat.js +2 -1
  136. package/dist/prompts/few_shot.cjs +4 -15
  137. package/dist/prompts/few_shot.d.ts +1 -1
  138. package/dist/prompts/few_shot.js +1 -1
  139. package/dist/prompts/index.cjs +2 -2
  140. package/dist/prompts/index.d.ts +1 -1
  141. package/dist/prompts/index.js +1 -1
  142. package/dist/prompts/pipeline.cjs +3 -15
  143. package/dist/prompts/pipeline.d.ts +1 -1
  144. package/dist/prompts/pipeline.js +1 -1
  145. package/dist/prompts/prompt.cjs +3 -15
  146. package/dist/prompts/prompt.d.ts +1 -1
  147. package/dist/prompts/prompt.js +1 -1
  148. package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +3 -15
  149. package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +1 -1
  150. package/dist/prompts/selectors/LengthBasedExampleSelector.js +1 -1
  151. package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +1 -1
  152. package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +1 -1
  153. package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +1 -1
  154. package/dist/prompts/selectors/conditional.cjs +6 -15
  155. package/dist/prompts/selectors/conditional.d.ts +1 -1
  156. package/dist/prompts/selectors/conditional.js +1 -1
  157. package/dist/prompts/serde.cjs +0 -15
  158. package/dist/prompts/serde.d.ts +1 -1
  159. package/dist/prompts/serde.js +1 -1
  160. package/dist/prompts/template.cjs +9 -15
  161. package/dist/prompts/template.d.ts +1 -1
  162. package/dist/prompts/template.js +1 -1
  163. package/dist/runnables/index.cjs +1 -1
  164. package/dist/runnables/index.d.ts +1 -1
  165. package/dist/runnables/index.js +1 -1
  166. package/dist/schema/document.cjs +3 -3
  167. package/dist/schema/document.d.ts +1 -1
  168. package/dist/schema/document.js +1 -1
  169. package/dist/schema/index.cjs +12 -12
  170. package/dist/schema/index.d.ts +11 -11
  171. package/dist/schema/index.js +7 -7
  172. package/dist/schema/output_parser.cjs +1 -1
  173. package/dist/schema/output_parser.d.ts +1 -1
  174. package/dist/schema/output_parser.js +1 -1
  175. package/dist/schema/retriever.cjs +1 -1
  176. package/dist/schema/retriever.d.ts +1 -1
  177. package/dist/schema/retriever.js +1 -1
  178. package/dist/schema/runnable/base.cjs +1 -1
  179. package/dist/schema/runnable/base.d.ts +1 -1
  180. package/dist/schema/runnable/base.js +1 -1
  181. package/dist/schema/runnable/branch.cjs +1 -1
  182. package/dist/schema/runnable/branch.d.ts +1 -1
  183. package/dist/schema/runnable/branch.js +1 -1
  184. package/dist/schema/runnable/config.d.ts +1 -1
  185. package/dist/schema/runnable/index.cjs +1 -1
  186. package/dist/schema/runnable/index.d.ts +1 -1
  187. package/dist/schema/runnable/index.js +1 -1
  188. package/dist/schema/runnable/passthrough.cjs +1 -1
  189. package/dist/schema/runnable/passthrough.d.ts +1 -1
  190. package/dist/schema/runnable/passthrough.js +1 -1
  191. package/dist/schema/runnable/router.cjs +1 -1
  192. package/dist/schema/runnable/router.d.ts +1 -1
  193. package/dist/schema/runnable/router.js +1 -1
  194. package/dist/schema/storage.cjs +1 -1
  195. package/dist/schema/storage.d.ts +1 -1
  196. package/dist/schema/storage.js +1 -1
  197. package/dist/tools/base.cjs +4 -108
  198. package/dist/tools/base.d.ts +1 -72
  199. package/dist/tools/base.js +1 -105
  200. package/dist/tools/bingserpapi.d.ts +1 -1
  201. package/dist/tools/convert_to_openai.cjs +4 -38
  202. package/dist/tools/convert_to_openai.d.ts +1 -11
  203. package/dist/tools/convert_to_openai.js +1 -35
  204. package/dist/tools/searchapi.d.ts +1 -1
  205. package/dist/tools/serpapi.d.ts +1 -1
  206. package/dist/tools/serper.d.ts +1 -1
  207. package/dist/types/openai-types.d.ts +1 -133
  208. package/dist/util/async_caller.cjs +1 -1
  209. package/dist/util/async_caller.d.ts +1 -1
  210. package/dist/util/async_caller.js +1 -1
  211. package/dist/util/openai.cjs +2 -18
  212. package/dist/util/openai.d.ts +1 -1
  213. package/dist/util/openai.js +1 -17
  214. package/dist/util/openapi.d.ts +2 -2
  215. package/dist/util/prompt-layer.d.ts +1 -1
  216. package/dist/vectorstores/momento_vector_index.cjs +39 -0
  217. package/dist/vectorstores/momento_vector_index.d.ts +17 -1
  218. package/dist/vectorstores/momento_vector_index.js +40 -1
  219. package/dist/vectorstores/mongodb_atlas.cjs +22 -2
  220. package/dist/vectorstores/mongodb_atlas.d.ts +13 -0
  221. package/dist/vectorstores/mongodb_atlas.js +22 -2
  222. package/package.json +12 -10
  223. package/dist/util/openai-format-fndef.cjs +0 -81
  224. package/dist/util/openai-format-fndef.d.ts +0 -44
  225. package/dist/util/openai-format-fndef.js +0 -77
@@ -1,125 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CustomListOutputParser = exports.CommaSeparatedListOutputParser = exports.ListOutputParser = void 0;
4
- const output_parser_js_1 = require("../schema/output_parser.cjs");
5
- /**
6
- * Class to parse the output of an LLM call to a list.
7
- * @augments BaseOutputParser
8
- */
9
- class ListOutputParser extends output_parser_js_1.BaseOutputParser {
10
- }
11
- exports.ListOutputParser = ListOutputParser;
12
- /**
13
- * Class to parse the output of an LLM call as a comma-separated list.
14
- * @augments ListOutputParser
15
- */
16
- class CommaSeparatedListOutputParser extends ListOutputParser {
17
- constructor() {
18
- super(...arguments);
19
- Object.defineProperty(this, "lc_namespace", {
20
- enumerable: true,
21
- configurable: true,
22
- writable: true,
23
- value: ["langchain", "output_parsers", "list"]
24
- });
25
- Object.defineProperty(this, "lc_serializable", {
26
- enumerable: true,
27
- configurable: true,
28
- writable: true,
29
- value: true
30
- });
31
- }
32
- static lc_name() {
33
- return "CommaSeparatedListOutputParser";
34
- }
35
- /**
36
- * Parses the given text into an array of strings, using a comma as the
37
- * separator. If the parsing fails, throws an OutputParserException.
38
- * @param text The text to parse.
39
- * @returns An array of strings obtained by splitting the input text at each comma.
40
- */
41
- async parse(text) {
42
- try {
43
- return text
44
- .trim()
45
- .split(",")
46
- .map((s) => s.trim());
47
- }
48
- catch (e) {
49
- throw new output_parser_js_1.OutputParserException(`Could not parse output: ${text}`, text);
50
- }
51
- }
52
- /**
53
- * Provides instructions on the expected format of the response for the
54
- * CommaSeparatedListOutputParser.
55
- * @returns A string containing instructions on the expected format of the response.
56
- */
57
- getFormatInstructions() {
58
- return `Your response should be a list of comma separated values, eg: \`foo, bar, baz\``;
59
- }
60
- }
61
- exports.CommaSeparatedListOutputParser = CommaSeparatedListOutputParser;
62
- /**
63
- * Class to parse the output of an LLM call to a list with a specific length and separator.
64
- * @augments ListOutputParser
65
- */
66
- class CustomListOutputParser extends ListOutputParser {
67
- constructor({ length, separator }) {
68
- super(...arguments);
69
- Object.defineProperty(this, "lc_namespace", {
70
- enumerable: true,
71
- configurable: true,
72
- writable: true,
73
- value: ["langchain", "output_parsers", "list"]
74
- });
75
- Object.defineProperty(this, "length", {
76
- enumerable: true,
77
- configurable: true,
78
- writable: true,
79
- value: void 0
80
- });
81
- Object.defineProperty(this, "separator", {
82
- enumerable: true,
83
- configurable: true,
84
- writable: true,
85
- value: void 0
86
- });
87
- this.length = length;
88
- this.separator = separator || ",";
89
- }
90
- /**
91
- * Parses the given text into an array of strings, using the specified
92
- * separator. If the parsing fails or the number of items in the list
93
- * doesn't match the expected length, throws an OutputParserException.
94
- * @param text The text to parse.
95
- * @returns An array of strings obtained by splitting the input text at each occurrence of the specified separator.
96
- */
97
- async parse(text) {
98
- try {
99
- const items = text
100
- .trim()
101
- .split(this.separator)
102
- .map((s) => s.trim());
103
- if (this.length !== undefined && items.length !== this.length) {
104
- throw new output_parser_js_1.OutputParserException(`Incorrect number of items. Expected ${this.length}, got ${items.length}.`);
105
- }
106
- return items;
107
- }
108
- catch (e) {
109
- if (Object.getPrototypeOf(e) === output_parser_js_1.OutputParserException.prototype) {
110
- throw e;
111
- }
112
- throw new output_parser_js_1.OutputParserException(`Could not parse output: ${text}`);
113
- }
114
- }
115
- /**
116
- * Provides instructions on the expected format of the response for the
117
- * CustomListOutputParser, including the number of items and the
118
- * separator.
119
- * @returns A string containing instructions on the expected format of the response.
120
- */
121
- getFormatInstructions() {
122
- return `Your response should be a list of ${this.length === undefined ? "" : `${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`;
123
- }
124
- }
125
- exports.CustomListOutputParser = CustomListOutputParser;
4
+ var output_parsers_1 = require("@langchain/core/output_parsers");
5
+ Object.defineProperty(exports, "ListOutputParser", { enumerable: true, get: function () { return output_parsers_1.ListOutputParser; } });
6
+ Object.defineProperty(exports, "CommaSeparatedListOutputParser", { enumerable: true, get: function () { return output_parsers_1.CommaSeparatedListOutputParser; } });
7
+ Object.defineProperty(exports, "CustomListOutputParser", { enumerable: true, get: function () { return output_parsers_1.CustomListOutputParser; } });
@@ -1,57 +1 @@
1
- import { BaseOutputParser } from "../schema/output_parser.js";
2
- /**
3
- * Class to parse the output of an LLM call to a list.
4
- * @augments BaseOutputParser
5
- */
6
- export declare abstract class ListOutputParser extends BaseOutputParser<string[]> {
7
- }
8
- /**
9
- * Class to parse the output of an LLM call as a comma-separated list.
10
- * @augments ListOutputParser
11
- */
12
- export declare class CommaSeparatedListOutputParser extends ListOutputParser {
13
- static lc_name(): string;
14
- lc_namespace: string[];
15
- lc_serializable: boolean;
16
- /**
17
- * Parses the given text into an array of strings, using a comma as the
18
- * separator. If the parsing fails, throws an OutputParserException.
19
- * @param text The text to parse.
20
- * @returns An array of strings obtained by splitting the input text at each comma.
21
- */
22
- parse(text: string): Promise<string[]>;
23
- /**
24
- * Provides instructions on the expected format of the response for the
25
- * CommaSeparatedListOutputParser.
26
- * @returns A string containing instructions on the expected format of the response.
27
- */
28
- getFormatInstructions(): string;
29
- }
30
- /**
31
- * Class to parse the output of an LLM call to a list with a specific length and separator.
32
- * @augments ListOutputParser
33
- */
34
- export declare class CustomListOutputParser extends ListOutputParser {
35
- lc_namespace: string[];
36
- private length;
37
- private separator;
38
- constructor({ length, separator }: {
39
- length?: number;
40
- separator?: string;
41
- });
42
- /**
43
- * Parses the given text into an array of strings, using the specified
44
- * separator. If the parsing fails or the number of items in the list
45
- * doesn't match the expected length, throws an OutputParserException.
46
- * @param text The text to parse.
47
- * @returns An array of strings obtained by splitting the input text at each occurrence of the specified separator.
48
- */
49
- parse(text: string): Promise<string[]>;
50
- /**
51
- * Provides instructions on the expected format of the response for the
52
- * CustomListOutputParser, including the number of items and the
53
- * separator.
54
- * @returns A string containing instructions on the expected format of the response.
55
- */
56
- getFormatInstructions(): string;
57
- }
1
+ export { ListOutputParser, CommaSeparatedListOutputParser, CustomListOutputParser, } from "@langchain/core/output_parsers";
@@ -1,119 +1 @@
1
- import { BaseOutputParser, OutputParserException, } from "../schema/output_parser.js";
2
- /**
3
- * Class to parse the output of an LLM call to a list.
4
- * @augments BaseOutputParser
5
- */
6
- export class ListOutputParser extends BaseOutputParser {
7
- }
8
- /**
9
- * Class to parse the output of an LLM call as a comma-separated list.
10
- * @augments ListOutputParser
11
- */
12
- export class CommaSeparatedListOutputParser extends ListOutputParser {
13
- constructor() {
14
- super(...arguments);
15
- Object.defineProperty(this, "lc_namespace", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: ["langchain", "output_parsers", "list"]
20
- });
21
- Object.defineProperty(this, "lc_serializable", {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: true
26
- });
27
- }
28
- static lc_name() {
29
- return "CommaSeparatedListOutputParser";
30
- }
31
- /**
32
- * Parses the given text into an array of strings, using a comma as the
33
- * separator. If the parsing fails, throws an OutputParserException.
34
- * @param text The text to parse.
35
- * @returns An array of strings obtained by splitting the input text at each comma.
36
- */
37
- async parse(text) {
38
- try {
39
- return text
40
- .trim()
41
- .split(",")
42
- .map((s) => s.trim());
43
- }
44
- catch (e) {
45
- throw new OutputParserException(`Could not parse output: ${text}`, text);
46
- }
47
- }
48
- /**
49
- * Provides instructions on the expected format of the response for the
50
- * CommaSeparatedListOutputParser.
51
- * @returns A string containing instructions on the expected format of the response.
52
- */
53
- getFormatInstructions() {
54
- return `Your response should be a list of comma separated values, eg: \`foo, bar, baz\``;
55
- }
56
- }
57
- /**
58
- * Class to parse the output of an LLM call to a list with a specific length and separator.
59
- * @augments ListOutputParser
60
- */
61
- export class CustomListOutputParser extends ListOutputParser {
62
- constructor({ length, separator }) {
63
- super(...arguments);
64
- Object.defineProperty(this, "lc_namespace", {
65
- enumerable: true,
66
- configurable: true,
67
- writable: true,
68
- value: ["langchain", "output_parsers", "list"]
69
- });
70
- Object.defineProperty(this, "length", {
71
- enumerable: true,
72
- configurable: true,
73
- writable: true,
74
- value: void 0
75
- });
76
- Object.defineProperty(this, "separator", {
77
- enumerable: true,
78
- configurable: true,
79
- writable: true,
80
- value: void 0
81
- });
82
- this.length = length;
83
- this.separator = separator || ",";
84
- }
85
- /**
86
- * Parses the given text into an array of strings, using the specified
87
- * separator. If the parsing fails or the number of items in the list
88
- * doesn't match the expected length, throws an OutputParserException.
89
- * @param text The text to parse.
90
- * @returns An array of strings obtained by splitting the input text at each occurrence of the specified separator.
91
- */
92
- async parse(text) {
93
- try {
94
- const items = text
95
- .trim()
96
- .split(this.separator)
97
- .map((s) => s.trim());
98
- if (this.length !== undefined && items.length !== this.length) {
99
- throw new OutputParserException(`Incorrect number of items. Expected ${this.length}, got ${items.length}.`);
100
- }
101
- return items;
102
- }
103
- catch (e) {
104
- if (Object.getPrototypeOf(e) === OutputParserException.prototype) {
105
- throw e;
106
- }
107
- throw new OutputParserException(`Could not parse output: ${text}`);
108
- }
109
- }
110
- /**
111
- * Provides instructions on the expected format of the response for the
112
- * CustomListOutputParser, including the number of items and the
113
- * separator.
114
- * @returns A string containing instructions on the expected format of the response.
115
- */
116
- getFormatInstructions() {
117
- return `Your response should be a list of ${this.length === undefined ? "" : `${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`;
118
- }
119
- }
1
+ export { ListOutputParser, CommaSeparatedListOutputParser, CustomListOutputParser, } from "@langchain/core/output_parsers";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsonKeyOutputFunctionsParser = exports.JsonOutputFunctionsParser = exports.OutputFunctionsParser = void 0;
4
- const json_patch_1 = require("langchain-core/util/json_patch");
4
+ const json_patch_1 = require("@langchain/core/utils/json_patch");
5
5
  const output_parser_js_1 = require("../schema/output_parser.cjs");
6
6
  const json_js_1 = require("./json.cjs");
7
7
  /**
@@ -1,5 +1,5 @@
1
1
  import { JsonSchema7ObjectType } from "zod-to-json-schema/src/parsers/object.js";
2
- import { type Operation as JSONPatchOperation } from "langchain-core/util/json_patch";
2
+ import { type Operation as JSONPatchOperation } from "@langchain/core/utils/json_patch";
3
3
  import { ChatGeneration, Generation } from "../schema/index.js";
4
4
  import { Optional } from "../types/type-utils.js";
5
5
  import { BaseCumulativeTransformOutputParser, type BaseCumulativeTransformOutputParserInput, BaseLLMOutputParser } from "../schema/output_parser.js";
@@ -1,4 +1,4 @@
1
- import { compare, } from "langchain-core/util/json_patch";
1
+ import { compare, } from "@langchain/core/utils/json_patch";
2
2
  import { BaseCumulativeTransformOutputParser, BaseLLMOutputParser, } from "../schema/output_parser.js";
3
3
  import { parsePartialJson } from "./json.js";
4
4
  /**
@@ -10,7 +10,7 @@ export declare class StructuredOutputParser<T extends z.ZodTypeAny> extends Base
10
10
  schema: T;
11
11
  static lc_name(): string;
12
12
  lc_namespace: string[];
13
- toJSON(): import("langchain-core/load/serializable").SerializedNotImplemented;
13
+ toJSON(): import("@langchain/core/load/serializable").SerializedNotImplemented;
14
14
  constructor(schema: T);
15
15
  /**
16
16
  * Creates a new StructuredOutputParser from a Zod schema.
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseExampleSelector = exports.BasePromptTemplate = exports.BaseStringPromptTemplate = exports.StringPromptValue = void 0;
4
- var base_1 = require("langchain-core/prompts/base");
5
- Object.defineProperty(exports, "StringPromptValue", { enumerable: true, get: function () { return base_1.StringPromptValue; } });
6
- Object.defineProperty(exports, "BaseStringPromptTemplate", { enumerable: true, get: function () { return base_1.BaseStringPromptTemplate; } });
7
- var prompt_template_1 = require("langchain-core/schema/prompt_template");
8
- Object.defineProperty(exports, "BasePromptTemplate", { enumerable: true, get: function () { return prompt_template_1.BasePromptTemplate; } });
9
- var base_2 = require("langchain-core/prompts/example_selector/base");
10
- Object.defineProperty(exports, "BaseExampleSelector", { enumerable: true, get: function () { return base_2.BaseExampleSelector; } });
3
+ exports.BaseExampleSelector = exports.StringPromptValue = exports.BasePromptTemplate = exports.BaseStringPromptTemplate = void 0;
4
+ var prompts_1 = require("@langchain/core/prompts");
5
+ Object.defineProperty(exports, "BaseStringPromptTemplate", { enumerable: true, get: function () { return prompts_1.BaseStringPromptTemplate; } });
6
+ Object.defineProperty(exports, "BasePromptTemplate", { enumerable: true, get: function () { return prompts_1.BasePromptTemplate; } });
7
+ var prompt_values_1 = require("@langchain/core/prompt_values");
8
+ Object.defineProperty(exports, "StringPromptValue", { enumerable: true, get: function () { return prompt_values_1.StringPromptValue; } });
9
+ var example_selectors_1 = require("@langchain/core/example_selectors");
10
+ Object.defineProperty(exports, "BaseExampleSelector", { enumerable: true, get: function () { return example_selectors_1.BaseExampleSelector; } });
@@ -1,3 +1,3 @@
1
- export { type TypedPromptInputValues, StringPromptValue, BaseStringPromptTemplate, } from "langchain-core/prompts/base";
2
- export { type BasePromptTemplateInput, BasePromptTemplate, } from "langchain-core/schema/prompt_template";
3
- export { BaseExampleSelector } from "langchain-core/prompts/example_selector/base";
1
+ export { type TypedPromptInputValues, BaseStringPromptTemplate, type BasePromptTemplateInput, BasePromptTemplate, } from "@langchain/core/prompts";
2
+ export { StringPromptValue } from "@langchain/core/prompt_values";
3
+ export { BaseExampleSelector } from "@langchain/core/example_selectors";
@@ -1,3 +1,3 @@
1
- export { StringPromptValue, BaseStringPromptTemplate, } from "langchain-core/prompts/base";
2
- export { BasePromptTemplate, } from "langchain-core/schema/prompt_template";
3
- export { BaseExampleSelector } from "langchain-core/prompts/example_selector/base";
1
+ export { BaseStringPromptTemplate, BasePromptTemplate, } from "@langchain/core/prompts";
2
+ export { StringPromptValue } from "@langchain/core/prompt_values";
3
+ export { BaseExampleSelector } from "@langchain/core/example_selectors";
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("langchain-core/prompts/chat"), exports);
3
+ exports.ChatPromptValue = exports.ChatPromptTemplate = exports.SystemMessagePromptTemplate = exports.AIMessagePromptTemplate = exports.HumanMessagePromptTemplate = exports.ChatMessagePromptTemplate = exports.BaseChatPromptTemplate = exports.BaseMessageStringPromptTemplate = exports.MessagesPlaceholder = exports.BaseMessagePromptTemplate = void 0;
4
+ var prompts_1 = require("@langchain/core/prompts");
5
+ Object.defineProperty(exports, "BaseMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.BaseMessagePromptTemplate; } });
6
+ Object.defineProperty(exports, "MessagesPlaceholder", { enumerable: true, get: function () { return prompts_1.MessagesPlaceholder; } });
7
+ Object.defineProperty(exports, "BaseMessageStringPromptTemplate", { enumerable: true, get: function () { return prompts_1.BaseMessageStringPromptTemplate; } });
8
+ Object.defineProperty(exports, "BaseChatPromptTemplate", { enumerable: true, get: function () { return prompts_1.BaseChatPromptTemplate; } });
9
+ Object.defineProperty(exports, "ChatMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.ChatMessagePromptTemplate; } });
10
+ Object.defineProperty(exports, "HumanMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.HumanMessagePromptTemplate; } });
11
+ Object.defineProperty(exports, "AIMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.AIMessagePromptTemplate; } });
12
+ Object.defineProperty(exports, "SystemMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.SystemMessagePromptTemplate; } });
13
+ Object.defineProperty(exports, "ChatPromptTemplate", { enumerable: true, get: function () { return prompts_1.ChatPromptTemplate; } });
14
+ var prompt_values_1 = require("@langchain/core/prompt_values");
15
+ Object.defineProperty(exports, "ChatPromptValue", { enumerable: true, get: function () { return prompt_values_1.ChatPromptValue; } });
@@ -1 +1,2 @@
1
- export * from "langchain-core/prompts/chat";
1
+ export { BaseMessagePromptTemplate, type MessagesPlaceholderFields as MessagePlaceholderFields, MessagesPlaceholder, type MessageStringPromptTemplateFields, BaseMessageStringPromptTemplate, BaseChatPromptTemplate, type ChatMessagePromptTemplateFields, ChatMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate, SystemMessagePromptTemplate, type ChatPromptTemplateInput, type BaseMessagePromptTemplateLike, ChatPromptTemplate, } from "@langchain/core/prompts";
2
+ export { type ChatPromptValueFields, ChatPromptValue, } from "@langchain/core/prompt_values";
@@ -1 +1,2 @@
1
- export * from "langchain-core/prompts/chat";
1
+ export { BaseMessagePromptTemplate, MessagesPlaceholder, BaseMessageStringPromptTemplate, BaseChatPromptTemplate, ChatMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate, SystemMessagePromptTemplate, ChatPromptTemplate, } from "@langchain/core/prompts";
2
+ export { ChatPromptValue, } from "@langchain/core/prompt_values";
@@ -1,17 +1,6 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("langchain-core/prompts/few_shot"), exports);
3
+ exports.FewShotChatMessagePromptTemplate = exports.FewShotPromptTemplate = void 0;
4
+ var prompts_1 = require("@langchain/core/prompts");
5
+ Object.defineProperty(exports, "FewShotPromptTemplate", { enumerable: true, get: function () { return prompts_1.FewShotPromptTemplate; } });
6
+ Object.defineProperty(exports, "FewShotChatMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.FewShotChatMessagePromptTemplate; } });
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/few_shot";
1
+ export { type FewShotPromptTemplateInput, FewShotPromptTemplate, type FewShotChatMessagePromptTemplateInput, FewShotChatMessagePromptTemplate, } from "@langchain/core/prompts";
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/few_shot";
1
+ export { FewShotPromptTemplate, FewShotChatMessagePromptTemplate, } from "@langchain/core/prompts";
@@ -5,8 +5,8 @@ var base_js_1 = require("./base.cjs");
5
5
  Object.defineProperty(exports, "BasePromptTemplate", { enumerable: true, get: function () { return base_js_1.BasePromptTemplate; } });
6
6
  Object.defineProperty(exports, "StringPromptValue", { enumerable: true, get: function () { return base_js_1.StringPromptValue; } });
7
7
  Object.defineProperty(exports, "BaseStringPromptTemplate", { enumerable: true, get: function () { return base_js_1.BaseStringPromptTemplate; } });
8
- var base_1 = require("langchain-core/prompts/example_selector/base");
9
- Object.defineProperty(exports, "BaseExampleSelector", { enumerable: true, get: function () { return base_1.BaseExampleSelector; } });
8
+ var example_selectors_1 = require("@langchain/core/example_selectors");
9
+ Object.defineProperty(exports, "BaseExampleSelector", { enumerable: true, get: function () { return example_selectors_1.BaseExampleSelector; } });
10
10
  var prompt_js_1 = require("./prompt.cjs");
11
11
  Object.defineProperty(exports, "PromptTemplate", { enumerable: true, get: function () { return prompt_js_1.PromptTemplate; } });
12
12
  var conditional_js_1 = require("./selectors/conditional.cjs");
@@ -1,5 +1,5 @@
1
1
  export { BasePromptTemplate, type BasePromptTemplateInput, StringPromptValue, BaseStringPromptTemplate, } from "./base.js";
2
- export { BaseExampleSelector } from "langchain-core/prompts/example_selector/base";
2
+ export { BaseExampleSelector } from "@langchain/core/example_selectors";
3
3
  export { PromptTemplate, type PromptTemplateInput } from "./prompt.js";
4
4
  export { BasePromptSelector, ConditionalPromptSelector, isChatModel, isLLM, } from "./selectors/conditional.js";
5
5
  export { LengthBasedExampleSelector, type LengthBasedExampleSelectorInput, } from "./selectors/LengthBasedExampleSelector.js";
@@ -1,5 +1,5 @@
1
1
  export { BasePromptTemplate, StringPromptValue, BaseStringPromptTemplate, } from "./base.js";
2
- export { BaseExampleSelector } from "langchain-core/prompts/example_selector/base";
2
+ export { BaseExampleSelector } from "@langchain/core/example_selectors";
3
3
  export { PromptTemplate } from "./prompt.js";
4
4
  export { BasePromptSelector, ConditionalPromptSelector, isChatModel, isLLM, } from "./selectors/conditional.js";
5
5
  export { LengthBasedExampleSelector, } from "./selectors/LengthBasedExampleSelector.js";
@@ -1,17 +1,5 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("langchain-core/prompts/pipeline"), exports);
3
+ exports.PipelinePromptTemplate = void 0;
4
+ var prompts_1 = require("@langchain/core/prompts");
5
+ Object.defineProperty(exports, "PipelinePromptTemplate", { enumerable: true, get: function () { return prompts_1.PipelinePromptTemplate; } });
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/pipeline";
1
+ export { type PipelinePromptParams, type PipelinePromptTemplateInput, PipelinePromptTemplate, } from "@langchain/core/prompts";
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/pipeline";
1
+ export { PipelinePromptTemplate, } from "@langchain/core/prompts";
@@ -1,17 +1,5 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("langchain-core/prompts"), exports);
3
+ exports.PromptTemplate = void 0;
4
+ var prompts_1 = require("@langchain/core/prompts");
5
+ Object.defineProperty(exports, "PromptTemplate", { enumerable: true, get: function () { return prompts_1.PromptTemplate; } });
@@ -1 +1 @@
1
- export * from "langchain-core/prompts";
1
+ export { type PromptTemplateInput, type ParamsFromFString, PromptTemplate, } from "@langchain/core/prompts";
@@ -1 +1 @@
1
- export * from "langchain-core/prompts";
1
+ export { PromptTemplate, } from "@langchain/core/prompts";
@@ -1,17 +1,5 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("langchain-core/prompts/example_selector/length_based"), exports);
3
+ exports.LengthBasedExampleSelector = void 0;
4
+ var example_selectors_1 = require("@langchain/core/example_selectors");
5
+ Object.defineProperty(exports, "LengthBasedExampleSelector", { enumerable: true, get: function () { return example_selectors_1.LengthBasedExampleSelector; } });
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/example_selector/length_based";
1
+ export { type LengthBasedExampleSelectorInput, LengthBasedExampleSelector, } from "@langchain/core/example_selectors";
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/example_selector/length_based";
1
+ export { LengthBasedExampleSelector, } from "@langchain/core/example_selectors";
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("langchain-core/prompts/example_selector/semantic_similarity"), exports);
17
+ __exportStar(require("@langchain/core/example_selectors"), exports);
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/example_selector/semantic_similarity";
1
+ export * from "@langchain/core/example_selectors";
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/example_selector/semantic_similarity";
1
+ export * from "@langchain/core/example_selectors";
@@ -1,17 +1,8 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("langchain-core/prompts/example_selector/conditional"), exports);
3
+ exports.isChatModel = exports.isLLM = exports.ConditionalPromptSelector = exports.BasePromptSelector = void 0;
4
+ var example_selectors_1 = require("@langchain/core/example_selectors");
5
+ Object.defineProperty(exports, "BasePromptSelector", { enumerable: true, get: function () { return example_selectors_1.BasePromptSelector; } });
6
+ Object.defineProperty(exports, "ConditionalPromptSelector", { enumerable: true, get: function () { return example_selectors_1.ConditionalPromptSelector; } });
7
+ Object.defineProperty(exports, "isLLM", { enumerable: true, get: function () { return example_selectors_1.isLLM; } });
8
+ Object.defineProperty(exports, "isChatModel", { enumerable: true, get: function () { return example_selectors_1.isChatModel; } });
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/example_selector/conditional";
1
+ export { type BaseGetPromptAsyncOptions, BasePromptSelector, ConditionalPromptSelector, isLLM, isChatModel, } from "@langchain/core/example_selectors";
@@ -1 +1 @@
1
- export * from "langchain-core/prompts/example_selector/conditional";
1
+ export { BasePromptSelector, ConditionalPromptSelector, isLLM, isChatModel, } from "@langchain/core/example_selectors";