langchain 0.0.129 → 0.0.131

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 (315) hide show
  1. package/dist/agents/chat/index.cjs +3 -0
  2. package/dist/agents/chat/index.d.ts +1 -0
  3. package/dist/agents/chat/index.js +3 -0
  4. package/dist/agents/chat_convo/index.cjs +3 -0
  5. package/dist/agents/chat_convo/index.d.ts +1 -0
  6. package/dist/agents/chat_convo/index.js +3 -0
  7. package/dist/agents/executor.cjs +3 -0
  8. package/dist/agents/executor.d.ts +1 -0
  9. package/dist/agents/executor.js +3 -0
  10. package/dist/agents/mrkl/index.cjs +3 -0
  11. package/dist/agents/mrkl/index.d.ts +1 -0
  12. package/dist/agents/mrkl/index.js +3 -0
  13. package/dist/agents/openai/index.cjs +3 -0
  14. package/dist/agents/openai/index.d.ts +1 -0
  15. package/dist/agents/openai/index.js +3 -0
  16. package/dist/agents/structured_chat/index.cjs +3 -0
  17. package/dist/agents/structured_chat/index.d.ts +1 -0
  18. package/dist/agents/structured_chat/index.js +3 -0
  19. package/dist/callbacks/base.cjs +18 -0
  20. package/dist/callbacks/base.d.ts +15 -0
  21. package/dist/callbacks/base.js +19 -1
  22. package/dist/callbacks/manager.cjs +1 -1
  23. package/dist/callbacks/manager.js +1 -1
  24. package/dist/chains/analyze_documents_chain.cjs +3 -0
  25. package/dist/chains/analyze_documents_chain.d.ts +1 -0
  26. package/dist/chains/analyze_documents_chain.js +3 -0
  27. package/dist/chains/combine_docs_chain.cjs +9 -0
  28. package/dist/chains/combine_docs_chain.d.ts +3 -0
  29. package/dist/chains/combine_docs_chain.js +9 -0
  30. package/dist/chains/constitutional_ai/constitutional_chain.cjs +3 -0
  31. package/dist/chains/constitutional_ai/constitutional_chain.d.ts +1 -0
  32. package/dist/chains/constitutional_ai/constitutional_chain.js +3 -0
  33. package/dist/chains/conversation.cjs +3 -0
  34. package/dist/chains/conversation.d.ts +1 -0
  35. package/dist/chains/conversation.js +3 -0
  36. package/dist/chains/conversational_retrieval_chain.cjs +3 -0
  37. package/dist/chains/conversational_retrieval_chain.d.ts +1 -0
  38. package/dist/chains/conversational_retrieval_chain.js +3 -0
  39. package/dist/chains/llm_chain.cjs +3 -0
  40. package/dist/chains/llm_chain.d.ts +1 -0
  41. package/dist/chains/llm_chain.js +3 -0
  42. package/dist/chains/openai_functions/openapi.cjs +3 -0
  43. package/dist/chains/openai_functions/openapi.js +3 -0
  44. package/dist/chains/openai_moderation.cjs +3 -0
  45. package/dist/chains/openai_moderation.d.ts +1 -0
  46. package/dist/chains/openai_moderation.js +3 -0
  47. package/dist/chains/retrieval_qa.cjs +3 -0
  48. package/dist/chains/retrieval_qa.d.ts +1 -0
  49. package/dist/chains/retrieval_qa.js +3 -0
  50. package/dist/chains/router/multi_route.cjs +3 -0
  51. package/dist/chains/router/multi_route.d.ts +1 -0
  52. package/dist/chains/router/multi_route.js +3 -0
  53. package/dist/chains/sequential_chain.cjs +6 -0
  54. package/dist/chains/sequential_chain.d.ts +2 -0
  55. package/dist/chains/sequential_chain.js +6 -0
  56. package/dist/chains/sql_db/sql_db_chain.cjs +3 -0
  57. package/dist/chains/sql_db/sql_db_chain.d.ts +1 -0
  58. package/dist/chains/sql_db/sql_db_chain.js +3 -0
  59. package/dist/chains/transform.cjs +3 -0
  60. package/dist/chains/transform.d.ts +1 -0
  61. package/dist/chains/transform.js +3 -0
  62. package/dist/chains/vector_db_qa.cjs +3 -0
  63. package/dist/chains/vector_db_qa.d.ts +1 -0
  64. package/dist/chains/vector_db_qa.js +3 -0
  65. package/dist/chat_models/anthropic.cjs +3 -0
  66. package/dist/chat_models/anthropic.d.ts +1 -0
  67. package/dist/chat_models/anthropic.js +3 -0
  68. package/dist/chat_models/baiduwenxin.cjs +3 -13
  69. package/dist/chat_models/baiduwenxin.d.ts +1 -3
  70. package/dist/chat_models/baiduwenxin.js +3 -13
  71. package/dist/chat_models/googlepalm.cjs +9 -0
  72. package/dist/chat_models/googlepalm.d.ts +2 -0
  73. package/dist/chat_models/googlepalm.js +9 -0
  74. package/dist/chat_models/googlevertexai.cjs +9 -0
  75. package/dist/chat_models/googlevertexai.d.ts +2 -0
  76. package/dist/chat_models/googlevertexai.js +9 -0
  77. package/dist/chat_models/ollama.cjs +3 -0
  78. package/dist/chat_models/ollama.d.ts +1 -0
  79. package/dist/chat_models/ollama.js +3 -0
  80. package/dist/chat_models/openai.cjs +19 -5
  81. package/dist/chat_models/openai.d.ts +7 -5
  82. package/dist/chat_models/openai.js +19 -5
  83. package/dist/document_loaders/web/youtube.cjs +77 -0
  84. package/dist/document_loaders/web/youtube.d.ts +17 -0
  85. package/dist/document_loaders/web/youtube.js +73 -0
  86. package/dist/document_transformers/html_to_text.cjs +3 -0
  87. package/dist/document_transformers/html_to_text.d.ts +1 -0
  88. package/dist/document_transformers/html_to_text.js +3 -0
  89. package/dist/document_transformers/mozilla_readability.cjs +3 -0
  90. package/dist/document_transformers/mozilla_readability.d.ts +1 -0
  91. package/dist/document_transformers/mozilla_readability.js +3 -0
  92. package/dist/document_transformers/openai_functions.cjs +3 -0
  93. package/dist/document_transformers/openai_functions.d.ts +1 -0
  94. package/dist/document_transformers/openai_functions.js +3 -0
  95. package/dist/embeddings/cohere.cjs +16 -13
  96. package/dist/embeddings/cohere.js +16 -13
  97. package/dist/embeddings/googlevertexai.cjs +1 -1
  98. package/dist/embeddings/googlevertexai.js +1 -1
  99. package/dist/embeddings/openai.cjs +27 -21
  100. package/dist/embeddings/openai.js +27 -21
  101. package/dist/evaluation/qa/eval_chain.cjs +3 -0
  102. package/dist/evaluation/qa/eval_chain.d.ts +1 -0
  103. package/dist/evaluation/qa/eval_chain.js +3 -0
  104. package/dist/experimental/babyagi/agent.cjs +3 -0
  105. package/dist/experimental/babyagi/agent.d.ts +1 -0
  106. package/dist/experimental/babyagi/agent.js +3 -0
  107. package/dist/experimental/babyagi/task_creation.cjs +3 -0
  108. package/dist/experimental/babyagi/task_creation.d.ts +1 -0
  109. package/dist/experimental/babyagi/task_creation.js +3 -0
  110. package/dist/experimental/babyagi/task_execution.cjs +3 -0
  111. package/dist/experimental/babyagi/task_execution.d.ts +1 -0
  112. package/dist/experimental/babyagi/task_execution.js +3 -0
  113. package/dist/experimental/babyagi/task_prioritization.cjs +3 -0
  114. package/dist/experimental/babyagi/task_prioritization.d.ts +1 -0
  115. package/dist/experimental/babyagi/task_prioritization.js +3 -0
  116. package/dist/experimental/generative_agents/generative_agent.cjs +3 -0
  117. package/dist/experimental/generative_agents/generative_agent.d.ts +1 -0
  118. package/dist/experimental/generative_agents/generative_agent.js +3 -0
  119. package/dist/experimental/generative_agents/generative_agent_memory.cjs +3 -0
  120. package/dist/experimental/generative_agents/generative_agent_memory.d.ts +1 -0
  121. package/dist/experimental/generative_agents/generative_agent_memory.js +3 -0
  122. package/dist/experimental/plan_and_execute/agent_executor.cjs +3 -0
  123. package/dist/experimental/plan_and_execute/agent_executor.d.ts +1 -0
  124. package/dist/experimental/plan_and_execute/agent_executor.js +3 -0
  125. package/dist/llms/cohere.cjs +3 -0
  126. package/dist/llms/cohere.d.ts +1 -0
  127. package/dist/llms/cohere.js +3 -0
  128. package/dist/llms/ollama.cjs +3 -0
  129. package/dist/llms/ollama.d.ts +1 -0
  130. package/dist/llms/ollama.js +3 -0
  131. package/dist/llms/openai-chat.cjs +18 -4
  132. package/dist/llms/openai-chat.d.ts +6 -4
  133. package/dist/llms/openai-chat.js +18 -4
  134. package/dist/llms/openai.cjs +20 -6
  135. package/dist/llms/openai.d.ts +5 -3
  136. package/dist/llms/openai.js +20 -6
  137. package/dist/llms/replicate.cjs +3 -0
  138. package/dist/llms/replicate.d.ts +1 -0
  139. package/dist/llms/replicate.js +3 -0
  140. package/dist/load/import_constants.cjs +1 -0
  141. package/dist/load/import_constants.js +1 -0
  142. package/dist/load/index.cjs +7 -1
  143. package/dist/load/index.js +7 -1
  144. package/dist/load/serializable.cjs +42 -3
  145. package/dist/load/serializable.d.ts +16 -0
  146. package/dist/load/serializable.js +40 -2
  147. package/dist/output_parsers/combining.cjs +3 -0
  148. package/dist/output_parsers/combining.d.ts +1 -0
  149. package/dist/output_parsers/combining.js +3 -0
  150. package/dist/output_parsers/fix.cjs +3 -0
  151. package/dist/output_parsers/fix.d.ts +1 -0
  152. package/dist/output_parsers/fix.js +3 -0
  153. package/dist/output_parsers/list.cjs +3 -0
  154. package/dist/output_parsers/list.d.ts +1 -0
  155. package/dist/output_parsers/list.js +3 -0
  156. package/dist/output_parsers/noop.cjs +3 -0
  157. package/dist/output_parsers/noop.d.ts +1 -0
  158. package/dist/output_parsers/noop.js +3 -0
  159. package/dist/output_parsers/openai_functions.cjs +9 -0
  160. package/dist/output_parsers/openai_functions.d.ts +3 -0
  161. package/dist/output_parsers/openai_functions.js +9 -0
  162. package/dist/output_parsers/regex.cjs +3 -0
  163. package/dist/output_parsers/regex.d.ts +1 -0
  164. package/dist/output_parsers/regex.js +3 -0
  165. package/dist/output_parsers/structured.cjs +6 -0
  166. package/dist/output_parsers/structured.d.ts +2 -0
  167. package/dist/output_parsers/structured.js +6 -0
  168. package/dist/prompts/chat.cjs +21 -0
  169. package/dist/prompts/chat.d.ts +7 -0
  170. package/dist/prompts/chat.js +21 -0
  171. package/dist/prompts/pipeline.cjs +3 -0
  172. package/dist/prompts/pipeline.d.ts +1 -0
  173. package/dist/prompts/pipeline.js +3 -0
  174. package/dist/prompts/prompt.cjs +3 -0
  175. package/dist/prompts/prompt.d.ts +1 -0
  176. package/dist/prompts/prompt.js +3 -0
  177. package/dist/retrievers/amazon_kendra.cjs +3 -0
  178. package/dist/retrievers/amazon_kendra.d.ts +1 -0
  179. package/dist/retrievers/amazon_kendra.js +3 -0
  180. package/dist/retrievers/contextual_compression.cjs +3 -0
  181. package/dist/retrievers/contextual_compression.d.ts +1 -0
  182. package/dist/retrievers/contextual_compression.js +3 -0
  183. package/dist/retrievers/databerry.cjs +3 -0
  184. package/dist/retrievers/databerry.d.ts +1 -0
  185. package/dist/retrievers/databerry.js +3 -0
  186. package/dist/retrievers/hyde.cjs +3 -0
  187. package/dist/retrievers/hyde.d.ts +1 -0
  188. package/dist/retrievers/hyde.js +3 -0
  189. package/dist/retrievers/metal.cjs +3 -0
  190. package/dist/retrievers/metal.d.ts +1 -0
  191. package/dist/retrievers/metal.js +3 -0
  192. package/dist/retrievers/parent_document.cjs +3 -0
  193. package/dist/retrievers/parent_document.d.ts +1 -0
  194. package/dist/retrievers/parent_document.js +3 -0
  195. package/dist/retrievers/self_query/index.cjs +3 -0
  196. package/dist/retrievers/self_query/index.d.ts +1 -0
  197. package/dist/retrievers/self_query/index.js +3 -0
  198. package/dist/retrievers/self_query/supabase.cjs +28 -7
  199. package/dist/retrievers/self_query/supabase.d.ts +2 -2
  200. package/dist/retrievers/self_query/supabase.js +29 -8
  201. package/dist/retrievers/self_query/supabase_utils.cjs +177 -0
  202. package/dist/retrievers/self_query/supabase_utils.d.ts +24 -0
  203. package/dist/retrievers/self_query/supabase_utils.js +172 -0
  204. package/dist/retrievers/self_query/utils.cjs +19 -3
  205. package/dist/retrievers/self_query/utils.d.ts +3 -0
  206. package/dist/retrievers/self_query/utils.js +15 -2
  207. package/dist/retrievers/self_query/weaviate.cjs +3 -14
  208. package/dist/retrievers/self_query/weaviate.js +1 -12
  209. package/dist/retrievers/supabase.cjs +3 -0
  210. package/dist/retrievers/supabase.d.ts +1 -0
  211. package/dist/retrievers/supabase.js +3 -0
  212. package/dist/retrievers/time_weighted.cjs +3 -0
  213. package/dist/retrievers/time_weighted.d.ts +1 -0
  214. package/dist/retrievers/time_weighted.js +3 -0
  215. package/dist/retrievers/vespa.cjs +3 -0
  216. package/dist/retrievers/vespa.d.ts +1 -0
  217. package/dist/retrievers/vespa.js +3 -0
  218. package/dist/retrievers/zep.cjs +3 -0
  219. package/dist/retrievers/zep.d.ts +1 -0
  220. package/dist/retrievers/zep.js +3 -0
  221. package/dist/schema/index.cjs +32 -2
  222. package/dist/schema/index.d.ts +14 -0
  223. package/dist/schema/index.js +32 -2
  224. package/dist/schema/output_parser.cjs +6 -0
  225. package/dist/schema/output_parser.d.ts +2 -0
  226. package/dist/schema/output_parser.js +6 -0
  227. package/dist/schema/runnable.cjs +25 -7
  228. package/dist/schema/runnable.d.ts +6 -0
  229. package/dist/schema/runnable.js +25 -7
  230. package/dist/stores/message/utils.cjs +5 -0
  231. package/dist/stores/message/utils.js +6 -1
  232. package/dist/text_splitter.cjs +9 -0
  233. package/dist/text_splitter.d.ts +3 -0
  234. package/dist/text_splitter.js +9 -0
  235. package/dist/tools/IFTTTWebhook.cjs +3 -0
  236. package/dist/tools/IFTTTWebhook.d.ts +1 -0
  237. package/dist/tools/IFTTTWebhook.js +3 -0
  238. package/dist/tools/aiplugin.cjs +3 -0
  239. package/dist/tools/aiplugin.d.ts +1 -0
  240. package/dist/tools/aiplugin.js +3 -0
  241. package/dist/tools/aws_sfn.cjs +9 -0
  242. package/dist/tools/aws_sfn.d.ts +3 -0
  243. package/dist/tools/aws_sfn.js +9 -0
  244. package/dist/tools/bingserpapi.cjs +3 -0
  245. package/dist/tools/bingserpapi.d.ts +1 -0
  246. package/dist/tools/bingserpapi.js +3 -0
  247. package/dist/tools/brave_search.cjs +3 -0
  248. package/dist/tools/brave_search.d.ts +1 -0
  249. package/dist/tools/brave_search.js +3 -0
  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/chain.cjs +3 -0
  254. package/dist/tools/chain.d.ts +1 -0
  255. package/dist/tools/chain.js +3 -0
  256. package/dist/tools/dadjokeapi.cjs +3 -0
  257. package/dist/tools/dadjokeapi.d.ts +1 -0
  258. package/dist/tools/dadjokeapi.js +3 -0
  259. package/dist/tools/dataforseo_api_search.cjs +3 -0
  260. package/dist/tools/dataforseo_api_search.d.ts +1 -0
  261. package/dist/tools/dataforseo_api_search.js +3 -0
  262. package/dist/tools/dynamic.cjs +6 -0
  263. package/dist/tools/dynamic.d.ts +2 -0
  264. package/dist/tools/dynamic.js +6 -0
  265. package/dist/tools/fs.cjs +6 -0
  266. package/dist/tools/fs.d.ts +2 -0
  267. package/dist/tools/fs.js +6 -0
  268. package/dist/tools/google_custom_search.cjs +3 -0
  269. package/dist/tools/google_custom_search.d.ts +1 -0
  270. package/dist/tools/google_custom_search.js +3 -0
  271. package/dist/tools/json.cjs +7 -1
  272. package/dist/tools/json.d.ts +2 -0
  273. package/dist/tools/json.js +7 -1
  274. package/dist/tools/requests.cjs +8 -2
  275. package/dist/tools/requests.d.ts +2 -0
  276. package/dist/tools/requests.js +8 -2
  277. package/dist/tools/searxng_search.cjs +3 -0
  278. package/dist/tools/searxng_search.d.ts +1 -0
  279. package/dist/tools/searxng_search.js +3 -0
  280. package/dist/tools/serpapi.cjs +3 -0
  281. package/dist/tools/serpapi.d.ts +1 -0
  282. package/dist/tools/serpapi.js +3 -0
  283. package/dist/tools/serper.cjs +3 -0
  284. package/dist/tools/serper.d.ts +1 -0
  285. package/dist/tools/serper.js +3 -0
  286. package/dist/tools/sql.cjs +12 -0
  287. package/dist/tools/sql.d.ts +4 -0
  288. package/dist/tools/sql.js +12 -0
  289. package/dist/tools/vectorstore.cjs +3 -0
  290. package/dist/tools/vectorstore.d.ts +1 -0
  291. package/dist/tools/vectorstore.js +3 -0
  292. package/dist/tools/webbrowser.cjs +3 -0
  293. package/dist/tools/webbrowser.d.ts +1 -0
  294. package/dist/tools/webbrowser.js +3 -0
  295. package/dist/tools/wikipedia_query_run.cjs +3 -0
  296. package/dist/tools/wikipedia_query_run.d.ts +1 -0
  297. package/dist/tools/wikipedia_query_run.js +3 -0
  298. package/dist/tools/zapier.cjs +3 -0
  299. package/dist/tools/zapier.d.ts +1 -0
  300. package/dist/tools/zapier.js +3 -0
  301. package/dist/vectorstores/base.cjs +3 -0
  302. package/dist/vectorstores/base.d.ts +1 -0
  303. package/dist/vectorstores/base.js +3 -0
  304. package/dist/vectorstores/elasticsearch.cjs +1 -0
  305. package/dist/vectorstores/elasticsearch.js +1 -0
  306. package/dist/vectorstores/hnswlib.cjs +19 -0
  307. package/dist/vectorstores/hnswlib.d.ts +3 -0
  308. package/dist/vectorstores/hnswlib.js +19 -0
  309. package/dist/vectorstores/myscale.cjs +1 -1
  310. package/dist/vectorstores/myscale.js +1 -1
  311. package/dist/vectorstores/supabase.d.ts +1 -2
  312. package/document_loaders/web/youtube.cjs +1 -0
  313. package/document_loaders/web/youtube.d.ts +1 -0
  314. package/document_loaders/web/youtube.js +1 -0
  315. package/package.json +27 -3
