langchain 0.0.92 → 0.0.93

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 (328) hide show
  1. package/dist/agents/agent.cjs +10 -3
  2. package/dist/agents/agent.d.ts +3 -1
  3. package/dist/agents/agent.js +10 -3
  4. package/dist/agents/chat/index.cjs +6 -0
  5. package/dist/agents/chat/index.d.ts +1 -0
  6. package/dist/agents/chat/index.js +6 -0
  7. package/dist/agents/chat/outputParser.cjs +9 -0
  8. package/dist/agents/chat/outputParser.d.ts +1 -0
  9. package/dist/agents/chat/outputParser.js +9 -0
  10. package/dist/agents/chat_convo/index.cjs +6 -0
  11. package/dist/agents/chat_convo/index.d.ts +1 -0
  12. package/dist/agents/chat_convo/index.js +6 -0
  13. package/dist/agents/chat_convo/outputParser.cjs +21 -6
  14. package/dist/agents/chat_convo/outputParser.d.ts +5 -1
  15. package/dist/agents/chat_convo/outputParser.js +21 -6
  16. package/dist/agents/executor.cjs +4 -1
  17. package/dist/agents/executor.d.ts +1 -0
  18. package/dist/agents/executor.js +4 -1
  19. package/dist/agents/index.cjs +2 -1
  20. package/dist/agents/index.d.ts +2 -2
  21. package/dist/agents/index.js +1 -1
  22. package/dist/agents/mrkl/index.cjs +6 -0
  23. package/dist/agents/mrkl/index.d.ts +1 -0
  24. package/dist/agents/mrkl/index.js +6 -0
  25. package/dist/agents/mrkl/outputParser.cjs +7 -1
  26. package/dist/agents/mrkl/outputParser.d.ts +1 -0
  27. package/dist/agents/mrkl/outputParser.js +7 -1
  28. package/dist/agents/structured_chat/index.cjs +6 -0
  29. package/dist/agents/structured_chat/index.d.ts +1 -0
  30. package/dist/agents/structured_chat/index.js +6 -0
  31. package/dist/agents/structured_chat/outputParser.cjs +20 -6
  32. package/dist/agents/structured_chat/outputParser.d.ts +5 -1
  33. package/dist/agents/structured_chat/outputParser.js +20 -6
  34. package/dist/base_language/index.cjs +21 -4
  35. package/dist/base_language/index.d.ts +14 -2
  36. package/dist/base_language/index.js +21 -4
  37. package/dist/callbacks/base.cjs +41 -0
  38. package/dist/callbacks/base.d.ts +41 -25
  39. package/dist/callbacks/base.js +41 -0
  40. package/dist/callbacks/handlers/tracer.cjs +91 -16
  41. package/dist/callbacks/handlers/tracer.d.ts +17 -29
  42. package/dist/callbacks/handlers/tracer.js +91 -16
  43. package/dist/callbacks/handlers/tracer_langchain.cjs +17 -77
  44. package/dist/callbacks/handlers/tracer_langchain.d.ts +13 -20
  45. package/dist/callbacks/handlers/tracer_langchain.js +17 -77
  46. package/dist/callbacks/index.cjs +6 -1
  47. package/dist/callbacks/index.d.ts +3 -2
  48. package/dist/callbacks/index.js +2 -1
  49. package/dist/callbacks/manager.cjs +157 -42
  50. package/dist/callbacks/manager.d.ts +31 -16
  51. package/dist/callbacks/manager.js +154 -41
  52. package/dist/callbacks/promises.cjs +36 -0
  53. package/dist/callbacks/promises.d.ts +7 -0
  54. package/dist/callbacks/promises.js +28 -0
  55. package/dist/chains/analyze_documents_chain.cjs +1 -1
  56. package/dist/chains/analyze_documents_chain.js +1 -1
  57. package/dist/chains/api/api_chain.cjs +2 -2
  58. package/dist/chains/api/api_chain.js +2 -2
  59. package/dist/chains/base.cjs +6 -3
  60. package/dist/chains/base.d.ts +3 -2
  61. package/dist/chains/base.js +6 -3
  62. package/dist/chains/chat_vector_db_chain.cjs +2 -2
  63. package/dist/chains/chat_vector_db_chain.js +2 -2
  64. package/dist/chains/combine_docs_chain.cjs +32 -18
  65. package/dist/chains/combine_docs_chain.js +32 -18
  66. package/dist/chains/constitutional_ai/constitutional_chain.cjs +4 -4
  67. package/dist/chains/constitutional_ai/constitutional_chain.js +4 -4
  68. package/dist/chains/conversational_retrieval_chain.cjs +2 -2
  69. package/dist/chains/conversational_retrieval_chain.js +2 -2
  70. package/dist/chains/llm_chain.cjs +9 -2
  71. package/dist/chains/llm_chain.d.ts +3 -1
  72. package/dist/chains/llm_chain.js +9 -2
  73. package/dist/chains/openai_moderation.cjs +5 -0
  74. package/dist/chains/openai_moderation.d.ts +3 -0
  75. package/dist/chains/openai_moderation.js +5 -0
  76. package/dist/chains/query_constructor/index.cjs +27 -19
  77. package/dist/chains/query_constructor/index.d.ts +7 -3
  78. package/dist/chains/query_constructor/index.js +27 -19
  79. package/dist/chains/retrieval_qa.cjs +1 -1
  80. package/dist/chains/retrieval_qa.js +1 -1
  81. package/dist/chains/sequential_chain.cjs +7 -3
  82. package/dist/chains/sequential_chain.js +7 -3
  83. package/dist/chains/sql_db/sql_db_chain.cjs +2 -2
  84. package/dist/chains/sql_db/sql_db_chain.js +2 -2
  85. package/dist/chains/vector_db_qa.cjs +1 -1
  86. package/dist/chains/vector_db_qa.js +1 -1
  87. package/dist/chat_models/anthropic.cjs +16 -0
  88. package/dist/chat_models/anthropic.d.ts +11 -6
  89. package/dist/chat_models/anthropic.js +16 -0
  90. package/dist/chat_models/base.cjs +12 -3
  91. package/dist/chat_models/base.d.ts +1 -0
  92. package/dist/chat_models/base.js +12 -3
  93. package/dist/chat_models/openai.cjs +26 -1
  94. package/dist/chat_models/openai.d.ts +9 -1
  95. package/dist/chat_models/openai.js +26 -1
  96. package/dist/client/index.cjs +2 -2
  97. package/dist/client/index.d.ts +1 -1
  98. package/dist/client/index.js +1 -1
  99. package/dist/client/langchainplus.cjs +79 -406
  100. package/dist/client/langchainplus.d.ts +7 -119
  101. package/dist/client/langchainplus.js +77 -404
  102. package/dist/embeddings/googlevertexai.cjs +7 -5
  103. package/dist/embeddings/googlevertexai.js +7 -5
  104. package/dist/embeddings/openai.cjs +1 -1
  105. package/dist/embeddings/openai.js +1 -1
  106. package/dist/experimental/autogpt/output_parser.cjs +9 -0
  107. package/dist/experimental/autogpt/output_parser.d.ts +1 -0
  108. package/dist/experimental/autogpt/output_parser.js +9 -0
  109. package/dist/experimental/plan_and_execute/outputParser.cjs +7 -1
  110. package/dist/experimental/plan_and_execute/outputParser.d.ts +1 -1
  111. package/dist/experimental/plan_and_execute/outputParser.js +7 -1
  112. package/dist/llms/aleph_alpha.cjs +366 -0
  113. package/dist/llms/aleph_alpha.d.ts +148 -0
  114. package/dist/llms/aleph_alpha.js +362 -0
  115. package/dist/llms/base.cjs +9 -3
  116. package/dist/llms/base.d.ts +1 -0
  117. package/dist/llms/base.js +9 -3
  118. package/dist/llms/cohere.cjs +16 -0
  119. package/dist/llms/cohere.d.ts +7 -0
  120. package/dist/llms/cohere.js +16 -0
  121. package/dist/llms/googlevertexai.cjs +47 -1
  122. package/dist/llms/googlevertexai.d.ts +26 -1
  123. package/dist/llms/googlevertexai.js +45 -0
  124. package/dist/llms/hf.cjs +6 -1
  125. package/dist/llms/hf.d.ts +3 -0
  126. package/dist/llms/hf.js +6 -1
  127. package/dist/llms/openai-chat.cjs +37 -1
  128. package/dist/llms/openai-chat.d.ts +13 -1
  129. package/dist/llms/openai-chat.js +37 -1
  130. package/dist/llms/openai.cjs +37 -1
  131. package/dist/llms/openai.d.ts +13 -1
  132. package/dist/llms/openai.js +37 -1
  133. package/dist/llms/replicate.cjs +5 -0
  134. package/dist/llms/replicate.d.ts +3 -0
  135. package/dist/llms/replicate.js +5 -0
  136. package/dist/llms/sagemaker_endpoint.cjs +7 -0
  137. package/dist/llms/sagemaker_endpoint.d.ts +3 -0
  138. package/dist/llms/sagemaker_endpoint.js +7 -0
  139. package/dist/load/import_constants.cjs +85 -0
  140. package/dist/load/import_constants.d.ts +1 -0
  141. package/dist/load/import_constants.js +82 -0
  142. package/dist/load/import_map.cjs +72 -0
  143. package/dist/load/import_map.d.ts +45 -0
  144. package/dist/load/import_map.js +46 -0
  145. package/dist/load/index.cjs +160 -0
  146. package/dist/load/index.d.ts +2 -0
  147. package/dist/load/index.js +133 -0
  148. package/dist/load/map_keys.cjs +26 -0
  149. package/dist/load/map_keys.d.ts +9 -0
  150. package/dist/load/map_keys.js +17 -0
  151. package/dist/load/serializable.cjs +115 -0
  152. package/dist/load/serializable.d.ts +50 -0
  153. package/dist/load/serializable.js +111 -0
  154. package/dist/memory/stores/entity/in_memory.cjs +6 -0
  155. package/dist/memory/stores/entity/in_memory.d.ts +1 -0
  156. package/dist/memory/stores/entity/in_memory.js +6 -0
  157. package/dist/output_parsers/combining.cjs +7 -1
  158. package/dist/output_parsers/combining.d.ts +1 -0
  159. package/dist/output_parsers/combining.js +7 -1
  160. package/dist/output_parsers/expression.cjs +6 -0
  161. package/dist/output_parsers/expression.d.ts +1 -0
  162. package/dist/output_parsers/expression.js +6 -0
  163. package/dist/output_parsers/fix.cjs +7 -1
  164. package/dist/output_parsers/fix.d.ts +1 -0
  165. package/dist/output_parsers/fix.js +7 -1
  166. package/dist/output_parsers/list.cjs +16 -1
  167. package/dist/output_parsers/list.d.ts +2 -0
  168. package/dist/output_parsers/list.js +16 -1
  169. package/dist/output_parsers/regex.cjs +7 -1
  170. package/dist/output_parsers/regex.d.ts +1 -0
  171. package/dist/output_parsers/regex.js +7 -1
  172. package/dist/output_parsers/structured.cjs +12 -9
  173. package/dist/output_parsers/structured.d.ts +6 -2
  174. package/dist/output_parsers/structured.js +12 -9
  175. package/dist/prompts/base.cjs +46 -4
  176. package/dist/prompts/base.d.ts +14 -5
  177. package/dist/prompts/base.js +46 -4
  178. package/dist/prompts/chat.cjs +61 -36
  179. package/dist/prompts/chat.d.ts +26 -8
  180. package/dist/prompts/chat.js +61 -36
  181. package/dist/prompts/few_shot.cjs +6 -0
  182. package/dist/prompts/few_shot.d.ts +1 -0
  183. package/dist/prompts/few_shot.js +6 -0
  184. package/dist/prompts/index.d.ts +1 -1
  185. package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +3 -1
  186. package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +2 -2
  187. package/dist/prompts/selectors/LengthBasedExampleSelector.js +3 -1
  188. package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +3 -1
  189. package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +2 -2
  190. package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +3 -1
  191. package/dist/prompts/serde.d.ts +1 -13
  192. package/dist/retrievers/document_compressors/chain_extract.cjs +11 -0
  193. package/dist/retrievers/document_compressors/chain_extract.js +11 -0
  194. package/dist/retrievers/self_query/weaviate.cjs +100 -0
  195. package/dist/retrievers/self_query/weaviate.d.ts +40 -0
  196. package/dist/retrievers/self_query/weaviate.js +96 -0
  197. package/dist/schema/index.cjs +10 -6
  198. package/dist/schema/index.d.ts +10 -7
  199. package/dist/schema/index.js +8 -5
  200. package/dist/schema/output_parser.cjs +2 -1
  201. package/dist/schema/output_parser.d.ts +2 -1
  202. package/dist/schema/output_parser.js +2 -1
  203. package/dist/sql_db.cjs +12 -1
  204. package/dist/sql_db.d.ts +4 -1
  205. package/dist/sql_db.js +12 -1
  206. package/dist/stores/doc/gcs.cjs +58 -0
  207. package/dist/stores/doc/gcs.d.ts +22 -0
  208. package/dist/stores/doc/gcs.js +54 -0
  209. package/dist/stores/doc/in_memory.cjs +67 -0
  210. package/dist/stores/doc/in_memory.d.ts +14 -0
  211. package/dist/stores/doc/in_memory.js +62 -0
  212. package/dist/stores/file/in_memory.cjs +6 -0
  213. package/dist/stores/file/in_memory.d.ts +1 -0
  214. package/dist/stores/file/in_memory.js +6 -0
  215. package/dist/stores/file/node.cjs +6 -0
  216. package/dist/stores/file/node.d.ts +1 -0
  217. package/dist/stores/file/node.js +6 -0
  218. package/dist/stores/message/dynamodb.cjs +13 -0
  219. package/dist/stores/message/dynamodb.d.ts +4 -0
  220. package/dist/stores/message/dynamodb.js +13 -0
  221. package/dist/stores/message/in_memory.cjs +7 -1
  222. package/dist/stores/message/in_memory.d.ts +1 -0
  223. package/dist/stores/message/in_memory.js +7 -1
  224. package/dist/stores/message/momento.cjs +6 -0
  225. package/dist/stores/message/momento.d.ts +1 -0
  226. package/dist/stores/message/momento.js +6 -0
  227. package/dist/stores/message/redis.cjs +15 -2
  228. package/dist/stores/message/redis.d.ts +6 -0
  229. package/dist/stores/message/redis.js +15 -2
  230. package/dist/stores/message/upstash_redis.cjs +14 -2
  231. package/dist/stores/message/upstash_redis.d.ts +5 -0
  232. package/dist/stores/message/upstash_redis.js +14 -2
  233. package/dist/text_splitter.cjs +32 -0
  234. package/dist/text_splitter.d.ts +1 -1
  235. package/dist/text_splitter.js +32 -0
  236. package/dist/tools/IFTTTWebhook.cjs +1 -1
  237. package/dist/tools/IFTTTWebhook.js +1 -1
  238. package/dist/tools/aiplugin.cjs +1 -1
  239. package/dist/tools/aiplugin.d.ts +2 -2
  240. package/dist/tools/aiplugin.js +1 -1
  241. package/dist/tools/aws_lambda.cjs +9 -0
  242. package/dist/tools/aws_lambda.d.ts +4 -0
  243. package/dist/tools/aws_lambda.js +9 -0
  244. package/dist/tools/base.cjs +8 -5
  245. package/dist/tools/base.d.ts +3 -2
  246. package/dist/tools/base.js +8 -5
  247. package/dist/tools/bingserpapi.cjs +4 -1
  248. package/dist/tools/bingserpapi.d.ts +1 -0
  249. package/dist/tools/bingserpapi.js +4 -1
  250. package/dist/tools/calculator.cjs +3 -0
  251. package/dist/tools/calculator.d.ts +1 -0
  252. package/dist/tools/calculator.js +3 -0
  253. package/dist/tools/dadjokeapi.cjs +3 -6
  254. package/dist/tools/dadjokeapi.d.ts +0 -1
  255. package/dist/tools/dadjokeapi.js +3 -6
  256. package/dist/tools/dynamic.cjs +1 -1
  257. package/dist/tools/dynamic.d.ts +3 -5
  258. package/dist/tools/dynamic.js +1 -1
  259. package/dist/tools/fs.cjs +2 -2
  260. package/dist/tools/fs.d.ts +1 -1
  261. package/dist/tools/fs.js +2 -2
  262. package/dist/tools/google_custom_search.cjs +6 -1
  263. package/dist/tools/google_custom_search.d.ts +3 -0
  264. package/dist/tools/google_custom_search.js +6 -1
  265. package/dist/tools/index.d.ts +1 -1
  266. package/dist/tools/json.cjs +20 -7
  267. package/dist/tools/json.d.ts +9 -3
  268. package/dist/tools/json.js +20 -7
  269. package/dist/tools/requests.cjs +2 -2
  270. package/dist/tools/requests.js +2 -2
  271. package/dist/tools/serpapi.cjs +4 -1
  272. package/dist/tools/serpapi.d.ts +1 -0
  273. package/dist/tools/serpapi.js +4 -1
  274. package/dist/tools/serper.cjs +3 -0
  275. package/dist/tools/serper.d.ts +1 -0
  276. package/dist/tools/serper.js +3 -0
  277. package/dist/tools/sql.cjs +1 -1
  278. package/dist/tools/sql.js +1 -1
  279. package/dist/tools/vectorstore.cjs +1 -1
  280. package/dist/tools/vectorstore.js +1 -1
  281. package/dist/tools/webbrowser.cjs +5 -2
  282. package/dist/tools/webbrowser.d.ts +2 -1
  283. package/dist/tools/webbrowser.js +5 -2
  284. package/dist/tools/zapier.cjs +15 -2
  285. package/dist/tools/zapier.d.ts +8 -3
  286. package/dist/tools/zapier.js +15 -2
  287. package/dist/vectorstores/faiss.cjs +5 -5
  288. package/dist/vectorstores/faiss.d.ts +5 -5
  289. package/dist/vectorstores/faiss.js +5 -5
  290. package/dist/vectorstores/hnswlib.cjs +7 -5
  291. package/dist/vectorstores/hnswlib.d.ts +5 -5
  292. package/dist/vectorstores/hnswlib.js +7 -5
  293. package/dist/vectorstores/weaviate.cjs +14 -1
  294. package/dist/vectorstores/weaviate.js +14 -1
  295. package/llms/aleph_alpha.cjs +1 -0
  296. package/llms/aleph_alpha.d.ts +1 -0
  297. package/llms/aleph_alpha.js +1 -0
  298. package/load/serializable.cjs +1 -0
  299. package/load/serializable.d.ts +1 -0
  300. package/load/serializable.js +1 -0
  301. package/load.cjs +1 -0
  302. package/load.d.ts +1 -0
  303. package/load.js +1 -0
  304. package/package.json +69 -12
  305. package/retrievers/self_query/weaviate.cjs +1 -0
  306. package/retrievers/self_query/weaviate.d.ts +1 -0
  307. package/retrievers/self_query/weaviate.js +1 -0
  308. package/stores/doc/gcs.cjs +1 -0
  309. package/stores/doc/gcs.d.ts +1 -0
  310. package/stores/doc/gcs.js +1 -0
  311. package/stores/doc/in_memory.cjs +1 -0
  312. package/stores/doc/in_memory.d.ts +1 -0
  313. package/stores/doc/in_memory.js +1 -0
  314. package/stores/message/in_memory.cjs +1 -0
  315. package/stores/message/in_memory.d.ts +1 -0
  316. package/stores/message/in_memory.js +1 -0
  317. package/dist/docstore/base.cjs +0 -6
  318. package/dist/docstore/base.d.ts +0 -5
  319. package/dist/docstore/base.js +0 -2
  320. package/dist/docstore/in_memory.cjs +0 -34
  321. package/dist/docstore/in_memory.d.ts +0 -10
  322. package/dist/docstore/in_memory.js +0 -30
  323. package/dist/docstore/index.cjs +0 -9
  324. package/dist/docstore/index.d.ts +0 -3
  325. package/dist/docstore/index.js +0 -3
  326. package/docstore.cjs +0 -1
  327. package/docstore.d.ts +0 -1
  328. package/docstore.js +0 -1
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Agent = exports.LLMSingleActionAgent = exports.BaseMultiActionAgent = exports.BaseSingleActionAgent = exports.BaseAgent = void 0;
4
+ const serializable_js_1 = require("../load/serializable.cjs");
4
5
  class ParseError extends Error {
5
6
  constructor(msg, output) {
6
7
  super(msg);
@@ -13,7 +14,7 @@ class ParseError extends Error {
13
14
  this.output = output;
14
15
  }
15
16
  }
16
- class BaseAgent {
17
+ class BaseAgent extends serializable_js_1.Serializable {
17
18
  get returnValues() {
18
19
  return ["output"];
19
20
  }
@@ -60,7 +61,13 @@ class BaseMultiActionAgent extends BaseAgent {
60
61
  exports.BaseMultiActionAgent = BaseMultiActionAgent;
61
62
  class LLMSingleActionAgent extends BaseSingleActionAgent {
62
63
  constructor(input) {
63
- super();
64
+ super(input);
65
+ Object.defineProperty(this, "lc_namespace", {
66
+ enumerable: true,
67
+ configurable: true,
68
+ writable: true,
69
+ value: ["langchain", "agents"]
70
+ });
64
71
  Object.defineProperty(this, "llmChain", {
65
72
  enumerable: true,
66
73
  configurable: true,
@@ -120,7 +127,7 @@ class Agent extends BaseSingleActionAgent {
120
127
  return this.llmChain.inputKeys.filter((k) => k !== "agent_scratchpad");
121
128
  }
122
129
  constructor(input) {
123
- super();
130
+ super(input);
124
131
  Object.defineProperty(this, "llmChain", {
125
132
  enumerable: true,
126
133
  configurable: true,
@@ -3,10 +3,11 @@ import { CallbackManager, Callbacks } from "../callbacks/manager.js";
3
3
  import { LLMChain } from "../chains/llm_chain.js";
4
4
  import { BasePromptTemplate } from "../prompts/base.js";
5
5
  import { AgentAction, AgentFinish, AgentStep, BaseChatMessage, ChainValues } from "../schema/index.js";
6
+ import { Serializable } from "../load/serializable.js";
6
7
  import { StructuredTool, Tool } from "../tools/base.js";
7
8
  import { AgentActionOutputParser, AgentInput, SerializedAgent, StoppingMethod } from "./types.js";
8
9
  export type OutputParserArgs = Record<string, any>;
9
- export declare abstract class BaseAgent {
10
+ export declare abstract class BaseAgent extends Serializable {
10
11
  ToolType: StructuredTool;
11
12
  abstract get inputKeys(): string[];
12
13
  get returnValues(): string[];
@@ -60,6 +61,7 @@ export interface LLMSingleActionAgentInput {
60
61
  stop?: string[];
61
62
  }
62
63
  export declare class LLMSingleActionAgent extends BaseSingleActionAgent {
64
+ lc_namespace: string[];
63
65
  llmChain: LLMChain;
64
66
  outputParser: AgentActionOutputParser;
65
67
  stop?: string[];
@@ -1,3 +1,4 @@
1
+ import { Serializable } from "../load/serializable.js";
1
2
  class ParseError extends Error {
2
3
  constructor(msg, output) {
3
4
  super(msg);
@@ -10,7 +11,7 @@ class ParseError extends Error {
10
11
  this.output = output;
11
12
  }
12
13
  }
13
- export class BaseAgent {
14
+ export class BaseAgent extends Serializable {
14
15
  get returnValues() {
15
16
  return ["output"];
16
17
  }
@@ -54,7 +55,13 @@ export class BaseMultiActionAgent extends BaseAgent {
54
55
  }
55
56
  export class LLMSingleActionAgent extends BaseSingleActionAgent {
56
57
  constructor(input) {
57
- super();
58
+ super(input);
59
+ Object.defineProperty(this, "lc_namespace", {
60
+ enumerable: true,
61
+ configurable: true,
62
+ writable: true,
63
+ value: ["langchain", "agents"]
64
+ });
58
65
  Object.defineProperty(this, "llmChain", {
59
66
  enumerable: true,
60
67
  configurable: true,
@@ -113,7 +120,7 @@ export class Agent extends BaseSingleActionAgent {
113
120
  return this.llmChain.inputKeys.filter((k) => k !== "agent_scratchpad");
114
121
  }
115
122
  constructor(input) {
116
- super();
123
+ super(input);
117
124
  Object.defineProperty(this, "llmChain", {
118
125
  enumerable: true,
119
126
  configurable: true,
@@ -15,6 +15,12 @@ class ChatAgent extends agent_js_1.Agent {
15
15
  constructor(input) {
16
16
  const outputParser = input?.outputParser ?? ChatAgent.getDefaultOutputParser();
17
17
  super({ ...input, outputParser });
18
+ Object.defineProperty(this, "lc_namespace", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: ["langchain", "agents", "chat"]
23
+ });
18
24
  }
19
25
  _agentType() {
20
26
  return "chat-zero-shot-react-description";
@@ -22,6 +22,7 @@ export type ChatAgentInput = Optional<AgentInput, "outputParser">;
22
22
  * @augments Agent
23
23
  */
24
24
  export declare class ChatAgent extends Agent {
25
+ lc_namespace: string[];
25
26
  ToolType: Tool;
26
27
  constructor(input: ChatAgentInput);
27
28
  _agentType(): "chat-zero-shot-react-description";
@@ -12,6 +12,12 @@ export class ChatAgent extends Agent {
12
12
  constructor(input) {
13
13
  const outputParser = input?.outputParser ?? ChatAgent.getDefaultOutputParser();
14
14
  super({ ...input, outputParser });
15
+ Object.defineProperty(this, "lc_namespace", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: ["langchain", "agents", "chat"]
20
+ });
15
21
  }
16
22
  _agentType() {
17
23
  return "chat-zero-shot-react-description";
@@ -5,6 +5,15 @@ const types_js_1 = require("../types.cjs");
5
5
  const prompt_js_1 = require("./prompt.cjs");
6
6
  exports.FINAL_ANSWER_ACTION = "Final Answer:";
7
7
  class ChatAgentOutputParser extends types_js_1.AgentActionOutputParser {
8
+ constructor() {
9
+ super(...arguments);
10
+ Object.defineProperty(this, "lc_namespace", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: ["langchain", "agents", "chat"]
15
+ });
16
+ }
8
17
  async parse(text) {
9
18
  if (text.includes(exports.FINAL_ANSWER_ACTION) || !text.includes(`"action":`)) {
10
19
  const parts = text.split(exports.FINAL_ANSWER_ACTION);
@@ -1,6 +1,7 @@
1
1
  import { AgentActionOutputParser } from "../types.js";
2
2
  export declare const FINAL_ANSWER_ACTION = "Final Answer:";
3
3
  export declare class ChatAgentOutputParser extends AgentActionOutputParser {
4
+ lc_namespace: string[];
4
5
  parse(text: string): Promise<{
5
6
  returnValues: {
6
7
  output: string;
@@ -2,6 +2,15 @@ import { AgentActionOutputParser } from "../types.js";
2
2
  import { FORMAT_INSTRUCTIONS } from "./prompt.js";
3
3
  export const FINAL_ANSWER_ACTION = "Final Answer:";
4
4
  export class ChatAgentOutputParser extends AgentActionOutputParser {
5
+ constructor() {
6
+ super(...arguments);
7
+ Object.defineProperty(this, "lc_namespace", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: ["langchain", "agents", "chat"]
12
+ });
13
+ }
5
14
  async parse(text) {
6
15
  if (text.includes(FINAL_ANSWER_ACTION) || !text.includes(`"action":`)) {
7
16
  const parts = text.split(FINAL_ANSWER_ACTION);
@@ -16,6 +16,12 @@ class ChatConversationalAgent extends agent_js_1.Agent {
16
16
  constructor(input) {
17
17
  const outputParser = input.outputParser ?? ChatConversationalAgent.getDefaultOutputParser();
18
18
  super({ ...input, outputParser });
19
+ Object.defineProperty(this, "lc_namespace", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: ["langchain", "agents", "chat_convo"]
24
+ });
19
25
  }
20
26
  _agentType() {
21
27
  return "chat-conversational-react-description";
@@ -21,6 +21,7 @@ export type ChatConversationalAgentInput = Optional<AgentInput, "outputParser">;
21
21
  * @augments Agent
22
22
  */
23
23
  export declare class ChatConversationalAgent extends Agent {
24
+ lc_namespace: string[];
24
25
  ToolType: Tool;
25
26
  constructor(input: ChatConversationalAgentInput);
26
27
  _agentType(): "chat-conversational-react-description";
@@ -13,6 +13,12 @@ export class ChatConversationalAgent extends Agent {
13
13
  constructor(input) {
14
14
  const outputParser = input.outputParser ?? ChatConversationalAgent.getDefaultOutputParser();
15
15
  super({ ...input, outputParser });
16
+ Object.defineProperty(this, "lc_namespace", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: ["langchain", "agents", "chat_convo"]
21
+ });
16
22
  }
17
23
  _agentType() {
18
24
  return "chat-conversational-react-description";
@@ -7,14 +7,21 @@ const types_js_1 = require("../types.cjs");
7
7
  const prompt_js_1 = require("./prompt.cjs");
8
8
  const fix_js_1 = require("../../output_parsers/fix.cjs");
9
9
  class ChatConversationalAgentOutputParser extends types_js_1.AgentActionOutputParser {
10
- constructor(toolNames) {
11
- super();
10
+ constructor(fields) {
11
+ super(...arguments);
12
+ Object.defineProperty(this, "lc_namespace", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: ["langchain", "agents", "chat_convo"]
17
+ });
12
18
  Object.defineProperty(this, "toolNames", {
13
19
  enumerable: true,
14
20
  configurable: true,
15
21
  writable: true,
16
- value: toolNames
22
+ value: void 0
17
23
  });
24
+ this.toolNames = fields.toolNames;
18
25
  }
19
26
  async parse(text) {
20
27
  let jsonOutput = text.trim();
@@ -50,7 +57,13 @@ class ChatConversationalAgentOutputParser extends types_js_1.AgentActionOutputPa
50
57
  exports.ChatConversationalAgentOutputParser = ChatConversationalAgentOutputParser;
51
58
  class ChatConversationalAgentOutputParserWithRetries extends types_js_1.AgentActionOutputParser {
52
59
  constructor(fields) {
53
- super();
60
+ super(fields);
61
+ Object.defineProperty(this, "lc_namespace", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: ["langchain", "agents", "chat_convo"]
66
+ });
54
67
  Object.defineProperty(this, "baseParser", {
55
68
  enumerable: true,
56
69
  configurable: true,
@@ -72,7 +85,7 @@ class ChatConversationalAgentOutputParserWithRetries extends types_js_1.AgentAct
72
85
  this.toolNames = fields.toolNames ?? this.toolNames;
73
86
  this.baseParser =
74
87
  fields?.baseParser ??
75
- new ChatConversationalAgentOutputParser(this.toolNames);
88
+ new ChatConversationalAgentOutputParser({ toolNames: this.toolNames });
76
89
  this.outputFixingParser = fields?.outputFixingParser;
77
90
  }
78
91
  getFormatInstructions(options) {
@@ -91,7 +104,9 @@ class ChatConversationalAgentOutputParserWithRetries extends types_js_1.AgentAct
91
104
  }
92
105
  static fromLLM(llm, options) {
93
106
  const baseParser = options.baseParser ??
94
- new ChatConversationalAgentOutputParser(options.toolNames ?? []);
107
+ new ChatConversationalAgentOutputParser({
108
+ toolNames: options.toolNames ?? [],
109
+ });
95
110
  const outputFixingParser = fix_js_1.OutputFixingParser.fromLLM(llm, baseParser);
96
111
  return new ChatConversationalAgentOutputParserWithRetries({
97
112
  baseParser,
@@ -8,8 +8,11 @@ export type ChatConversationalAgentOutputParserFormatInstructionsOptions = Forma
8
8
  raw?: boolean;
9
9
  };
10
10
  export declare class ChatConversationalAgentOutputParser extends AgentActionOutputParser {
11
+ lc_namespace: string[];
11
12
  private toolNames;
12
- constructor(toolNames: string[]);
13
+ constructor(fields: {
14
+ toolNames: string[];
15
+ });
13
16
  parse(text: string): Promise<AgentAction | AgentFinish>;
14
17
  getFormatInstructions(): string;
15
18
  }
@@ -19,6 +22,7 @@ export type ChatConversationalAgentOutputParserArgs = {
19
22
  toolNames?: string[];
20
23
  };
21
24
  export declare class ChatConversationalAgentOutputParserWithRetries extends AgentActionOutputParser {
25
+ lc_namespace: string[];
22
26
  private baseParser;
23
27
  private outputFixingParser?;
24
28
  private toolNames;
@@ -4,14 +4,21 @@ import { AgentActionOutputParser } from "../types.js";
4
4
  import { FORMAT_INSTRUCTIONS } from "./prompt.js";
5
5
  import { OutputFixingParser } from "../../output_parsers/fix.js";
6
6
  export class ChatConversationalAgentOutputParser extends AgentActionOutputParser {
7
- constructor(toolNames) {
8
- super();
7
+ constructor(fields) {
8
+ super(...arguments);
9
+ Object.defineProperty(this, "lc_namespace", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: ["langchain", "agents", "chat_convo"]
14
+ });
9
15
  Object.defineProperty(this, "toolNames", {
10
16
  enumerable: true,
11
17
  configurable: true,
12
18
  writable: true,
13
- value: toolNames
19
+ value: void 0
14
20
  });
21
+ this.toolNames = fields.toolNames;
15
22
  }
16
23
  async parse(text) {
17
24
  let jsonOutput = text.trim();
@@ -46,7 +53,13 @@ export class ChatConversationalAgentOutputParser extends AgentActionOutputParser
46
53
  }
47
54
  export class ChatConversationalAgentOutputParserWithRetries extends AgentActionOutputParser {
48
55
  constructor(fields) {
49
- super();
56
+ super(fields);
57
+ Object.defineProperty(this, "lc_namespace", {
58
+ enumerable: true,
59
+ configurable: true,
60
+ writable: true,
61
+ value: ["langchain", "agents", "chat_convo"]
62
+ });
50
63
  Object.defineProperty(this, "baseParser", {
51
64
  enumerable: true,
52
65
  configurable: true,
@@ -68,7 +81,7 @@ export class ChatConversationalAgentOutputParserWithRetries extends AgentActionO
68
81
  this.toolNames = fields.toolNames ?? this.toolNames;
69
82
  this.baseParser =
70
83
  fields?.baseParser ??
71
- new ChatConversationalAgentOutputParser(this.toolNames);
84
+ new ChatConversationalAgentOutputParser({ toolNames: this.toolNames });
72
85
  this.outputFixingParser = fields?.outputFixingParser;
73
86
  }
74
87
  getFormatInstructions(options) {
@@ -87,7 +100,9 @@ export class ChatConversationalAgentOutputParserWithRetries extends AgentActionO
87
100
  }
88
101
  static fromLLM(llm, options) {
89
102
  const baseParser = options.baseParser ??
90
- new ChatConversationalAgentOutputParser(options.toolNames ?? []);
103
+ new ChatConversationalAgentOutputParser({
104
+ toolNames: options.toolNames ?? [],
105
+ });
91
106
  const outputFixingParser = OutputFixingParser.fromLLM(llm, baseParser);
92
107
  return new ChatConversationalAgentOutputParserWithRetries({
93
108
  baseParser,
@@ -7,6 +7,9 @@ const base_js_1 = require("../chains/base.cjs");
7
7
  * @augments BaseChain
8
8
  */
9
9
  class AgentExecutor extends base_js_1.BaseChain {
10
+ get lc_namespace() {
11
+ return ["langchain", "agents", "executor"];
12
+ }
10
13
  get inputKeys() {
11
14
  return this.agent.inputKeys;
12
15
  }
@@ -14,7 +17,7 @@ class AgentExecutor extends base_js_1.BaseChain {
14
17
  return this.agent.returnValues;
15
18
  }
16
19
  constructor(input) {
17
- super(input.memory, input.verbose, input.callbacks ?? input.callbackManager);
20
+ super(input);
18
21
  Object.defineProperty(this, "agent", {
19
22
  enumerable: true,
20
23
  configurable: true,
@@ -16,6 +16,7 @@ export interface AgentExecutorInput extends ChainInputs {
16
16
  * @augments BaseChain
17
17
  */
18
18
  export declare class AgentExecutor extends BaseChain {
19
+ get lc_namespace(): string[];
19
20
  agent: BaseSingleActionAgent | BaseMultiActionAgent;
20
21
  tools: this["agent"]["ToolType"][];
21
22
  returnIntermediateSteps: boolean;
@@ -4,6 +4,9 @@ import { BaseChain } from "../chains/base.js";
4
4
  * @augments BaseChain
5
5
  */
6
6
  export class AgentExecutor extends BaseChain {
7
+ get lc_namespace() {
8
+ return ["langchain", "agents", "executor"];
9
+ }
7
10
  get inputKeys() {
8
11
  return this.agent.inputKeys;
9
12
  }
@@ -11,7 +14,7 @@ export class AgentExecutor extends BaseChain {
11
14
  return this.agent.returnValues;
12
15
  }
13
16
  constructor(input) {
14
- super(input.memory, input.verbose, input.callbacks ?? input.callbackManager);
17
+ super(input);
15
18
  Object.defineProperty(this, "agent", {
16
19
  enumerable: true,
17
20
  configurable: true,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StructuredChatOutputParserWithRetries = exports.StructuredChatOutputParser = exports.StructuredChatAgent = exports.AgentActionOutputParser = exports.ZeroShotAgentOutputParser = exports.ZeroShotAgent = exports.initializeAgentExecutorWithOptions = exports.initializeAgentExecutor = exports.AgentExecutor = exports.ChatConversationalAgentOutputParser = exports.ChatConversationalAgent = exports.ChatAgentOutputParser = exports.ChatAgent = exports.Toolkit = exports.createVectorStoreRouterAgent = exports.createVectorStoreAgent = exports.createSqlAgent = exports.createOpenApiAgent = exports.createJsonAgent = exports.ZapierToolKit = exports.VectorStoreToolkit = exports.VectorStoreRouterToolkit = exports.SqlToolkit = exports.RequestsToolkit = exports.OpenApiToolkit = exports.JsonToolkit = exports.LLMSingleActionAgent = exports.BaseSingleActionAgent = exports.Agent = void 0;
3
+ exports.StructuredChatOutputParserWithRetries = exports.StructuredChatOutputParser = exports.StructuredChatAgent = exports.AgentActionOutputParser = exports.ZeroShotAgentOutputParser = exports.ZeroShotAgent = exports.initializeAgentExecutorWithOptions = exports.initializeAgentExecutor = exports.AgentExecutor = exports.ChatConversationalAgentOutputParserWithRetries = exports.ChatConversationalAgentOutputParser = exports.ChatConversationalAgent = exports.ChatAgentOutputParser = exports.ChatAgent = exports.Toolkit = exports.createVectorStoreRouterAgent = exports.createVectorStoreAgent = exports.createSqlAgent = exports.createOpenApiAgent = exports.createJsonAgent = exports.ZapierToolKit = exports.VectorStoreToolkit = exports.VectorStoreRouterToolkit = exports.SqlToolkit = exports.RequestsToolkit = exports.OpenApiToolkit = exports.JsonToolkit = exports.LLMSingleActionAgent = exports.BaseSingleActionAgent = exports.Agent = void 0;
4
4
  var agent_js_1 = require("./agent.cjs");
5
5
  Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_js_1.Agent; } });
6
6
  Object.defineProperty(exports, "BaseSingleActionAgent", { enumerable: true, get: function () { return agent_js_1.BaseSingleActionAgent; } });
@@ -28,6 +28,7 @@ var index_js_3 = require("./chat_convo/index.cjs");
28
28
  Object.defineProperty(exports, "ChatConversationalAgent", { enumerable: true, get: function () { return index_js_3.ChatConversationalAgent; } });
29
29
  var outputParser_js_2 = require("./chat_convo/outputParser.cjs");
30
30
  Object.defineProperty(exports, "ChatConversationalAgentOutputParser", { enumerable: true, get: function () { return outputParser_js_2.ChatConversationalAgentOutputParser; } });
31
+ Object.defineProperty(exports, "ChatConversationalAgentOutputParserWithRetries", { enumerable: true, get: function () { return outputParser_js_2.ChatConversationalAgentOutputParserWithRetries; } });
31
32
  var executor_js_1 = require("./executor.cjs");
32
33
  Object.defineProperty(exports, "AgentExecutor", { enumerable: true, get: function () { return executor_js_1.AgentExecutor; } });
33
34
  var initialize_js_1 = require("./initialize.cjs");
@@ -4,11 +4,11 @@ export { Toolkit } from "./agent_toolkits/base.js";
4
4
  export { ChatAgent, ChatAgentInput, ChatCreatePromptArgs, } from "./chat/index.js";
5
5
  export { ChatAgentOutputParser } from "./chat/outputParser.js";
6
6
  export { ChatConversationalAgent, ChatConversationalAgentInput, ChatConversationalCreatePromptArgs, } from "./chat_convo/index.js";
7
- export { ChatConversationalAgentOutputParser } from "./chat_convo/outputParser.js";
7
+ export { ChatConversationalAgentOutputParser, ChatConversationalAgentOutputParserArgs, ChatConversationalAgentOutputParserWithRetries, ChatConversationalAgentOutputParserFormatInstructionsOptions, } from "./chat_convo/outputParser.js";
8
8
  export { AgentExecutor, AgentExecutorInput } from "./executor.js";
9
9
  export { initializeAgentExecutor, initializeAgentExecutorWithOptions, InitializeAgentExecutorOptions, } from "./initialize.js";
10
10
  export { ZeroShotAgent, ZeroShotAgentInput, ZeroShotCreatePromptArgs, } from "./mrkl/index.js";
11
11
  export { ZeroShotAgentOutputParser } from "./mrkl/outputParser.js";
12
12
  export { AgentActionOutputParser, AgentInput, SerializedAgent, SerializedAgentT, SerializedZeroShotAgent, StoppingMethod, } from "./types.js";
13
13
  export { StructuredChatAgent, StructuredChatAgentInput, StructuredChatCreatePromptArgs, } from "./structured_chat/index.js";
14
- export { StructuredChatOutputParser, StructuredChatOutputParserWithRetries, } from "./structured_chat/outputParser.js";
14
+ export { StructuredChatOutputParser, StructuredChatOutputParserArgs, StructuredChatOutputParserWithRetries, } from "./structured_chat/outputParser.js";
@@ -4,7 +4,7 @@ export { Toolkit } from "./agent_toolkits/base.js";
4
4
  export { ChatAgent, } from "./chat/index.js";
5
5
  export { ChatAgentOutputParser } from "./chat/outputParser.js";
6
6
  export { ChatConversationalAgent, } from "./chat_convo/index.js";
7
- export { ChatConversationalAgentOutputParser } from "./chat_convo/outputParser.js";
7
+ export { ChatConversationalAgentOutputParser, ChatConversationalAgentOutputParserWithRetries, } from "./chat_convo/outputParser.js";
8
8
  export { AgentExecutor } from "./executor.js";
9
9
  export { initializeAgentExecutor, initializeAgentExecutorWithOptions, } from "./initialize.js";
10
10
  export { ZeroShotAgent, } from "./mrkl/index.js";
@@ -16,6 +16,12 @@ class ZeroShotAgent extends agent_js_1.Agent {
16
16
  constructor(input) {
17
17
  const outputParser = input?.outputParser ?? ZeroShotAgent.getDefaultOutputParser();
18
18
  super({ ...input, outputParser });
19
+ Object.defineProperty(this, "lc_namespace", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: ["langchain", "agents", "mrkl"]
24
+ });
19
25
  }
20
26
  _agentType() {
21
27
  return "zero-shot-react-description";
@@ -19,6 +19,7 @@ export type ZeroShotAgentInput = Optional<AgentInput, "outputParser">;
19
19
  * @augments Agent
20
20
  */
21
21
  export declare class ZeroShotAgent extends Agent {
22
+ lc_namespace: string[];
22
23
  ToolType: Tool;
23
24
  constructor(input: ZeroShotAgentInput);
24
25
  _agentType(): "zero-shot-react-description";
@@ -13,6 +13,12 @@ export class ZeroShotAgent extends Agent {
13
13
  constructor(input) {
14
14
  const outputParser = input?.outputParser ?? ZeroShotAgent.getDefaultOutputParser();
15
15
  super({ ...input, outputParser });
16
+ Object.defineProperty(this, "lc_namespace", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: ["langchain", "agents", "mrkl"]
21
+ });
16
22
  }
17
23
  _agentType() {
18
24
  return "zero-shot-react-description";
@@ -6,7 +6,13 @@ const prompt_js_1 = require("./prompt.cjs");
6
6
  exports.FINAL_ANSWER_ACTION = "Final Answer:";
7
7
  class ZeroShotAgentOutputParser extends types_js_1.AgentActionOutputParser {
8
8
  constructor(fields) {
9
- super();
9
+ super(fields);
10
+ Object.defineProperty(this, "lc_namespace", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: ["langchain", "agents", "mrkl"]
15
+ });
10
16
  Object.defineProperty(this, "finishToolName", {
11
17
  enumerable: true,
12
18
  configurable: true,
@@ -2,6 +2,7 @@ import { OutputParserArgs } from "../agent.js";
2
2
  import { AgentActionOutputParser } from "../types.js";
3
3
  export declare const FINAL_ANSWER_ACTION = "Final Answer:";
4
4
  export declare class ZeroShotAgentOutputParser extends AgentActionOutputParser {
5
+ lc_namespace: string[];
5
6
  finishToolName: string;
6
7
  constructor(fields?: OutputParserArgs);
7
8
  parse(text: string): Promise<{
@@ -3,7 +3,13 @@ import { FORMAT_INSTRUCTIONS } from "./prompt.js";
3
3
  export const FINAL_ANSWER_ACTION = "Final Answer:";
4
4
  export class ZeroShotAgentOutputParser extends AgentActionOutputParser {
5
5
  constructor(fields) {
6
- super();
6
+ super(fields);
7
+ Object.defineProperty(this, "lc_namespace", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: ["langchain", "agents", "mrkl"]
12
+ });
7
13
  Object.defineProperty(this, "finishToolName", {
8
14
  enumerable: true,
9
15
  configurable: true,
@@ -16,6 +16,12 @@ class StructuredChatAgent extends agent_js_1.Agent {
16
16
  constructor(input) {
17
17
  const outputParser = input?.outputParser ?? StructuredChatAgent.getDefaultOutputParser();
18
18
  super({ ...input, outputParser });
19
+ Object.defineProperty(this, "lc_namespace", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: ["langchain", "agents", "structured_chat"]
24
+ });
19
25
  }
20
26
  _agentType() {
21
27
  return "structured-chat-zero-shot-react-description";
@@ -22,6 +22,7 @@ export type StructuredChatAgentInput = Optional<AgentInput, "outputParser">;
22
22
  * @augments Agent
23
23
  */
24
24
  export declare class StructuredChatAgent extends Agent {
25
+ lc_namespace: string[];
25
26
  constructor(input: StructuredChatAgentInput);
26
27
  _agentType(): "structured-chat-zero-shot-react-description";
27
28
  observationPrefix(): string;
@@ -13,6 +13,12 @@ export class StructuredChatAgent extends Agent {
13
13
  constructor(input) {
14
14
  const outputParser = input?.outputParser ?? StructuredChatAgent.getDefaultOutputParser();
15
15
  super({ ...input, outputParser });
16
+ Object.defineProperty(this, "lc_namespace", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: ["langchain", "agents", "structured_chat"]
21
+ });
16
22
  }
17
23
  _agentType() {
18
24
  return "structured-chat-zero-shot-react-description";
@@ -7,14 +7,21 @@ const fix_js_1 = require("../../output_parsers/fix.cjs");
7
7
  const output_parser_js_1 = require("../../schema/output_parser.cjs");
8
8
  const index_js_1 = require("../../prompts/index.cjs");
9
9
  class StructuredChatOutputParser extends types_js_1.AgentActionOutputParser {
10
- constructor(toolNames) {
11
- super();
10
+ constructor(fields) {
11
+ super(...arguments);
12
+ Object.defineProperty(this, "lc_namespace", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: ["langchain", "agents", "structured_chat"]
17
+ });
12
18
  Object.defineProperty(this, "toolNames", {
13
19
  enumerable: true,
14
20
  configurable: true,
15
21
  writable: true,
16
- value: toolNames
22
+ value: void 0
17
23
  });
24
+ this.toolNames = fields.toolNames;
18
25
  }
19
26
  async parse(text) {
20
27
  try {
@@ -43,7 +50,13 @@ class StructuredChatOutputParser extends types_js_1.AgentActionOutputParser {
43
50
  exports.StructuredChatOutputParser = StructuredChatOutputParser;
44
51
  class StructuredChatOutputParserWithRetries extends types_js_1.AgentActionOutputParser {
45
52
  constructor(fields) {
46
- super();
53
+ super(fields);
54
+ Object.defineProperty(this, "lc_namespace", {
55
+ enumerable: true,
56
+ configurable: true,
57
+ writable: true,
58
+ value: ["langchain", "agents", "structured_chat"]
59
+ });
47
60
  Object.defineProperty(this, "baseParser", {
48
61
  enumerable: true,
49
62
  configurable: true,
@@ -64,7 +77,8 @@ class StructuredChatOutputParserWithRetries extends types_js_1.AgentActionOutput
64
77
  });
65
78
  this.toolNames = fields.toolNames ?? this.toolNames;
66
79
  this.baseParser =
67
- fields?.baseParser ?? new StructuredChatOutputParser(this.toolNames);
80
+ fields?.baseParser ??
81
+ new StructuredChatOutputParser({ toolNames: this.toolNames });
68
82
  this.outputFixingParser = fields?.outputFixingParser;
69
83
  }
70
84
  async parse(text, callbacks) {
@@ -80,7 +94,7 @@ class StructuredChatOutputParserWithRetries extends types_js_1.AgentActionOutput
80
94
  }
81
95
  static fromLLM(llm, options) {
82
96
  const baseParser = options.baseParser ??
83
- new StructuredChatOutputParser(options.toolNames ?? []);
97
+ new StructuredChatOutputParser({ toolNames: options.toolNames ?? [] });
84
98
  const outputFixingParser = fix_js_1.OutputFixingParser.fromLLM(llm, baseParser);
85
99
  return new StructuredChatOutputParserWithRetries({
86
100
  baseParser,
@@ -4,8 +4,11 @@ import { BaseLanguageModel } from "../../base_language/index.js";
4
4
  import { AgentAction, AgentFinish } from "../../schema/index.js";
5
5
  import { Callbacks } from "../../callbacks/manager.js";
6
6
  export declare class StructuredChatOutputParser extends AgentActionOutputParser {
7
+ lc_namespace: string[];
7
8
  private toolNames;
8
- constructor(toolNames: string[]);
9
+ constructor(fields: {
10
+ toolNames: string[];
11
+ });
9
12
  parse(text: string): Promise<AgentAction | AgentFinish>;
10
13
  getFormatInstructions(): string;
11
14
  }
@@ -15,6 +18,7 @@ export interface StructuredChatOutputParserArgs {
15
18
  toolNames?: string[];
16
19
  }
17
20
  export declare class StructuredChatOutputParserWithRetries extends AgentActionOutputParser {
21
+ lc_namespace: string[];
18
22
  private baseParser;
19
23
  private outputFixingParser?;
20
24
  private toolNames;