langchain 0.0.210 → 0.0.212

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.
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AgentExecutor = exports.ExceptionTool = exports.AgentExecutorIterator = void 0;
4
4
  const tools_1 = require("@langchain/core/tools");
5
+ const runnables_1 = require("@langchain/core/runnables");
5
6
  const base_js_1 = require("../chains/base.cjs");
6
7
  const agent_js_1 = require("./agent.cjs");
7
8
  const manager_js_1 = require("../callbacks/manager.cjs");
8
9
  const output_parser_js_1 = require("../schema/output_parser.cjs");
9
- const base_js_2 = require("../schema/runnable/base.cjs");
10
10
  const serializable_js_1 = require("../load/serializable.cjs");
11
11
  class AgentExecutorIterator extends serializable_js_1.Serializable {
12
12
  get finalOutputs() {
@@ -96,6 +96,7 @@ class AgentExecutorIterator extends serializable_js_1.Serializable {
96
96
  });
97
97
  this.agentExecutor = fields.agentExecutor;
98
98
  this.inputs = fields.inputs;
99
+ this.callbacks = fields.callbacks;
99
100
  this.tags = fields.tags;
100
101
  this.metadata = fields.metadata;
101
102
  this.runName = fields.runName;
@@ -268,7 +269,7 @@ class AgentExecutor extends base_js_1.BaseChain {
268
269
  }
269
270
  constructor(input) {
270
271
  let agent;
271
- if (base_js_2.Runnable.isRunnable(input.agent)) {
272
+ if (runnables_1.Runnable.isRunnable(input.agent)) {
272
273
  agent = new agent_js_1.RunnableAgent({ runnable: input.agent });
273
274
  }
274
275
  else {
@@ -591,13 +592,13 @@ class AgentExecutor extends base_js_1.BaseChain {
591
592
  }
592
593
  async *_streamIterator(
593
594
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
594
- inputs) {
595
+ inputs, options) {
595
596
  const agentExecutorIterator = new AgentExecutorIterator({
596
597
  inputs,
597
598
  agentExecutor: this,
598
- metadata: this.metadata,
599
- tags: this.tags,
600
- callbacks: this.callbacks,
599
+ metadata: options?.metadata,
600
+ tags: options?.tags,
601
+ callbacks: options?.callbacks,
601
602
  });
602
603
  const iterator = agentExecutorIterator.streamIterator();
603
604
  for await (const step of iterator) {
@@ -1,4 +1,5 @@
1
1
  import { type StructuredToolInterface, type ToolInterface, ToolInputParsingException, Tool } from "@langchain/core/tools";
2
+ import { Runnable, type RunnableConfig } from "@langchain/core/runnables";
2
3
  import { BaseChain, ChainInputs } from "../chains/base.js";
3
4
  import { BaseMultiActionAgent, BaseSingleActionAgent } from "./agent.js";
4
5
  import { StoppingMethod } from "./types.js";
@@ -6,7 +7,6 @@ import { SerializedLLMChain } from "../chains/serde.js";
6
7
  import { AgentAction, ChainValues, AgentFinish, AgentStep } from "../schema/index.js";
7
8
  import { CallbackManagerForChainRun, Callbacks } from "../callbacks/manager.js";
8
9
  import { OutputParserException } from "../schema/output_parser.js";
9
- import { Runnable } from "../schema/runnable/base.js";
10
10
  import { Serializable } from "../load/serializable.js";
11
11
  interface AgentExecutorIteratorInput {
12
12
  agentExecutor: AgentExecutor;
@@ -21,7 +21,7 @@ export declare class AgentExecutorIterator extends Serializable implements Agent
21
21
  lc_namespace: string[];
22
22
  agentExecutor: AgentExecutor;
23
23
  inputs: Record<string, string>;
24
- callbacks: Callbacks;
24
+ callbacks?: Callbacks;
25
25
  tags: string[] | undefined;
26
26
  metadata: Record<string, unknown> | undefined;
27
27
  runName: string | undefined;
@@ -143,7 +143,7 @@ export declare class AgentExecutor extends BaseChain<ChainValues, AgentExecutorO
143
143
  _return(output: AgentFinish, intermediateSteps: AgentStep[], runManager?: CallbackManagerForChainRun): Promise<AgentExecutorOutput>;
144
144
  _getToolReturn(nextStepOutput: AgentStep): Promise<AgentFinish | null>;
145
145
  _returnStoppedResponse(earlyStoppingMethod: StoppingMethod): AgentFinish;
146
- _streamIterator(inputs: Record<string, any>): AsyncGenerator<ChainValues>;
146
+ _streamIterator(inputs: Record<string, any>, options?: Partial<RunnableConfig>): AsyncGenerator<ChainValues>;
147
147
  _chainType(): "agent_executor";
148
148
  serialize(): SerializedLLMChain;
149
149
  }
@@ -1,9 +1,9 @@
1
1
  import { ToolInputParsingException, Tool, } from "@langchain/core/tools";
2
+ import { Runnable } from "@langchain/core/runnables";
2
3
  import { BaseChain } from "../chains/base.js";
3
4
  import { RunnableAgent, } from "./agent.js";
4
5
  import { CallbackManager, } from "../callbacks/manager.js";
5
6
  import { OutputParserException } from "../schema/output_parser.js";
6
- import { Runnable } from "../schema/runnable/base.js";
7
7
  import { Serializable } from "../load/serializable.js";
8
8
  export class AgentExecutorIterator extends Serializable {
9
9
  get finalOutputs() {
@@ -93,6 +93,7 @@ export class AgentExecutorIterator extends Serializable {
93
93
  });
94
94
  this.agentExecutor = fields.agentExecutor;
95
95
  this.inputs = fields.inputs;
96
+ this.callbacks = fields.callbacks;
96
97
  this.tags = fields.tags;
97
98
  this.metadata = fields.metadata;
98
99
  this.runName = fields.runName;
@@ -586,13 +587,13 @@ export class AgentExecutor extends BaseChain {
586
587
  }
587
588
  async *_streamIterator(
588
589
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
589
- inputs) {
590
+ inputs, options) {
590
591
  const agentExecutorIterator = new AgentExecutorIterator({
591
592
  inputs,
592
593
  agentExecutor: this,
593
- metadata: this.metadata,
594
- tags: this.tags,
595
- callbacks: this.callbacks,
594
+ metadata: options?.metadata,
595
+ tags: options?.tags,
596
+ callbacks: options?.callbacks,
596
597
  });
597
598
  const iterator = agentExecutorIterator.streamIterator();
598
599
  for await (const step of iterator) {
@@ -41,8 +41,7 @@ class DocxLoader extends buffer_js_1.BufferLoader {
41
41
  exports.DocxLoader = DocxLoader;
42
42
  async function DocxLoaderImports() {
43
43
  try {
44
- const { default: mod } = await import("mammoth");
45
- const { extractRawText } = mod;
44
+ const { extractRawText } = await import("mammoth");
46
45
  return { extractRawText };
47
46
  }
48
47
  catch (e) {
@@ -37,8 +37,7 @@ export class DocxLoader extends BufferLoader {
37
37
  }
38
38
  async function DocxLoaderImports() {
39
39
  try {
40
- const { default: mod } = await import("mammoth");
41
- const { extractRawText } = mod;
40
+ const { extractRawText } = await import("mammoth");
42
41
  return { extractRawText };
43
42
  }
44
43
  catch (e) {
package/dist/index.cjs ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ console.warn(`[WARNING]: The root "langchain" entrypoint is empty. Please use a specific entrypoint instead.`);
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ console.warn(`[WARNING]: The root "langchain" entrypoint is empty. Please use a specific entrypoint instead.`);
2
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain",
3
- "version": "0.0.210",
3
+ "version": "0.0.212",
4
4
  "description": "Typescript bindings for langchain",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1000,7 +1000,7 @@
1000
1000
  "ignore": "^5.2.0",
1001
1001
  "ioredis": "^5.3.2",
1002
1002
  "jsdom": "*",
1003
- "mammoth": "*",
1003
+ "mammoth": "^1.6.0",
1004
1004
  "mongodb": "^5.2.0",
1005
1005
  "node-llama-cpp": "*",
1006
1006
  "notion-to-md": "^3.1.0",