@@ -12,6 +12,9 @@ const DEFAULT_HUMAN_MESSAGE_TEMPLATE = "{input}\n\n{agent_scratchpad}";
12
12
  * @augments Agent
13
13
  */
14
14
  class ChatAgent extends agent_js_1.Agent {
15
+ static lc_name() {
16
+ return "ChatAgent";
17
+ }
15
18
  constructor(input) {
16
19
  const outputParser = input?.outputParser ?? ChatAgent.getDefaultOutputParser();
17
20
  super({ ...input, outputParser });
@@ -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
+ static lc_name(): string;
25
26
  lc_namespace: string[];
26
27
  ToolType: Tool;
27
28
  constructor(input: ChatAgentInput);
@@ -9,6 +9,9 @@ const DEFAULT_HUMAN_MESSAGE_TEMPLATE = "{input}\n\n{agent_scratchpad}";
9
9
  * @augments Agent
10
10
  */
11
11
  export class ChatAgent extends Agent {
12
+ static lc_name() {
13
+ return "ChatAgent";
14
+ }
12
15
  constructor(input) {
13
16
  const outputParser = input?.outputParser ?? ChatAgent.getDefaultOutputParser();
14
17
  super({ ...input, outputParser });
@@ -13,6 +13,9 @@ const prompt_js_1 = require("./prompt.cjs");
13
13
  * @augments Agent
14
14
  */
15
15
  class ChatConversationalAgent extends agent_js_1.Agent {
16
+ static lc_name() {
17
+ return "ChatConversationalAgent";
18
+ }
16
19
  constructor(input) {
17
20
  const outputParser = input.outputParser ?? ChatConversationalAgent.getDefaultOutputParser();
18
21
  super({ ...input, outputParser });
@@ -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
+ static lc_name(): string;
24
25
  lc_namespace: string[];
25
26
  ToolType: Tool;
26
27
  constructor(input: ChatConversationalAgentInput);
@@ -10,6 +10,9 @@ import { PREFIX_END, DEFAULT_PREFIX, DEFAULT_SUFFIX, TEMPLATE_TOOL_RESPONSE, } f
10
10
  * @augments Agent
11
11
  */
12
12
  export class ChatConversationalAgent extends Agent {
13
+ static lc_name() {
14
+ return "ChatConversationalAgent";
15
+ }
13
16
  constructor(input) {
14
17
  const outputParser = input.outputParser ?? ChatConversationalAgent.getDefaultOutputParser();
15
18
  super({ ...input, outputParser });
@@ -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
+ static lc_name() {
11
+ return "AgentExecutor";
12
+ }
10
13
  get lc_namespace() {
11
14
  return ["langchain", "agents", "executor"];
12
15
  }
@@ -16,6 +16,7 @@ export interface AgentExecutorInput extends ChainInputs {
16
16
  * @augments BaseChain
17
17
  */
18
18
  export declare class AgentExecutor extends BaseChain {
19
+ static lc_name(): string;
19
20
  get lc_namespace(): string[];
20
21
  agent: BaseSingleActionAgent | BaseMultiActionAgent;
21
22
  tools: this["agent"]["ToolType"][];
@@ -4,6 +4,9 @@ import { BaseChain } from "../chains/base.js";
4
4
  * @augments BaseChain
5
5
  */
6
6
  export class AgentExecutor extends BaseChain {
7
+ static lc_name() {
8
+ return "AgentExecutor";
9
+ }
7
10
  get lc_namespace() {
8
11
  return ["langchain", "agents", "executor"];
9
12
  }
@@ -13,6 +13,9 @@ const prompt_js_2 = require("./prompt.cjs");
13
13
  * @augments Agent
14
14
  */
15
15
  class ZeroShotAgent extends agent_js_1.Agent {
16
+ static lc_name() {
17
+ return "ZeroShotAgent";
18
+ }
16
19
  constructor(input) {
17
20
  const outputParser = input?.outputParser ?? ZeroShotAgent.getDefaultOutputParser();
18
21
  super({ ...input, outputParser });
@@ -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
+ static lc_name(): string;
22
23
  lc_namespace: string[];
23
24
  ToolType: Tool;
24
25
  constructor(input: ZeroShotAgentInput);
@@ -10,6 +10,9 @@ import { FORMAT_INSTRUCTIONS, PREFIX, SUFFIX } from "./prompt.js";
10
10
  * @augments Agent
11
11
  */
12
12
  export class ZeroShotAgent extends Agent {
13
+ static lc_name() {
14
+ return "ZeroShotAgent";
15
+ }
13
16
  constructor(input) {
14
17
  const outputParser = input?.outputParser ?? ZeroShotAgent.getDefaultOutputParser();
15
18
  super({ ...input, outputParser });
@@ -46,6 +46,9 @@ function _formatIntermediateSteps(intermediateSteps) {
46
46
  }
47
47
  exports._formatIntermediateSteps = _formatIntermediateSteps;
48
48
  class OpenAIAgent extends agent_js_1.Agent {
49
+ static lc_name() {
50
+ return "OpenAIAgent";
51
+ }
49
52
  _agentType() {
50
53
  return "openai-functions";
51
54
  }
@@ -14,6 +14,7 @@ export interface OpenAIAgentCreatePromptArgs {
14
14
  systemMessage?: SystemMessage;
15
15
  }
16
16
  export declare class OpenAIAgent extends Agent {
17
+ static lc_name(): string;
17
18
  lc_namespace: string[];
18
19
  _agentType(): "openai-functions";
19
20
  observationPrefix(): string;
@@ -42,6 +42,9 @@ export function _formatIntermediateSteps(intermediateSteps) {
42
42
  return intermediateSteps.flatMap(({ action, observation }) => _convertAgentStepToMessages(action, observation));
43
43
  }
44
44
  export class OpenAIAgent extends Agent {
45
+ static lc_name() {
46
+ return "OpenAIAgent";
47
+ }
45
48
  _agentType() {
46
49
  return "openai-functions";
47
50
  }
@@ -13,6 +13,9 @@ const prompt_js_2 = require("./prompt.cjs");
13
13
  * @augments Agent
14
14
  */
15
15
  class StructuredChatAgent extends agent_js_1.Agent {
16
+ static lc_name() {
17
+ return "StructuredChatAgent";
18
+ }
16
19
  constructor(input) {
17
20
  const outputParser = input?.outputParser ?? StructuredChatAgent.getDefaultOutputParser();
18
21
  super({ ...input, outputParser });
@@ -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
+ static lc_name(): string;
25
26
  lc_namespace: string[];
26
27
  constructor(input: StructuredChatAgentInput);
27
28
  _agentType(): "structured-chat-zero-shot-react-description";
@@ -10,6 +10,9 @@ import { FORMAT_INSTRUCTIONS, PREFIX, SUFFIX } from "./prompt.js";
10
10
  * @augments Agent
11
11
  */
12
12
  export class StructuredChatAgent extends Agent {
13
+ static lc_name() {
14
+ return "StructuredChatAgent";
15
+ }
13
16
  constructor(input) {
14
17
  const outputParser = input?.outputParser ?? StructuredChatAgent.getDefaultOutputParser();
15
18
  super({ ...input, outputParser });
@@ -41,6 +41,24 @@ class BaseCallbackHandler extends BaseCallbackHandlerMethodsClass {
41
41
  get lc_aliases() {
42
42
  return undefined;
43
43
  }
44
+ /**
45
+ * The name of the serializable. Override to provide an alias or
46
+ * to preserve the serialized module name in minified environments.
47
+ *
48
+ * Implemented as a static method to support loading logic.
49
+ */
50
+ static lc_name() {
51
+ return this.name;
52
+ }
53
+ /**
54
+ * The final serialized identifier for the module.
55
+ */
56
+ get lc_id() {
57
+ return [
58
+ ...this.lc_namespace,
59
+ (0, serializable_js_1.get_lc_unique_name)(this.constructor),
60
+ ];
61
+ }
44
62
  constructor(input) {
45
63
  super();
46
64
  Object.defineProperty(this, "lc_serializable", {
@@ -106,6 +106,17 @@ export declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMet
106
106
  get lc_aliases(): {
107
107
  [key: string]: string;
108
108
  } | undefined;
109
+ /**
110
+ * The name of the serializable. Override to provide an alias or
111
+ * to preserve the serialized module name in minified environments.
112
+ *
113
+ * Implemented as a static method to support loading logic.
114
+ */
115
+ static lc_name(): string;
116
+ /**
117
+ * The final serialized identifier for the module.
118
+ */
119
+ get lc_id(): string[];
109
120
  lc_kwargs: SerializedFields;
110
121
  abstract name: string;
111
122
  ignoreLLM: boolean;
@@ -130,6 +141,10 @@ export declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMet
130
141
  readonly lc_aliases: {
131
142
  [key: string]: string;
132
143
  } | undefined;
144
+ /**
145
+ * The final serialized identifier for the module.
146
+ */
147
+ readonly lc_id: string[];
133
148
  lc_kwargs: SerializedFields;
134
149
  ignoreLLM: boolean;
135
150
  ignoreChain: boolean;
@@ -1,5 +1,5 @@
1
1
  import * as uuid from "uuid";
2
- import { Serializable, } from "../load/serializable.js";
2
+ import { Serializable, get_lc_unique_name, } from "../load/serializable.js";
3
3
  class BaseCallbackHandlerMethodsClass {
4
4
  }
5
5
  export class BaseCallbackHandler extends BaseCallbackHandlerMethodsClass {
@@ -15,6 +15,24 @@ export class BaseCallbackHandler extends BaseCallbackHandlerMethodsClass {
15
15
  get lc_aliases() {
16
16
  return undefined;
17
17
  }
18
+ /**
19
+ * The name of the serializable. Override to provide an alias or
20
+ * to preserve the serialized module name in minified environments.
21
+ *
22
+ * Implemented as a static method to support loading logic.
23
+ */
24
+ static lc_name() {
25
+ return this.name;
26
+ }
27
+ /**
28
+ * The final serialized identifier for the module.
29
+ */
30
+ get lc_id() {
31
+ return [
32
+ ...this.lc_namespace,
33
+ get_lc_unique_name(this.constructor),
34
+ ];
35
+ }
18
36
  constructor(input) {
19
37
  super();
20
38
  Object.defineProperty(this, "lc_serializable", {
@@ -495,7 +495,7 @@ class CallbackManager extends BaseCallbackManager {
495
495
  : localHandlers?.handlers, false);
496
496
  }
497
497
  const verboseEnabled = (0, env_js_1.getEnvironmentVariable)("LANGCHAIN_VERBOSE") || options?.verbose;
498
- const tracingV2Enabled = (0, env_js_1.getEnvironmentVariable)("LANGCHAIN_TRACING_V2") ?? false;
498
+ const tracingV2Enabled = (0, env_js_1.getEnvironmentVariable)("LANGCHAIN_TRACING_V2") === "true";
499
499
  const tracingEnabled = tracingV2Enabled ||
500
500
  ((0, env_js_1.getEnvironmentVariable)("LANGCHAIN_TRACING") ?? false);
501
501
  if (verboseEnabled || tracingEnabled) {
@@ -486,7 +486,7 @@ export class CallbackManager extends BaseCallbackManager {
486
486
  : localHandlers?.handlers, false);
487
487
  }
488
488
  const verboseEnabled = getEnvironmentVariable("LANGCHAIN_VERBOSE") || options?.verbose;
489
- const tracingV2Enabled = getEnvironmentVariable("LANGCHAIN_TRACING_V2") ?? false;
489
+ const tracingV2Enabled = getEnvironmentVariable("LANGCHAIN_TRACING_V2") === "true";
490
490
  const tracingEnabled = tracingV2Enabled ||
491
491
  (getEnvironmentVariable("LANGCHAIN_TRACING") ?? false);
492
492
  if (verboseEnabled || tracingEnabled) {
@@ -9,6 +9,9 @@ const text_splitter_js_1 = require("../text_splitter.cjs");
9
9
  * @augments StuffDocumentsChainInput
10
10
  */
11
11
  class AnalyzeDocumentChain extends base_js_1.BaseChain {
12
+ static lc_name() {
13
+ return "AnalyzeDocumentChain";
14
+ }
12
15
  constructor(fields) {
13
16
  super(fields);
14
17
  Object.defineProperty(this, "inputKey", {
@@ -15,6 +15,7 @@ export interface AnalyzeDocumentChainInput extends Omit<ChainInputs, "memory"> {
15
15
  * @augments StuffDocumentsChainInput
16
16
  */
17
17
  export declare class AnalyzeDocumentChain extends BaseChain implements AnalyzeDocumentChainInput {
18
+ static lc_name(): string;
18
19
  inputKey: string;
19
20
  combineDocumentsChain: BaseChain;
20
21
  textSplitter: TextSplitter;
@@ -6,6 +6,9 @@ import { RecursiveCharacterTextSplitter, } from "../text_splitter.js";
6
6
  * @augments StuffDocumentsChainInput
7
7
  */
8
8
  export class AnalyzeDocumentChain extends BaseChain {
9
+ static lc_name() {
10
+ return "AnalyzeDocumentChain";
11
+ }
9
12
  constructor(fields) {
10
13
  super(fields);
11
14
  Object.defineProperty(this, "inputKey", {
@@ -10,6 +10,9 @@ const prompt_js_1 = require("../prompts/prompt.cjs");
10
10
  * @augments StuffDocumentsChainInput
11
11
  */
12
12
  class StuffDocumentsChain extends base_js_1.BaseChain {
13
+ static lc_name() {
14
+ return "StuffDocumentsChain";
15
+ }
13
16
  get inputKeys() {
14
17
  return [this.inputKey, ...this.llmChain.inputKeys].filter((key) => key !== this.documentVariableName);
15
18
  }
@@ -84,6 +87,9 @@ exports.StuffDocumentsChain = StuffDocumentsChain;
84
87
  * @augments StuffDocumentsChainInput
85
88
  */
86
89
  class MapReduceDocumentsChain extends base_js_1.BaseChain {
90
+ static lc_name() {
91
+ return "MapReduceDocumentsChain";
92
+ }
87
93
  get inputKeys() {
88
94
  return [this.inputKey, ...this.combineDocumentChain.inputKeys];
89
95
  }
@@ -238,6 +244,9 @@ exports.MapReduceDocumentsChain = MapReduceDocumentsChain;
238
244
  * @augments RefineDocumentsChainInput
239
245
  */
240
246
  class RefineDocumentsChain extends base_js_1.BaseChain {
247
+ static lc_name() {
248
+ return "RefineDocumentsChain";
249
+ }
241
250
  get defaultDocumentPrompt() {
242
251
  return new prompt_js_1.PromptTemplate({
243
252
  inputVariables: ["page_content"],
@@ -18,6 +18,7 @@ export interface StuffDocumentsChainInput extends ChainInputs {
18
18
  * @augments StuffDocumentsChainInput
19
19
  */
20
20
  export declare class StuffDocumentsChain extends BaseChain implements StuffDocumentsChainInput {
21
+ static lc_name(): string;
21
22
  llmChain: LLMChain;
22
23
  inputKey: string;
23
24
  documentVariableName: string;
@@ -50,6 +51,7 @@ export interface MapReduceDocumentsChainInput extends StuffDocumentsChainInput {
50
51
  * @augments StuffDocumentsChainInput
51
52
  */
52
53
  export declare class MapReduceDocumentsChain extends BaseChain implements MapReduceDocumentsChainInput {
54
+ static lc_name(): string;
53
55
  llmChain: LLMChain;
54
56
  inputKey: string;
55
57
  documentVariableName: string;
@@ -80,6 +82,7 @@ export interface RefineDocumentsChainInput extends StuffDocumentsChainInput {
80
82
  * @augments RefineDocumentsChainInput
81
83
  */
82
84
  export declare class RefineDocumentsChain extends BaseChain implements RefineDocumentsChainInput {
85
+ static lc_name(): string;
83
86
  llmChain: LLMChain;
84
87
  inputKey: string;
85
88
  outputKey: string;
@@ -7,6 +7,9 @@ import { PromptTemplate } from "../prompts/prompt.js";
7
7
  * @augments StuffDocumentsChainInput
8
8
  */
9
9
  export class StuffDocumentsChain extends BaseChain {
10
+ static lc_name() {
11
+ return "StuffDocumentsChain";
12
+ }
10
13
  get inputKeys() {
11
14
  return [this.inputKey, ...this.llmChain.inputKeys].filter((key) => key !== this.documentVariableName);
12
15
  }
@@ -80,6 +83,9 @@ export class StuffDocumentsChain extends BaseChain {
80
83
  * @augments StuffDocumentsChainInput
81
84
  */
82
85
  export class MapReduceDocumentsChain extends BaseChain {
86
+ static lc_name() {
87
+ return "MapReduceDocumentsChain";
88
+ }
83
89
  get inputKeys() {
84
90
  return [this.inputKey, ...this.combineDocumentChain.inputKeys];
85
91
  }
@@ -233,6 +239,9 @@ export class MapReduceDocumentsChain extends BaseChain {
233
239
  * @augments RefineDocumentsChainInput
234
240
  */
235
241
  export class RefineDocumentsChain extends BaseChain {
242
+ static lc_name() {
243
+ return "RefineDocumentsChain";
244
+ }
236
245
  get defaultDocumentPrompt() {
237
246
  return new PromptTemplate({
238
247
  inputVariables: ["page_content"],
@@ -6,6 +6,9 @@ const llm_chain_js_1 = require("../llm_chain.cjs");
6
6
  const constitutional_principle_js_1 = require("./constitutional_principle.cjs");
7
7
  const constitutional_prompts_js_1 = require("./constitutional_prompts.cjs");
8
8
  class ConstitutionalChain extends base_js_1.BaseChain {
9
+ static lc_name() {
10
+ return "ConstitutionalChain";
11
+ }
9
12
  get inputKeys() {
10
13
  return this.chain.inputKeys;
11
14
  }
@@ -12,6 +12,7 @@ export interface ConstitutionalChainInput extends ChainInputs {
12
12
  revisionChain: LLMChain;
13
13
  }
14
14
  export declare class ConstitutionalChain extends BaseChain implements ConstitutionalChainInput {
15
+ static lc_name(): string;
15
16
  chain: LLMChain;
16
17
  constitutionalPrinciples: ConstitutionalPrinciple[];
17
18
  critiqueChain: LLMChain;
@@ -3,6 +3,9 @@ import { LLMChain } from "../llm_chain.js";
3
3
  import { PRINCIPLES, } from "./constitutional_principle.js";
4
4
  import { CRITIQUE_PROMPT, REVISION_PROMPT } from "./constitutional_prompts.js";
5
5
  export class ConstitutionalChain extends BaseChain {
6
+ static lc_name() {
7
+ return "ConstitutionalChain";
8
+ }
6
9
  get inputKeys() {
7
10
  return this.chain.inputKeys;
8
11
  }
@@ -11,6 +11,9 @@ Current conversation:
11
11
  Human: {input}
12
12
  AI:`;
13
13
  class ConversationChain extends llm_chain_js_1.LLMChain {
14
+ static lc_name() {
15
+ return "ConversationChain";
16
+ }
14
17
  constructor({ prompt, outputKey, memory, ...rest }) {
15
18
  super({
16
19
  prompt: prompt ??
@@ -2,5 +2,6 @@ import { LLMChain, LLMChainInput } from "./llm_chain.js";
2
2
  import { Optional } from "../types/type-utils.js";
3
3
  export declare const DEFAULT_TEMPLATE = "The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n\nCurrent conversation:\n{history}\nHuman: {input}\nAI:";
4
4
  export declare class ConversationChain extends LLMChain {
5
+ static lc_name(): string;
5
6
  constructor({ prompt, outputKey, memory, ...rest }: Optional<LLMChainInput, "prompt">);
6
7
  }
@@ -8,6 +8,9 @@ Current conversation:
8
8
  Human: {input}
9
9
  AI:`;
10
10
  export class ConversationChain extends LLMChain {
11
+ static lc_name() {
12
+ return "ConversationChain";
13
+ }
11
14
  constructor({ prompt, outputKey, memory, ...rest }) {
12
15
  super({
13
16
  prompt: prompt ??
@@ -13,6 +13,9 @@ Chat History:
13
13
  Follow Up Input: {question}
14
14
  Standalone question:`;
15
15
  class ConversationalRetrievalQAChain extends base_js_1.BaseChain {
16
+ static lc_name() {
17
+ return "ConversationalRetrievalQAChain";
18
+ }
16
19
  get inputKeys() {
17
20
  return [this.inputKey, this.chatHistoryKey];
18
21
  }
@@ -15,6 +15,7 @@ export interface ConversationalRetrievalQAChainInput extends ChainInputs {
15
15
  inputKey?: string;
16
16
  }
17
17
  export declare class ConversationalRetrievalQAChain extends BaseChain implements ConversationalRetrievalQAChainInput {
18
+ static lc_name(): string;
18
19
  inputKey: string;
19
20
  chatHistoryKey: string;
20
21
  get inputKeys(): string[];
@@ -10,6 +10,9 @@ Chat History:
10
10
  Follow Up Input: {question}
11
11
  Standalone question:`;
12
12
  export class ConversationalRetrievalQAChain extends BaseChain {
13
+ static lc_name() {
14
+ return "ConversationalRetrievalQAChain";
15
+ }
13
16
  get inputKeys() {
14
17
  return [this.inputKey, this.chatHistoryKey];
15
18
  }
@@ -19,6 +19,9 @@ const noop_js_1 = require("../output_parsers/noop.cjs");
19
19
  * ```
20
20
  */
21
21
  class LLMChain extends base_js_1.BaseChain {
22
+ static lc_name() {
23
+ return "LLMChain";
24
+ }
22
25
  get inputKeys() {
23
26
  return this.prompt.inputVariables;
24
27
  }
@@ -32,6 +32,7 @@ export interface LLMChainInput<T extends string | object = string, L extends Bas
32
32
  * ```
33
33
  */
34
34
  export declare class LLMChain<T extends string | object = string, L extends BaseLanguageModel = BaseLanguageModel> extends BaseChain implements LLMChainInput<T> {
35
+ static lc_name(): string;
35
36
  lc_serializable: boolean;
36
37
  prompt: BasePromptTemplate;
37
38
  llm: L;
@@ -16,6 +16,9 @@ import { NoOpOutputParser } from "../output_parsers/noop.js";
16
16
  * ```
17
17
  */
18
18
  export class LLMChain extends BaseChain {
19
+ static lc_name() {
20
+ return "LLMChain";
21
+ }
19
22
  get inputKeys() {
20
23
  return this.prompt.inputVariables;
21
24
  }
@@ -272,6 +272,9 @@ function convertOpenAPISpecToOpenAIFunctions(spec) {
272
272
  };
273
273
  }
274
274
  class SimpleRequestChain extends base_js_1.BaseChain {
275
+ static lc_name() {
276
+ return "SimpleRequestChain";
277
+ }
275
278
  constructor(config) {
276
279
  super();
277
280
  Object.defineProperty(this, "requestMethod", {
@@ -269,6 +269,9 @@ function convertOpenAPISpecToOpenAIFunctions(spec) {
269
269
  };
270
270
  }
271
271
  class SimpleRequestChain extends BaseChain {
272
+ static lc_name() {
273
+ return "SimpleRequestChain";
274
+ }
272
275
  constructor(config) {
273
276
  super();
274
277
  Object.defineProperty(this, "requestMethod", {
@@ -10,6 +10,9 @@ const axios_fetch_adapter_js_1 = __importDefault(require("../util/axios-fetch-ad
10
10
  const async_caller_js_1 = require("../util/async_caller.cjs");
11
11
  const env_js_1 = require("../util/env.cjs");
12
12
  class OpenAIModerationChain extends base_js_1.BaseChain {
13
+ static lc_name() {
14
+ return "OpenAIModerationChain";
15
+ }
13
16
  get lc_secrets() {
14
17
  return {
15
18
  openAIApiKey: "OPENAI_API_KEY",
@@ -9,6 +9,7 @@ export interface OpenAIModerationChainInput extends ChainInputs, AsyncCallerPara
9
9
  configuration?: ConfigurationParameters;
10
10
  }
11
11
  export declare class OpenAIModerationChain extends BaseChain implements OpenAIModerationChainInput {
12
+ static lc_name(): string;
12
13
  get lc_secrets(): {
13
14
  [key: string]: string;
14
15
  } | undefined;
@@ -4,6 +4,9 @@ import fetchAdapter from "../util/axios-fetch-adapter.js";
4
4
  import { AsyncCaller } from "../util/async_caller.js";
5
5
  import { getEnvironmentVariable } from "../util/env.js";
6
6
  export class OpenAIModerationChain extends BaseChain {
7
+ static lc_name() {
8
+ return "OpenAIModerationChain";
9
+ }
7
10
  get lc_secrets() {
8
11
  return {
9
12
  openAIApiKey: "OPENAI_API_KEY",
@@ -4,6 +4,9 @@ exports.RetrievalQAChain = void 0;
4
4
  const base_js_1 = require("./base.cjs");
5
5
  const load_js_1 = require("./question_answering/load.cjs");
6
6
  class RetrievalQAChain extends base_js_1.BaseChain {
7
+ static lc_name() {
8
+ return "RetrievalQAChain";
9
+ }
7
10
  get inputKeys() {
8
11
  return [this.inputKey];
9
12
  }
@@ -13,6 +13,7 @@ export interface RetrievalQAChainInput extends Omit<ChainInputs, "memory"> {
13
13
  returnSourceDocuments?: boolean;
14
14
  }
15
15
  export declare class RetrievalQAChain extends BaseChain implements RetrievalQAChainInput {
16
+ static lc_name(): string;
16
17
  inputKey: string;
17
18
  get inputKeys(): string[];
18
19
  get outputKeys(): string[];
@@ -1,6 +1,9 @@
1
1
  import { BaseChain } from "./base.js";
2
2
  import { loadQAStuffChain, } from "./question_answering/load.js";
3
3
  export class RetrievalQAChain extends BaseChain {
4
+ static lc_name() {
5
+ return "RetrievalQAChain";
6
+ }
4
7
  get inputKeys() {
5
8
  return [this.inputKey];
6
9
  }
@@ -16,6 +16,9 @@ class RouterChain extends base_js_1.BaseChain {
16
16
  }
17
17
  exports.RouterChain = RouterChain;
18
18
  class MultiRouteChain extends base_js_1.BaseChain {
19
+ static lc_name() {
20
+ return "MultiRouteChain";
21
+ }
19
22
  constructor(fields) {
20
23
  super(fields);
21
24
  Object.defineProperty(this, "routerChain", {
@@ -23,6 +23,7 @@ export declare abstract class RouterChain extends BaseChain {
23
23
  route(inputs: ChainValues, callbacks?: Callbacks): Promise<Route>;
24
24
  }
25
25
  export declare class MultiRouteChain extends BaseChain {
26
+ static lc_name(): string;
26
27
  routerChain: RouterChain;
27
28
  destinationChains: {
28
29
  [name: string]: BaseChain;